File size: 2,874 Bytes
f4b3191
 
686b7eb
f4b3191
 
 
 
 
 
 
 
 
 
 
 
 
 
686b7eb
 
f4b3191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
686b7eb
f4b3191
 
 
 
 
686b7eb
f4b3191
 
 
686b7eb
f4b3191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
686b7eb
 
f4b3191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
686b7eb
 
 
 
f4b3191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

// Martyrs data with new structure
const martyrs = [
  {
    id: 'martyr_1',
    name: "أحمد محمد",
    info: "العمر: 27 • تاريخ الاستشهاد: 15-04-2013 • المهنة: مزارع", 
    quote: "الكرامة أغلى من الحياة",
    img: null
  },
  {
    id: 'martyr_2', 
    name: "ياسر علي",
    info: "العمر: 34 • تاريخ الاستشهاد: 22-07-2014 • المهنة: معلم",
    quote: "نحن أبناء هذه الأرض ولن نرحل",
    img: null
  }
];

// Timeline events
const timelineEvents = [
  {
    id: 'event_1',
    title: "قبل الحرب",
    desc: "داريا مدينة زراعية، مشهورة بكروم العنب والكرم.",
    date: "قبل 2011"
  },
  {
    id: 'event_2',
    title: "الحصار", 
    desc: "سنوات من الحصار أدّت لتهجير واسع وخسائر بشرية ومادية.",
    date: "2012-2016"
  }
];
// Local storage model
const store = {
  get(key) {
    try {
      return JSON.parse(localStorage.getItem('daraya_'+key) || 'null');
    } catch(e) {
      return null;
    }
  },
  set(key, val) {
    localStorage.setItem('daraya_'+key, JSON.stringify(val));
  }
};

// Initialize data
if(!store.get('martyrs')) store.set('martyrs', martyrs);
if(!store.get('timeline')) store.set('timeline', timelineEvents);

// Render martyrs list
function renderMartyrs() {
  const container = document.getElementById('martyrsList');
  const martyrsData = store.get('martyrs') || [];
  
  container.innerHTML = '';
  
  martyrsData.forEach(martyr => {
    const card = document.createElement('div');
    card.className = 'm-card';
    card.innerHTML = `
      <div class="thumb">${martyr.name[0] || 'ش'}</div>
      <div>
        <h4>${martyr.name}</h4>
        <p>${martyr.info}</p>
      </div>
    `;
    container.appendChild(card);
  });
}

// Render timeline
function renderTimeline() {
  const container = document.getElementById('timelineList');
  const events = store.get('timeline') || [];
  
  container.innerHTML = '';
  
  events.forEach(event => {
    const item = document.createElement('div');
    item.className = 'event';
    item.innerHTML = `
      <div class="dot"></div>
      <div class="ev-text">
        <h4>${event.title}</h4>
        <p>${event.desc}</p>
      </div>
    `;
    container.appendChild(item);
  });
}

// Initialize
document.addEventListener('DOMContentLoaded', () => {
  renderMartyrs();
  renderTimeline();
  
  // Set up admin access
  const adminDot = document.getElementById('adminDot');
  adminDot.addEventListener('click', () => {
    const pwd = prompt('أدخل كلمة إدارة الموقع:');
    if(pwd === 'Majed123x') {
      alert('تم تسجيل الدخول كمدير');
      // Show admin panel
    } else {
      alert('كلمة مرور خاطئة');
    }
  });
});