1// Crisis Management Website - Main JavaScript 2// Handles all interactive functionality across pages 3 4// Global variables 5let currentKit = {}; 6let contacts = JSON.parse(localStorage.getItem('emergencyContacts') || '[]'); 7let meetingPoints = JSON.parse(localStorage.getItem('meetingPoints') || '[]'); 8let supplies = JSON.parse(localStorage.getItem('emergencySupplies') || '[]'); 9 10// Initialize page when DOM is loaded 11document.addEventListener('DOMContentLoaded', function() { 12 initializePage(); 13 setupEventListeners(); 14 loadStoredData(); 15}); 16 17// Initialize page-specific functionality 18function initializePage() { 19 const currentPage = window.location.pathname.split('/').pop() || 'index.html'; 20 21 switch(currentPage) { 22 case 'index.html': 23 case '': 24 initializeHomePage(); 25 break; 26 case 'survival-kit.html': 27 initializeSurvivalKitPage(); 28 break; 29 case 'instructions.html': 30 initializeInstructionsPage(); 31 break; 32 case 'resources.html': 33 initializeResourcesPage(); 34 break; 35 } 36} 37 38// Home page initialization 39function initializeHomePage() { 40 // Initialize typewriter effect 41 if (document.getElementById('typed-text')) { 42 new Typed('#typed-text', { 43 strings: ['ÎιαÏείÏιÏη ÎÏίÏεÏν', 'ÎÎ¹Ï ÎÏιβίÏÏηÏ', 'ÎκÏακÏη Îνάγκη'], 44 typeSpeed: 80, 45 backSpeed: 50, 46 backDelay: 2000, 47 loop: true, 48 showCursor: true, 49 cursorChar: '|' 50 }); 51 } 52 53 // Initialize charts 54 initializeRiskChart(); 55 initializePreparednessChart(); 56 57 // Setup scenario buttons 58 setupScenarioButtons(); 59} 60 61// Initialize risk distribution chart 62function initializeRiskChart() { 63 const chartElement = document.getElementById('risk-chart'); 64 if (!chartElement) return; 65 66 const chart = echarts.init(chartElement); 67 const option = { 68 tooltip: { 69 trigger: 'item', 70 formatter: '{a} <br/>{b}: {c}% ({d}%)' 71 }, 72 legend: { 73 orient: 'vertical', 74 left: 10, 75 data: ['ΠλημμÏÏεÏ', 'Î Ï ÏκαγιÎÏ', 'ΣειÏμοί', 'ÎακοκαιÏία', 'Îλλα'] 76 }, 77 series: [ 78 { 79 name: 'ÎÎ¯Î½Î´Ï Î½Î¿Î¹', 80 type: 'pie', 81 radius: ['50%', '70%'], 82 avoidLabelOverlap: false, 83 label: { 84 show: false, 85 position: 'center' 86 }, 87 emphasis: { 88 label: { 89 show: true, 90 fontSize: '18', 91 fontWeight: 'bold' 92 } 93 }, 94 labelLine: { 95 show: false 96 }, 97 data: [ 98 {value: 35, name: 'ΠλημμÏÏεÏ', itemStyle: {color: '#3b82f6'}}, 99 {value: 25, name: 'Î Ï ÏκαγιÎÏ', itemStyle: {color: '#ef4444'}}, 100 {value: 20, name: 'ΣειÏμοί', itemStyle: {color: '#10b981'}}, 101 {value: 15, name: 'ÎακοκαιÏία', itemStyle: {color: '#f59e0b'}}, 102 {value: 5, name: 'Îλλα', itemStyle: {color: '#8b5cf6'}} 103 ] 104 } 105 ] 106 }; 107 chart.setOption(option); 108} 109 110// Initialize preparedness chart 111function initializePreparednessChart() { 112 const chartElement = document.getElementById('preparedness-chart'); 113 if (!chartElement) return; 114 115 const chart = echarts.init(chartElement); 116 const option = { 117 tooltip: { 118 trigger: 'axis', 119 axisPointer: { 120 type: 'shadow' 121 } 122 }, 123 legend: { 124 data: ['ÎÏÎ¿Ï Î½ ÎιÏ', 'Îεν ÎÏÎ¿Ï Î½ ÎιÏ'] 125 }, 126 grid: { 127 left: '3%', 128 right: '4%', 129 bottom: '3%', 130 containLabel: true 131 }, 132 xAxis: { 133 type: 'value', 134 boundaryGap: [0, 0.01] 135 }, 136 yAxis: { 137 type: 'category', 138 data: ['Îθήνα', 'ÎεÏÏαλονίκη', 'ΠάÏÏα', 'ÎÏάκλειο', 'ÎάÏιÏα'] 139 }, 140 series: [ 141 { 142 name: 'ÎÏÎ¿Ï Î½ ÎιÏ', 143 type: 'bar', 144 data: [23, 18, 15, 12, 10], 145 itemStyle: {color: '#10b981'} 146 }, 147 { 148 name: 'Îεν ÎÏÎ¿Ï Î½ ÎιÏ', 149 type: 'bar', 150 data: [77, 82, 85, 88, 90], 151 itemStyle: {color: '#ef4444'} 152 } 153 ] 154 }; 155 chart.setOption(option); 156} 157 158// Setup scenario buttons 159function setupScenarioButtons() {
160 const scenarioButtons = document.querySelectorAll('.scenario-btn'); 161 scenarioButtons.forEach(button => { 162 button.addEventListener('click', function() { 163 const scenario = this.dataset.scenario; 164 showScenarioInfo(scenario); 165 }); 166 }); 167} 168 169// Show scenario information 170function showScenarioInfo(scenario) { 171 const scenarioInfo = { 172 flood: { 173 title: 'ΠλημμÏÏα', 174 content: 'Σε ÏεÏίÏÏÏÏη ÏλημμÏÏαÏ: 1. ÎÏομακÏÏ Î½Î¸ÎµÎ¯Ïε αÏÏ Ïαμηλά Ïημεία, 2. Îην διαÏÏίζεÏε ÏÎ»Î·Î¼Î¼Ï ÏιÏμÎÎ½Î¿Ï Ï Î´ÏÏÎ¼Î¿Ï Ï, 3. ÎÎºÎ¿Î»Î¿Ï Î¸Î®ÏÏε διαδÏομÎÏ ÎµÎºÎºÎνÏÏηÏ' 175 }, 176 fire: { 177 title: 'Î Ï Ïκαγιά', 178 content: 'Σε ÏεÏίÏÏÏÏη ÏÏ ÏκαγιάÏ: 1. ÎαλÎÏÏε αμÎÏÏÏ 199, 2. ÎκκενÏÏÏε Ïο κÏίÏιο, 3. ÎείνεÏε Ïαμηλά ÏÏον καÏνÏ, 4. Îην ÏÏηÏιμοÏοιείÏε Î±Î½ÎµÎ»ÎºÏ ÏÏήÏα' 179 }, 180 power: { 181 title: 'ÎιακοÏή ΡεÏμαÏοÏ', 182 content: 'Σε διακοÏή ÏεÏμαÏοÏ: 1. ΧÏηÏιμοÏοιήÏÏε ÏακοÏÏ, 2. ÎÏενεÏγοÏοιήÏÏε ηλεκÏÏικÎÏ ÏÏ ÏÎºÎµÏ ÎÏ, 3. ÎÏαÏήÏÏε ÏÏ Î³ÎµÎ¯Î±/καÏαÏÏκÏÎµÏ ÎºÎ»ÎµÎ¹ÏÏά, 4. ÎÏεÏε μÏαÏαÏÎ¯ÎµÏ Î´Î¹Î±Î¸ÎÏιμεÏ' 183 }, 184 home: { 185 title: 'ÎÏÏάλεια ÎαÏοικίαÏ', 186 content: 'Îια αÏÏάλεια ÏÏο ÏÏίÏι: 1. ÎÏεÏε ÎºÎ¹Ï ÎµÏιβίÏÏÎ·Ï Î´Î¹Î±Î¸ÎÏιμο, 2. ÎνÏÏίζεÏε Ïη θÎÏη διακοÏÏÏν, 3. ÎÏεÏε ÏÏÎδιο εκκÎνÏÏηÏ, 4. ÎλÎγÏεÏε ÏÏ Î½Î±Î³ÎµÏμοÏÏ' 187 }, 188 vehicle: { 189 title: 'ÎÎ¹Ï ÎÏ ÏοκινήÏÎ¿Ï ', 190 content: 'Îια αÏÏαλή μεÏακίνηÏη: 1. ÎÏεÏε ÎºÎ¹Ï Î±Ï ÏοκινήÏÎ¿Ï , 2. ÎνÏÏίζεÏε εναλλακÏικÎÏ Î´Î¹Î±Î´ÏομÎÏ, 3. ÎÏεÏε ÏάÏÏÎµÏ offline, 4. Î¦Î¿Ï Î»Î¬ÏεÏε Ïο νÏεÏÏζιÏο' 191 }, 192 medical: { 193 title: 'Î ÏÏÏÎµÏ ÎοήθειεÏ', 194 content: 'Îια ιαÏÏικά ÏεÏιÏÏαÏικά: 1. ÎαλÎÏÏε 166, 2. ΠαÏÎÏεÏε βαÏικÎÏ ÏÏÏÏÎµÏ Î²Î¿Î®Î¸ÎµÎ¹ÎµÏ, 3. Îην μεÏακινείÏε ÏοβαÏά ÏÏÎ±Ï Î¼Î±ÏίεÏ, 4. ÎÏεÏε ÏάÏμακα διαθÎÏιμα' 195 } 196 }; 197 198 const info = scenarioInfo[scenario]; 199 if (info) { 200 alert(`${info.title}\n\n${info.content}`); 201 } 202} 203 204// Survival Kit page initialization 205function initializeSurvivalKitPage() { 206 setupKitForm(); 207 setupCategoryButtons(); 208 setupModalHandlers(); 209 updateProgress(); 210} 211 212// Setup kit form 213function setupKitForm() { 214 const form = document.getElementById('kit-form'); 215 if (!form) return; 216 217 form.addEventListener('submit', function(e) { 218 e.preventDefault(); 219 generateKit(); 220 }); 221} 222 223// Generate personalized kit 224function generateKit() { 225 const familySize = parseInt(document.getElementById('family-size').value); 226 const homeType = document.getElementById('home-type').value; 227 const pets = document.getElementById('pets').value; 228 const specialNeeds = document.getElementById('special-needs').value; 229 230 currentKit = { 231 familySize, 232 homeType, 233 pets, 234 specialNeeds, 235 categories: generateKitCategories(familySize, pets, specialNeeds) 236 }; 237 238 // Show progress section and categories 239 document.getElementById('progress-section').style.display = 'block'; 240 document.getElementById('kit-categories').style.display = 'block'; 241 242 // Scroll to categories 243 document.getElementById('kit-categories').scrollIntoView({ behavior: 'smooth' }); 244 245 updateProgress(); 246} 247 248// Generate kit categories based on user input 249function generateKitCategories(familySize, pets, specialNeeds) { 250 const baseCategories = { 251 basic: [ 252 { item: 'ÎεÏÏ (1 γαλÏνι ανά άÏομο/ημÎÏα)', quantity: familySize * 3, essential: true }, 253 { item: 'Îη μαγειÏÎµÏ Ïά ÏÏÏÏιμα (3 μÎÏεÏ)', quantity: familySize * 3, essential: true },
254 { item: 'ΧειÏοκίνηÏο ανοιÏÏήÏι κονÏεÏβÏν', quantity: 1, essential: true }, 255 { item: 'ΦακÏÏ Î¼Îµ εÏιÏλÎον μÏαÏαÏίεÏ', quantity: 2, essential: true }, 256 { item: 'ΡαδιÏÏÏνο με μÏαÏαÏίεÏ', quantity: 1, essential: true }, 257 { item: 'ΣÏÏ ÏίÏÏÏα', quantity: 1, essential: true }, 258 { item: 'ÎάÏÎºÎµÏ ÏκÏνηÏ', quantity: familySize * 2, essential: false }, 259 { item: 'ΠλαÏÏική μεμβÏάνη και Î±Ï ÏοκÏλληÏη Ïαινία', quantity: 1, essential: false } 260 ], 261 medical: [ 262 { item: 'ÎÎ¹Ï ÏÏÏÏÏν βοηθειÏν', quantity: 1, essential: true }, 263 { item: 'ÎνÏιÏηÏÏικÏ', quantity: 2, essential: true }, 264 { item: 'Î Î±Ï ÏίÏονα (ÏαÏακεÏαμÏλη/Î¹Î²Î¿Ï ÏÏοÏαίνη)', quantity: 2, essential: true }, 265 { item: 'ÎÏίδεÏμοι και γάζεÏ', quantity: 3, essential: true }, 266 { item: 'ÎνÏιβιοÏική αλοιÏή', quantity: 1, essential: true }, 267 { item: 'Ψαλίδι', quantity: 1, essential: true }, 268 { item: 'ΠενÏÎÏα', quantity: 1, essential: true }, 269 { item: 'ÎεÏμÏμεÏÏο', quantity: 1, essential: false }, 270 { item: 'ÎνÏιδιαÏÏοÏκά ÏάÏμακα', quantity: 1, essential: false }, 271 { item: 'ÎνÏιιÏÏαμινικά', quantity: 1, essential: false }, 272 { item: 'ÎάνÏια Î¼Î¹Î±Ï ÏÏήÏηÏ', quantity: 10, essential: false }, 273 { item: 'ÎάÏÎºÎµÏ ÏÏοÏÏÏÎ¿Ï ', quantity: 5, essential: false } 274 ], 275 tools: [ 276 { item: 'Î Î¿Î»Ï ÎµÏγαλείο', quantity: 1, essential: true }, 277 { item: 'Îλειδί για διακοÏÎÏ (νεÏÏ, αÎÏιο)', quantity: 1, essential: true }, 278 { item: 'ΦακÏÏ ÎºÎµÏαλήÏ', quantity: 1, essential: true }, 279 { item: 'ÎÏαÏαÏÎ¯ÎµÏ ÎµÏεδÏικÎÏ', quantity: 8, essential: true }, 280 { item: 'ÎδιάβÏοÏοι ÏÏίÏÏοι', quantity: 2, essential: false }, 281 { item: 'ÎÎ¿Ï Î²ÎÏÏα εÏιβίÏÏηÏ', quantity: familySize, essential: true }, 282 { item: 'ΣÏοινί (15 μÎÏÏα)', quantity: 1, essential: false }, 283 { item: 'ΣακοÏÎ»ÎµÏ Î±ÏοÏÏιμμάÏÏν', quantity: 10, essential: false }, 284 { item: 'ΧαÏÏί και μολÏβι', quantity: 2, essential: false }, 285 { item: 'ΧάÏÏÎµÏ ÏεÏιοÏήÏ', quantity: 2, essential: true } 286 ], 287 personal: [ 288 { item: 'ΡοÏÏα αλλαγήÏ', quantity: familySize * 2, essential: true }, 289 { item: 'Υγιεινή ÏÏοÏÏÏική (οδονÏÏÎ²Î¿Ï ÏÏÏα, οδονÏÏκÏεμα)', quantity: familySize, essential: true }, 290 { item: 'ΣαμÏÎ¿Ï Î¬Î½ και ÏαÏοÏνι', quantity: 2, essential: true }, 291 { item: 'ΠεÏÏÎÏεÏ', quantity: familySize, essential: true }, 292 { item: 'ÎÏ Î±Î»Î¹Î¬ Î·Î»Î¯Î¿Ï ', quantity: familySize, essential: false }, 293 { item: 'ÎνÏηλιακÏ', quantity: 1, essential: false }, 294 { item: 'ÎÏιÏλÎον Î³Ï Î±Î»Î¹Î¬ οÏάÏεÏÏ/Ïακοί εÏαÏήÏ', quantity: 1, essential: false }, 295 { item: 'ÎαÏÎλο', quantity: familySize, essential: false }, 296 { item: 'ÎάνÏια εÏγαÏίαÏ', quantity: 2, essential: false }, 297 { item: 'ÎÎ±Î»Î»Ï Î½Ïικά Î³Ï Î½Î±Î¹ÎºÎµÎ¯Î±Ï Ï Î³Î¹ÎµÎ¹Î½Î®Ï', quantity: 1, essential: true } 298 ], 299 communication: [ 300 { item: 'ÎινηÏÏ ÏηλÎÏÏνο με ÏοÏÏιÏÏή', quantity: 1, essential: true }, 301 { item: 'Power bank', quantity: 2, essential: true }, 302 { item: 'ΡαδιÏÏÏνο με μÏαÏαÏίεÏ', quantity: 1, essential: true }, 303 { item: 'ÎÏαÏÎÏ ÎκÏακÏÎ·Ï Î±Î½Î¬Î³ÎºÎ·Ï (εκÏÏ ÏÏμÎνεÏ)', quantity: 1, essential: true }, 304 { item: 'ΧÏήμαÏα μεÏÏηÏά (μικÏά ÏαÏÏονομίÏμαÏα)', quantity: 1, essential: true }, 305 { item: 'ÎάÏÏÎµÏ ÏίÏÏÏÏηÏ/ÏÏεÏÏÏικÎÏ', quantity: 2, essential: true }, 306 { item: 'ÎγγÏαÏα ÏÎ±Ï ÏοÏοίηÏÎ·Ï (ανÏίγÏαÏα)', quantity: 1, essential: true }, 307 { item: 'ÎίÏÏα ÏαÏμάκÏν και δοÏολογιÏν', quantity: 1, essential: true } 308 ] 309 }; 310 311 // Add special needs items 312 if (specialNeeds !== 'none') { 313 baseCategories.special = []; 314 315 if (specialNeeds === 'medical') { 316 baseCategories.special.push( 317 { item: 'ÎÏιÏλÎον ÏάÏμακα (7 μÎÏεÏ)', quantity: 1, essential: true }, 318 { item: 'Î£Ï ÏÎºÎµÏ ÎÏ Î¹Î±ÏÏÎ¹ÎºÎ®Ï ÏαÏακολοÏθηÏηÏ', quantity: 1, essential: true }, 319 { item: 'ÎαÏÏικÎÏ Î¿Î´Î·Î³Î¯ÎµÏ (εκÏÏ ÏÏμÎνεÏ)', quantity: 1, essential: true } 320 ); 321 } 322 323 if (specialNeeds === 'elderly') { 324 baseCategories.special.push( 325 { item: 'ÎοηθηÏικά ÏκεÏη κινηÏικÏÏηÏαÏ', quantity: 1, essential: true }, 326 { item: 'ΦάÏμακα ηλικιÏμÎνÏν', quantity: 1, essential: true }, 327 { item: 'Îιδικά ÏÏÏÏιμα διαÏÏοÏήÏ', quantity: 1, essential: false } 328 ); 329 } 330 331 if (specialNeeds === 'infant') { 332 baseCategories.special.push( 333 { item: 'Îάλα ÏκÏνη βÏÎÏÎ¿Ï Ï', quantity: 3, essential: true }, 334 { item: 'Î Î¬Î½ÎµÏ Î²ÏÎÏÎ¿Ï Ï', quantity: 20, essential: true }, 335 { item: 'ÎÏεÏικά ÏÏÏÏιμα', quantity: 10, essential: true }, 336 { item: 'ΠαιÏνίδια ηÏεμίαÏ', quantity: 3, essential: false } 337 ); 338 } 339 } 340 341 // Add pet supplies 342 if (pets !== 'none') { 343 if (!baseCategories.special) baseCategories.special = []; 344 345 baseCategories.special.push( 346 { item: 'ΤÏÏÏιμα καÏοικιδίÏν (3 μÎÏεÏ)', quantity: 1, essential: true }, 347 { item: 'ÎεÏÏ Î³Î¹Î± καÏοικίδια', quantity: 3, essential: true }, 348 { item: 'ÎÎ¿Ï Ïί και ÏÎ±Ï ÏÏÏηÏα καÏÎ¿Î¹ÎºÎ¹Î´Î¯Î¿Ï ', quantity: 1, essential: true }, 349 { item: 'ΦάÏμακα καÏοικιδίÏν', quantity: 1, essential: false } 350 ); 351 } 352 353 return baseCategories; 354} 355 356// Setup category buttons 357function setupCategoryButtons() { 358 const categoryButtons = document.querySelectorAll('.category-btn'); 359 categoryButtons.forEach(button => { 360 button.addEventListener('click', function() { 361 const category = this.dataset.category; 362 showCategoryChecklist(category); 363 }); 364 }); 365} 366 367// Show category checklist modal 368function showCategoryChecklist(category) { 369 const modal = document.getElementById('checklist-modal'); 370 const title = document.getElementById('modal-title'); 371 const content = document.getElementById('checklist-content'); 372 373 const categoryNames = { 374 basic: 'ÎαÏικά ÎÏαÏαίÏηÏα', 375 medical: 'Î ÏÏÏÎµÏ ÎοήθειεÏ', 376 tools: 'ÎÏγαλεία & ÎξοÏλιÏμÏÏ', 377 personal: 'Î ÏοÏÏÏικά ÎνÏικείμενα', 378 special: 'ÎιδικÎÏ ÎνάγκεÏ', 379 communication: 'ÎÏικοινÏνία' 380 }; 381 382 title.textContent = categoryNames[category] || 'ÎίÏÏα ÎλÎγÏÎ¿Ï '; 383 384 if (currentKit.categories && currentKit.categories[category]) { 385 const items = currentKit.categories[category]; 386 let html = `<div class="space-y-3">`; 387
388 items.forEach((item, index) => { 389 const itemId = `${category}-${index}`; 390 const checked = localStorage.getItem(itemId) === 'true'; 391 html += ` 392 <div class="checklist-item ${checked ? 'completed' : ''} flex items-center p-3 bg-gray-50 rounded-lg"> 393 <input type="checkbox" id="${itemId}" class="mr-3 w-5 h-5 text-blue-600" ${checked ? 'checked' : ''} onchange="toggleChecklistItem('${itemId}')"> 394 <div class="flex-1"> 395 <span class="item-text font-medium ${checked ? 'line-through text-gray-500' : 'text-gray-900'}">${item.item}</span> 396 <span class="text-sm text-gray-600 ml-2">(ΠοÏÏÏηÏα: ${item.quantity})</span> 397 ${item.essential ? '<span class="ml-2 px-2 py-1 bg-red-100 text-red-800 text-xs rounded">ÎÏαÏαίÏηÏο</span>' : ''} 398 </div> 399 </div> 400 `; 401 }); 402 403 html += `</div>`; 404 content.innerHTML = html; 405 } else { 406 content.innerHTML = '<p class="text-gray-600">Îεν Ï ÏάÏÏÎ¿Ï Î½ ÏÏοιÏεία για Î±Ï Ïή Ïην καÏηγοÏία.</p>'; 407 } 408 409 modal.classList.remove('hidden'); 410} 411 412// Toggle checklist item 413function toggleChecklistItem(itemId) { 414 const checkbox = document.getElementById(itemId); 415 const item = checkbox.closest('.checklist-item'); 416 const text = item.querySelector('.item-text'); 417 418 if (checkbox.checked) { 419 localStorage.setItem(itemId, 'true'); 420 item.classList.add('completed'); 421 text.classList.add('line-through', 'text-gray-500'); 422 } else { 423 localStorage.removeItem(itemId); 424 item.classList.remove('completed'); 425 text.classList.remove('line-through', 'text-gray-500'); 426 } 427 428 updateProgress(); 429} 430 431// Update progress 432function updateProgress() { 433 if (!currentKit.categories) return; 434 435 let totalItems = 0; 436 let completedItems = 0; 437 438 Object.keys(currentKit.categories).forEach(category => { 439 const items = currentKit.categories[category]; 440 totalItems += items.length; 441 442 items.forEach((item, index) => { 443 const itemId = `${category}-${index}`; 444 if (localStorage.getItem(itemId) === 'true') { 445 completedItems++; 446 } 447 }); 448 449 // Update category progress 450 const categoryProgress = document.querySelector(`[data-category="${category}"] .category-progress`); 451 const categoryProgressBar = document.querySelector(`[data-category="${category}"] .category-progress-bar`); 452 453 if (categoryProgress && categoryProgressBar) { 454 const categoryCompleted = items.filter((_, index) => 455 localStorage.getItem(`${category}-${index}`) === 'true' 456 ).length; 457 458 categoryProgress.textContent = `${categoryCompleted}/${items.length}`; 459 categoryProgressBar.style.width = `${(categoryCompleted / items.length) * 100}%`; 460 } 461 }); 462 463 const percentage = Math.round((completedItems / totalItems) * 100); 464 465 const progressBar = document.getElementById('progress-bar'); 466 const progressPercentage = document.getElementById('progress-percentage'); 467 468 if (progressBar && progressPercentage) { 469 progressBar.style.width = `${percentage}%`; 470 progressPercentage.textContent = `${percentage}%`; 471 } 472} 473 474// Setup modal handlers 475function setupModalHandlers() { 476 const modal = document.getElementById('checklist-modal'); 477 const closeBtn = document.getElementById('close-modal'); 478 const exportBtn = document.getElementById('export-checklist'); 479 const printBtn = document.getElementById('print-checklist'); 480 481 if (closeBtn) { 482 closeBtn.addEventListener('click', () => { 483 modal.classList.add('hidden'); 484 }); 485 } 486 487 if (exportBtn) { 488 exportBtn.addEventListener('click', exportChecklist); 489 } 490 491 if (printBtn) { 492 printBtn.addEventListener('click', printChecklist); 493 } 494 495 // Close modal when clicking outside 496 modal?.addEventListener('click', function(e) { 497 if (e.target === modal) { 498 modal.classList.add('hidden'); 499 } 500 }); 501} 502 503// Export checklist 504function exportChecklist() { 505 if (!currentKit.categories) return; 506
507 let content = 'ÎÎΤ ÎÎ ÎÎÎΩΣÎΣ - ÎÎΣΤΠÎÎÎÎΧÎÎ¥\n'; 508 content += '=' * 50 + '\n\n'; 509 510 Object.keys(currentKit.categories).forEach(category => { 511 const categoryNames = { 512 basic: 'ÎÎΣÎÎÎ ÎÎ ÎΡÎÎΤÎΤÎ', 513 medical: 'ΠΡΩΤÎΣ ÎÎÎÎÎÎÎΣ', 514 tools: 'ÎΡÎÎÎÎÎÎ & ÎÎÎÎ ÎÎΣÎÎΣ', 515 personal: 'ΠΡÎΣΩΠÎÎÎ ÎÎΤÎÎÎÎÎÎÎÎ', 516 special: 'ÎÎÎÎÎÎΣ ÎÎÎÎÎÎΣ', 517 communication: 'ÎÎ ÎÎÎÎÎΩÎÎÎ' 518 }; 519 520 content += `${categoryNames[category]}\n`; 521 content += '-' * 30 + '\n'; 522 523 const items = currentKit.categories[category]; 524 items.forEach((item, index) => { 525 const itemId = `${category}-${index}`; 526 const checked = localStorage.getItem(itemId) === 'true'; 527 const status = checked ? 'â' : 'â'; 528 content += `${status} ${item.item} (x${item.quantity})${item.essential ? ' [ÎÎ ÎΡÎÎΤÎΤÎ]' : ''}\n`; 529 }); 530 content += '\n'; 531 }); 532 533 const blob = new Blob([content], { type: 'text/plain' }); 534 const url = URL.createObjectURL(blob); 535 const a = document.createElement('a'); 536 a.href = url; 537 a.download = 'kit-epiviosis.txt'; 538 a.click(); 539 URL.revokeObjectURL(url); 540} 541 542// Print checklist 543function printChecklist() { 544 window.print(); 545} 546 547// Instructions page initialization 548function initializeInstructionsPage() { 549 setupDisasterTypeButtons(); 550 setupPrintCardButtons(); 551} 552 553// Setup disaster type buttons 554function setupDisasterTypeButtons() { 555 const buttons = document.querySelectorAll('.disaster-type-btn'); 556 buttons.forEach(button => { 557 button.addEventListener('click', function() { 558 const type = this.dataset.type; 559 showInstructions(type); 560 561 // Update active state 562 buttons.forEach(btn => btn.classList.remove('border-blue-500')); 563 this.classList.add('border-blue-500'); 564 }); 565 }); 566} 567 568// Show instructions for disaster type 569function showInstructions(type) { 570 const container = document.getElementById('instructions-container'); 571 const instructions = getInstructionsForType(type); 572 573 let html = ` 574 <div class="mb-6"> 575 <h2 class="text-3xl font-bold text-gray-900 mb-4">${instructions.title}</h2> 576 <p class="text-lg text-gray-600 mb-8">${instructions.description}</p> 577 </div> 578 `; 579 580 html += '<div class="space-y-6">'; 581 instructions.steps.forEach((step, index) => { 582 html += ` 583 <div class="instruction-step flex items-start p-4 bg-gray-50 rounded-lg"> 584 <div class="step-number mr-4 flex-shrink-0">${index + 1}</div> 585 <div> 586 <h3 class="text-lg font-semibold text-gray-900 mb-2">${step.title}</h3> 587 <p class="text-gray-700">${step.description}</p> 588 ${step.tips ? `<div class="mt-3 p-3 bg-blue-50 border-l-4 border-blue-400 rounded"><p class="text-sm text-blue-800"><strong>Î£Ï Î¼Î²Î¿Ï Î»Î®:</strong> ${step.tips}</p></div>` : ''} 589 </div> 590 </div> 591 `; 592 }); 593 html += '</div>'; 594 595 html += ` 596 <div class="mt-8 p-6 bg-red-50 border border-red-200 rounded-lg"> 597 <h3 class="text-lg font-semibold text-red-800 mb-3">ð¨ ΣημανÏικÎÏ ÎÏαÏÎÏ</h3> 598 <div class="grid grid-cols-1 md:grid-cols-2 gap-4"> 599 <div class="flex justify-between"> 600 <span>Îενική ÎκÏακÏη Îνάγκη:</span> 601 <span class="font-bold text-red-600">112</span> 602 </div> 603 <div class="flex justify-between"> 604 <span>Î Ï ÏοÏβεÏÏική:</span> 605 <span class="font-bold text-red-600">199</span> 606 </div> 607 <div class="flex justify-between"> 608 <span>ÎÏÏÏ Î½Î¿Î¼Î¯Î±:</span> 609 <span class="font-bold text-red-600">100</span> 610 </div> 611 <div class="flex justify-between">
612 <span>ÎÎÎÎ:</span> 613 <span class="font-bold text-red-600">166</span> 614 </div> 615 </div> 616 </div> 617 `; 618 619 container.innerHTML = html; 620} 621 622// Get instructions for disaster type 623function getInstructionsForType(type) { 624 const instructions = { 625 flood: { 626 title: 'ÎÎ´Î·Î³Î¯ÎµÏ Î³Î¹Î± ΠλημμÏÏα', 627 description: 'ÎÎºÎ¿Î»Î¿Ï Î¸Î®ÏÏε Î±Ï ÏÎÏ ÏÎ¹Ï Î¿Î´Î·Î³Î¯ÎµÏ Î³Î¹Î± αÏÏαλή ανÏιμεÏÏÏιÏη ÏÎ»Î·Î¼Î¼Ï ÏικÏν ÏαινομÎνÏν', 628 steps: [ 629 { 630 title: 'ÎκοÏÏÏε ÏÎ¹Ï ÏÏοειδοÏοιήÏειÏ', 631 description: 'ΠαÏÎ±ÎºÎ¿Î»Î¿Ï Î¸ÎµÎ¯ÏÏε Ïα μÎÏα ενημÎÏÏÏÎ·Ï ÎºÎ±Î¹ ÏÎ¹Ï ÎµÏίÏÎ·Î¼ÎµÏ Î±Î½Î±ÎºÎ¿Î¹Î½ÏÏÎµÎ¹Ï Î³Î¹Î± ενÏολÎÏ ÎµÎºÎºÎνÏÏηÏ.', 632 tips: 'ÎαÏεβάÏÏε εÏαÏμογÎÏ ÎκÏακÏÎ·Ï Î±Î½Î¬Î³ÎºÎ·Ï Î³Î¹Î± ÎγκαιÏη ειδοÏοίηÏη' 633 }, 634 { 635 title: 'ÎÏομακÏÏ Î½Î¸ÎµÎ¯Ïε αÏÏ ÎµÏÎ¹ÎºÎ¯Î½Î´Ï Î½ÎµÏ ÏεÏιοÏÎÏ', 636 description: 'ÎγκαÏαλείÏÏε αμÎÏÏÏ Ï ÏÏγεια, Î·Î¼Î¹Ï ÏÏγεια και ιÏÏγεια ÏÏÏÎ¿Ï Ï. ÎνεβείÏε Ïε ÏηλÏÏεÏα Ïημεία.', 637 tips: 'Îην ÏεÏιμÎνεÏε να δείÏε Ïο νεÏÏ - η ÏλημμÏÏα μÏοÏεί να ÎÏθει γÏήγοÏα' 638 }, 639 { 640 title: 'ÎÏοÏÏγεÏε διαÏÏÎ±Ï ÏÏÏÎµÎ¹Ï Î¼Îµ νεÏÏ', 641 description: 'Îην ÏÏοÏÏαθήÏεÏε να διαÏÏίÏεÏε ÏÎ»Î·Î¼Î¼Ï ÏιÏμÎÎ½Î¿Ï Ï Î´ÏÏÎ¼Î¿Ï Ï Î® ÏείμαÏÏÎ¿Ï Ï. Το νεÏÏ Î¼ÏοÏεί να είναι βαθÏÏεÏο και Ïιο γÏήγοÏο αÏÏ ÏÏι ÏαίνεÏαι.', 642 tips: '15 εκαÏοÏÏά κινοÏÎ¼ÎµÎ½Î¿Ï Î½ÎµÏÎ¿Ï Î¼ÏοÏοÏν να ÏÎ¯Î¾Î¿Ï Î½ Îναν ενήλικα' 643 }, 644 { 645 title: 'ÎÏενεÏγοÏοιήÏÏε Ïο ηλεκÏÏÎ¹ÎºÏ ÏεÏμα', 646 description: 'Îν ÎÏει νεÏÏ Î¼ÎÏα ÏÏο ÏÏίÏι, κλείÏÏε Ïον κενÏÏÎ¹ÎºÏ Î´Î¹Î±ÎºÏÏÏη. Îην αγγίζεÏε ηλεκÏÏικÎÏ ÏÏ ÏÎºÎµÏ ÎÏ Î¼Îµ βÏεγμÎνα ÏÎÏια.', 647 tips: 'Το ηλεκÏÏÎ¹ÎºÏ ÏεÏμα και Ïο νεÏÏ Î´ÎµÎ½ ÏÏ Î½Î´Ï Î¬Î¶Î¿Î½Ïαι' 648 }, 649 { 650 title: 'Îην ÏίνεÏε Î¼Î¿Î»Ï ÏμÎνο νεÏÏ', 651 description: 'ΧÏηÏιμοÏοιείÏε μÏνο εμÏιαλÏμÎνο ή βÏαÏμÎνο νεÏÏ. ÎÏοÏÏγεÏε ÏηγÎÏ ÏÎ¿Ï Î¼ÏοÏεί να ÎÏÎ¿Ï Î½ Î¼Î¿Î»Ï Î½Î¸ÎµÎ¯.', 652 tips: 'ÎÏάÏÏε Ïο νεÏÏ Î³Î¹Î± ÏÎ¿Ï Î»Î¬ÏιÏÏον 1 λεÏÏÏ Î³Î¹Î± αÏολÏμανÏη' 653 } 654 ] 655 }, 656 fire: { 657 title: 'ÎÎ´Î·Î³Î¯ÎµÏ Î³Î¹Î± Î Ï Ïκαγιά', 658 description: 'ÎÎºÎ¿Î»Î¿Ï Î¸Î®ÏÏε Î±Ï ÏÎÏ ÏÎ¹Ï Î¿Î´Î·Î³Î¯ÎµÏ Î³Î¹Î± αÏÏαλή εκκÎνÏÏη και ανÏιμεÏÏÏιÏη ÏÏ ÏκαγιάÏ', 659 steps: [ 660 { 661 title: 'ÎαλÎÏÏε αμÎÏÏÏ Ïην Î Ï ÏοÏβεÏÏική', 662 description: 'ÎαλÎÏÏε 199 και δÏÏÏε ακÏιβή διεÏÎ¸Ï Î½Ïη. Îην Ï ÏοθÎÏεÏε ÏÏι κάÏÎ¿Î¹Î¿Ï Î¬Î»Î»Î¿Ï Ïο ÎÏει ήδη κάνει.', 663 tips: 'ÎείνεÏε ήÏεμοι και μιλήÏÏε καθαÏά με Ïον ÏειÏιÏÏή' 664 }, 665 { 666 title: 'ÎκκενÏÏÏε αμÎÏÏÏ Ïο κÏίÏιο', 667 description: 'ÎγείÏε ÎÎ¾Ï Î³ÏήγοÏα και με αÏÏάλεια. Îην ÏÏαμαÏήÏεÏε για ÏÏοÏÏÏικά ανÏικείμενα.', 668 tips: 'Τα Ï Î»Î¹ÎºÎ¬ ανÏικείμενα μÏοÏοÏν να ανÏικαÏαÏÏαθοÏν - η ζÏή ÏÎ±Ï ÏÏι' 669 }, 670 { 671 title: 'ÎείνεÏε Ïαμηλά ÏÏον καÏνÏ', 672 description: 'ΣÎÏνεÏÏε κάÏÏ Î±ÏÏ Ïον καÏÎ½Ï ÏÏÎ¿Ï Î¿ αÎÏÎ±Ï ÎµÎ¯Î½Î±Î¹ καθαÏÏÏεÏοÏ. ÎαλÏÏÏε Ïη μÏÏη και Ïο ÏÏÏμα με Ï Î³ÏÏ Ïανί.', 673 tips: 'ΠκαÏνÏÏ ÎµÎ¯Î½Î±Î¹ ο κÏÏÎ¹Î¿Ï Î»ÏÎ³Î¿Ï Î¸Î±Î½Î¬ÏÏν Ïε ÏÏ ÏκαγιÎÏ' 674 }, 675 { 676 title: 'Îην ÏÏηÏιμοÏοιείÏε Î±Î½ÎµÎ»ÎºÏ ÏÏήÏα', 677 description: 'ΧÏηÏιμοÏοιείÏε ÏάνÏα ÏÎ¹Ï ÏκάλεÏ. Îι Î±Î½ÎµÎ»ÎºÏ ÏÏήÏÎµÏ Î¼ÏοÏεί να ÏÏαμαÏήÏÎ¿Ï Î½ να λειÏÎ¿Ï ÏγοÏν ή να Î±Î½Î¿Î¯Î¾Î¿Ï Î½ Ïε ÏλεγÏμενο ÏÏοÏο.', 678 tips: 'Îι ÏÎºÎ¬Î»ÎµÏ ÎµÎ¯Î½Î±Î¹ ο Ïιο αÏÏÎ±Î»Î®Ï ÏÏÏÏÎ¿Ï Î´Î¹Î±Ï
678Ï Î³Î®Ï' 679 }, 680 { 681 title: 'Î£Ï Î½Î±Î½ÏηθείÏε ÏÏο ÏÏοκαθοÏιÏμÎνο Ïημείο', 682 description: 'ÎÏÎ»Î¹Ï Î²Î³ÎµÎ¯Ïε ÎξÏ, ÏηγαίνεÏε ÏÏο ÏÏοκαθοÏιÏμÎνο Ïημείο ÏÏ Î½Î¬Î½ÏηÏηÏ. Îην εÏιÏÏÏÎÏεÏε μÎÏα για κανÎνα λÏγο.', 683 tips: 'ÎάνÏε καÏαμÎÏÏηÏη για να βεβαιÏθείÏε ÏÏι Ïλοι είναι αÏÏαλείÏ' 684 } 685 ] 686 }, 687 earthquake: { 688 title: 'ÎÎ´Î·Î³Î¯ÎµÏ Î³Î¹Î± ΣειÏμÏ', 689 description: 'ÎÎºÎ¿Î»Î¿Ï Î¸Î®ÏÏε Î±Ï ÏÎÏ ÏÎ¹Ï Î¿Î´Î·Î³Î¯ÎµÏ Î³Î¹Î± ÏÏοÏÏαÏία καÏά Ïη διάÏκεια ÏειÏμοÏ', 690 steps: [ 691 { 692 title: 'Î ÎÏÏε, ÎºÎ±Î»Ï ÏθείÏε, κÏαÏηθείÏε', 693 description: 'Î ÎÏÏε κάÏÏ ÏÏα γÏναÏα, ÎºÎ±Î»Ï ÏθείÏε κάÏÏ Î±ÏÏ Îνα γεÏÏ ÏÏαÏÎζι ή γÏαÏείο, και κÏαÏηθείÏε μÎÏÏι να ÏÏαμαÏήÏει ο ÏειÏμÏÏ.', 694 tips: 'ÎÏ Ïή είναι η Ïιο αÏοÏελεÏμαÏική μÎÎ¸Î¿Î´Î¿Ï ÏÏοÏÏαÏίαÏ' 695 }, 696 { 697 title: 'ÎείνεÏε μακÏιά αÏÏ ÏαÏÎ¬Î¸Ï Ïα', 698 description: 'Τα ÏαÏÎ¬Î¸Ï Ïα μÏοÏεί να ÏÏάÏÎ¿Ï Î½ και να ÏÏοκαλÎÏÎ¿Ï Î½ ÏοβαÏοÏÏ ÏÏÎ±Ï Î¼Î±ÏιÏμοÏÏ. ÎÏομακÏÏ Î½Î¸ÎµÎ¯Ïε αÏÏ ÎµÎ¾ÏÏεÏικοÏÏ ÏοίÏÎ¿Ï Ï.', 699 tips: 'Το Î³Ï Î±Î»Î¯ μÏοÏεί να ÏαξιδÎÏει αÏκεÏά μÎÏÏα' 700 }, 701 { 702 title: 'Îην βγείÏε ÎÎ¾Ï ÎºÎ±Ïά Ïη διάÏκεια', 703 description: 'ÎείνεÏε μÎÏα μÎÏÏι να ÏÏαμαÏήÏει ο ÏειÏμÏÏ. Το εξÏÏεÏÎ¹ÎºÏ Î¼ÏοÏεί να είναι Ïιο εÏÎ¹ÎºÎ¯Î½Î´Ï Î½Î¿ με ÏÏÏÏÎµÎ¹Ï Î±Î½ÏικειμÎνÏν.', 704 tips: 'Îι ÏεÏιÏÏÏÏεÏοι ÏÏÎ±Ï Î¼Î±ÏιÏμοί ÏÏ Î¼Î²Î±Î¯Î½Î¿Ï Î½ ÏÏαν οι άνθÏÏÏοι ÏÏοÏÏαθοÏν να Î²Î³Î¿Ï Î½ ÎξÏ' 705 }, 706 { 707 title: 'ΧÏηÏιμοÏοιείÏε ÏκάλεÏ, ÏÏι Î±Î½ÎµÎ»ÎºÏ ÏÏήÏεÏ', 708 description: 'ÎεÏά Ïο ÏειÏμÏ, ÏÏηÏιμοÏοιείÏε ÏÎºÎ¬Î»ÎµÏ Î³Î¹Î± να βγείÏε ÎξÏ. Îι Î±Î½ÎµÎ»ÎºÏ ÏÏήÏÎµÏ Î¼ÏοÏεί να μην λειÏÎ¿Ï ÏγοÏν ή να είναι εÏÎ¹ÎºÎ¯Î½Î´Ï Î½Î¿Î¹.', 709 tips: 'Îι Î±Î½ÎµÎ»ÎºÏ ÏÏήÏÎµÏ Î¼ÏοÏεί να ÏαγιδεÏÏÎ¿Ï Î½ ή να ÏÎÏÎ¿Ï Î½' 710 }, 711 { 712 title: 'ÎλÎγξÏε για ÏÏÎ±Ï Î¼Î±ÏιÏμοÏÏ ÎºÎ±Î¹ ζημιÎÏ', 713 description: 'ÎÏÎ¿Ï ÏÏαμαÏήÏει ο ÏειÏμÏÏ, ελÎγξÏε Ïον ÎµÎ±Ï ÏÏ ÏÎ±Ï ÎºÎ±Î¹ ÏÎ¿Ï Ï Î¬Î»Î»Î¿Ï Ï Î³Î¹Î± ÏÏÎ±Ï Î¼Î±ÏιÏμοÏÏ. ÎλÎγξÏε για ζημιÎÏ ÏÏο κÏίÏιο.', 714 tips: 'Îην ανάÏεÏε αναÏÏήÏÎµÏ Î® κεÏιά - μÏοÏεί να Ï ÏάÏÏÎ¿Ï Î½ διαÏÏοÎÏ Î±ÎµÏίÏν' 715 } 716 ] 717 } 718 }; 719 720 return instructions[type] || instructions.flood; 721} 722 723// Setup print card buttons 724function setupPrintCardButtons() { 725 const buttons = document.querySelectorAll('.print-card-btn'); 726 buttons.forEach(button => { 727 button.addEventListener('click', function() { 728 const card = this.dataset.card; 729 printEmergencyCard(card); 730 }); 731 }); 732} 733 734// Print emergency card 735function printEmergencyCard(cardType) { 736 const cardContent = getEmergencyCardContent(cardType); 737 const printWindow = window.open('', '_blank'); 738 printWindow.document.write(` 739 <html> 740 <head> 741 <title>ÎάÏÏα ÎκÏακÏÎ·Ï ÎνάγκηÏ</title> 742 <style> 743 body { font-family: Arial, sans-serif; margin: 20px; } 744 .card { border: 2px solid #ccc; padding: 20px; border-radius: 10px; max-width: 400px; } 745 h2 { color: #dc2626; margin-bottom: 15px; } 746 ul { list-style: none; padding: 0; } 747 li { margin: 8px 0; padding: 5px; background: #f3f4f6; border-radius: 5px; } 748 </style> 749 </head> 750 <body> 751 <div class="card"> 752 ${cardContent} 753 </div> 754 </body> 755 </html> 756 `); 757 printWindow.document.close(); 758 printWindow.print(); 759} 760 761// Get emergency card content 762function getEmergencyCardContent(cardType) { 763 const cards = { 764 fire: ` 765 <h2>ð¥ Î Ï Ïκαγιά</h2> 766 <ul> 767 <li>ð¨ ÎαλÎÏÏε αμÎÏÏÏ 199</li> 768 <li>ð ÎκκενÏÏÏε Ïο κÏίÏιο</li> 769 <li>ð· ÎείνεÏε Ïαμηλά ÏÏον καÏνÏ</li> 770 <li>ð« Îην ÏÏηÏιμοÏοιείÏε Î±Î½ÎµÎ»ÎºÏ ÏÏήÏα</li> 771 <li>ð Î£Ï Î½Î±Î½ÏηθείÏε ÏÏο Ïημείο ÏÏ Î½Î¬Î½ÏηÏηÏ</li> 772 </ul> 773 `, 774 flood: ` 775 <h2>ð ΠλημμÏÏα</h2> 776 <ul> 777 <li>â¬ï¸ ÎÏομακÏÏ Î½Î¸ÎµÎ¯Ïε αÏÏ Ïαμηλά Ïημεία</li> 778 <li>ð« Îην διαÏÏίζεÏε ÏÎ»Î·Î¼Î¼Ï ÏιÏμÎÎ½Î¿Ï Ï Î´ÏÏÎ¼Î¿Ï Ï</li> 779 <li>ð£ï¸ ÎÎºÎ¿Î»Î¿Ï Î¸Î®ÏÏε διαδÏομÎÏ ÎµÎºÎºÎνÏÏηÏ</li> 780 <li>â¡ ÎÏοÏÏγεÏε ηλεκÏÏικÎÏ ÏÏ ÏÎºÎµÏ ÎÏ</li> 781 <li>ð ΠαÏαμείνεÏε Ïε αÏÏαλÎÏ Ïημείο</li> 782 </ul> 783 `, 784 earthquake: ` 785 <h2>ð ΣειÏμÏÏ</h2> 786 <ul> 787 <li>ð Î ÎÏÏε, ÎºÎ±Î»Ï ÏθείÏε, κÏαÏηθείÏε</li> 788 <li>ðª ÎείνεÏε μακÏιά αÏÏ ÏαÏÎ¬Î¸Ï Ïα</li> 789 <li>ð Îην βγείÏε ÎÎ¾Ï ÎºÎ±Ïά Ïη διάÏκεια</li> 790 <li>ðª ΧÏηÏιμοÏοιείÏε ÏκάλεÏ, ÏÏι Î±Î½ÎµÎ»ÎºÏ ÏÏήÏα</li> 791 <li>ð ÎλÎγξÏε για ÏÏÎ±Ï Î¼Î±ÏιÏμοÏÏ</li> 792 </ul> 793 ` 794 }; 795 796 return cards[cardType] || cards.fire; 797} 798 799// Resources page initialization 800function initializeResourcesPage() { 801 setupContactForm(); 802 setupCallButtons(); 803 setupQRCodeGenerator(); 804 loadContacts(); 805 setupExportButtons(); 806} 807 808// Setup contact form 809function setupContactForm() { 810 const form = document.getElementById('contact-form'); 811 if (!form) return; 812 813 form.addEventListener('submit', function(e) { 814 e.preventDefault(); 815 addContact(); 816 }); 817} 818 819// Add contact 820function addContact() { 821 const name = document.getElementById('contact-name').value; 822 const phone = document.getElementById('contact-phone').value; 823 const relation = document.getElementById('contact-relation').value; 824 const type = document.getElementById('contact-type').value; 825 826 if (!name || !phone) { 827 alert('ΠαÏÎ±ÎºÎ±Î»Ï ÏÏ Î¼ÏληÏÏÏÏε Ïλα Ïα Ï ÏοÏÏεÏÏικά Ïεδία.'); 828 return; 829 } 830 831 const contact = { 832 id: Date.now(), 833 name, 834 phone, 835 relation, 836 type 837 }; 838 839 contacts.push(contact); 840 localStorage.setItem('emergencyContacts', JSON.stringify(contacts)); 841 842 // Clear form 843 document.getElementById('contact-form').reset(); 844 845 // Reload contacts list 846 loadContacts(); 847} 848 849// Load contacts 850function loadContacts() { 851 const container = document.getElementById('contacts-list'); 852 if (!container) return; 853 854 if (contacts.length === 0) { 855 container.innerHTML = '<p class="text-gray-500 text-center py-4">Îεν Ï ÏάÏÏÎ¿Ï Î½ αÏÎ¿Î¸Î·ÎºÎµÏ Î¼ÎÎ½ÎµÏ ÎµÏαÏÎÏ.</p>'; 856 return; 857 } 858 859 let html = '';
860 contacts.forEach(contact => { 861 html += ` 862 <div class="flex items-center justify-between p-4 bg-gray-50 rounded-lg"> 863 <div class="flex-1"> 864 <div class="flex items-center"> 865 <span class="font-medium text-gray-900">${contact.name}</span> 866 <span class="ml-2 px-2 py-1 bg-blue-100 text-blue-800 text-xs rounded">${contact.type}</span> 867 </div> 868 <div class="text-sm text-gray-600">${contact.phone} ⢠${contact.relation}</div> 869 </div> 870 <div class="flex gap-2"> 871 <button class="bg-green-600 text-white px-3 py-1 rounded text-sm hover:bg-green-700" onclick="callContact('${contact.phone}')">ð</button> 872 <button class="bg-red-600 text-white px-3 py-1 rounded text-sm hover:bg-red-700" onclick="deleteContact(${contact.id})">ðï¸</button> 873 </div> 874 </div> 875 `; 876 }); 877 878 container.innerHTML = html; 879} 880 881// Delete contact 882function deleteContact(id) { 883 if (confirm('ÎίÏÏε ÏÎ¯Î³Î¿Ï Ïοι ÏÏι θÎλεÏε να διαγÏάÏεÏε Î±Ï Ïή Ïην εÏαÏή;')) { 884 contacts = contacts.filter(contact => contact.id !== id); 885 localStorage.setItem('emergencyContacts', JSON.stringify(contacts)); 886 loadContacts(); 887 } 888} 889 890// Call contact 891function callContact(phone) { 892 window.location.href = `tel:${phone}`; 893} 894 895// Setup call buttons 896function setupCallButtons() { 897 const buttons = document.querySelectorAll('.call-btn'); 898 buttons.forEach(button => { 899 button.addEventListener('click', function() { 900 const number = this.dataset.number; 901 window.location.href = `tel:${number}`; 902 }); 903 }); 904} 905 906// Setup QR code generator 907function setupQRCodeGenerator() { 908 const generateBtn = document.getElementById('generate-qr'); 909 const modal = document.getElementById('qr-modal'); 910 const closeBtn = document.getElementById('close-qr-modal'); 911 912 if (generateBtn) { 913 generateBtn.addEventListener('click', function() { 914 generateQRCode(); 915 modal.classList.remove('hidden'); 916 }); 917 } 918 919 if (closeBtn) { 920 closeBtn.addEventListener('click', () => { 921 modal.classList.add('hidden'); 922 }); 923 } 924} 925 926// Generate QR code 927function generateQRCode() { 928 const qrContainer = document.querySelector('.qr-code'); 929 930 if (contacts.length === 0) { 931 qrContainer.innerHTML = '<div class="text-gray-500"><div class="text-2xl mb-2">â ï¸</div><p>Îεν Ï ÏάÏÏÎ¿Ï Î½ εÏαÏÎÏ Î³Î¹Î± Î´Î·Î¼Î¹Î¿Ï Ïγία QR code</p></div>'; 932 return; 933 } 934 935 // Create vCard data 936 let vcardData = 'BEGIN:VCARD\nVERSION:3.0\n';
937 contacts.forEach(contact => { 938 vcardData += `FN:${contact.name}\nTEL:${contact.phone}\nNOTE:${contact.relation}\n`; 939 }); 940 vcardData += 'END:VCARD'; 941 942 // In a real implementation, you would use a QR code library 943 // For this demo, we'll show a placeholder 944 qrContainer.innerHTML = ` 945 <div class="text-center"> 946 <div class="text-6xl mb-4">ð±</div> 947 <p class="text-sm text-gray-600">QR Code για ${contacts.length} εÏαÏÎÏ</p> 948 <p class="text-xs text-gray-500 mt-2">ΣαÏÏÏÏε για αÏÎ¿Î¸Î®ÎºÎµÏ Ïη εÏαÏÏν</p> 949 </div> 950 `; 951} 952 953// Setup export buttons 954function setupExportButtons() { 955 const exportBtn = document.getElementById('export-contacts'); 956 const printBtn = document.getElementById('print-contacts'); 957 958 if (exportBtn) { 959 exportBtn.addEventListener('click', exportContacts); 960 } 961 962 if (printBtn) { 963 printBtn.addEventListener('click', printContacts); 964 } 965} 966 967// Export contacts 968function exportContacts() { 969 if (contacts.length === 0) { 970 alert('Îεν Ï ÏάÏÏÎ¿Ï Î½ εÏαÏÎÏ Î³Î¹Î± εξαγÏγή.'); 971 return; 972 } 973 974 let content = 'ÎÎ ÎΦÎΣ ÎÎΤÎÎΤÎΣ ÎÎÎÎÎÎΣ\n'; 975 content += '=' * 30 + '\n\n'; 976
977 contacts.forEach(contact => { 978 content += `Îνομα: ${contact.name}\n`; 979 content += `ΤηλÎÏÏνο: ${contact.phone}\n`; 980 content += `ΣÏÎÏη: ${contact.relation}\n`; 981 content += `ΤÏÏοÏ: ${contact.type}\n`; 982 content += '-'.repeat(20) + '\n'; 983 }); 984 985 const blob = new Blob([content], { type: 'text/plain' }); 986 const url = URL.createObjectURL(blob); 987 const a = document.createElement('a'); 988 a.href = url; 989 a.download = 'epafes-anagkis.txt'; 990 a.click(); 991 URL.revokeObjectURL(url); 992} 993 994// Print contacts 995function printContacts() { 996 window.print(); 997} 998 999// Load stored data 1000function loadStoredData() { 1001 // Data is already loaded in global variables 1002 // This function can be used for additional data loading if needed 1003} 1004 1005// Setup global event listeners 1006function setupEventListeners() { 1007 // Handle emergency alert button clicks 1008 const emergencyButtons = document.querySelectorAll('button[class*="emergency"]'); 1009 emergencyButtons.forEach(button => { 1010 if (button.textContent.includes('112')) { 1011 button.addEventListener('click', function() { 1012 if (confirm('ÎÎλεÏε να καλÎÏεÏε Ïο 112;')) { 1013 window.location.href = 'tel:112'; 1014 } 1015 }); 1016 } 1017 }); 1018 1019 // Handle animations on scroll 1020 const observerOptions = { 1021 threshold: 0.1, 1022 rootMargin: '0px 0px -50px 0px' 1023 }; 1024 1025 const observer = new IntersectionObserver((entries) => { 1026 entries.forEach(entry => { 1027 if (entry.isIntersecting) { 1028 entry.target.style.opacity = '1'; 1029 entry.target.style.transform = 'translateY(0)'; 1030 } 1031 }); 1032 }, observerOptions); 1033 1034 // Observe elements for animation 1035 const animatedElements = document.querySelectorAll('.crisis-card, .kit-category, .resource-card, .instruction-step'); 1036 animatedElements.forEach(el => { 1037 el.style.opacity = '0'; 1038 el.style.transform = 'translateY(20px)'; 1039 el.style.transition = 'opacity 0.6s ease, transform 0.6s ease'; 1040 observer.observe(el); 1041 }); 1042} 1043 1044// Utility functions 1045function showNotification(message, type = 'info') { 1046 // Simple notification system 1047 const notification = document.createElement('div'); 1048 notification.className = `fixed top-20 right-4 z-50 p-4 rounded-lg shadow-lg ${ 1049 type === 'success' ? 'bg-green-500 text-white' : 1050 type === 'error' ? 'bg-red-500 text-white' : 1051 'bg-blue-500 text-white' 1052 }`; 1053 notification.textContent = message; 1054 1055 document.body.appendChild(notification); 1056 1057 setTimeout(() => { 1058 notification.remove(); 1059 }, 3000); 1060} 1061 1062// Export functions for global access 1063window.toggleChecklistItem = toggleChecklistItem; 1064window.deleteContact = deleteContact; 1065window.callContact = callContact;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.