1// Base Project - Global JavaScript 2// Handles sidebar, theme, language, config dropdown, and modal backdrop cleanup 3 4document.addEventListener('DOMContentLoaded', function () { 5 const body = document.body; 6 7 // Configuration dropdown functionality 8 window.toggleConfigMenu = function(event) { 9 event.preventDefault(); 10 event.stopPropagation(); 11 12 const dropdown = document.querySelector('.config-dropdown'); 13 const isOpen = dropdown.classList.contains('open'); 14 15 if (isOpen) { 16 dropdown.classList.remove('open'); 17 sessionStorage.setItem('configDropdownOpen', 'false'); 18 } else { 19 dropdown.classList.add('open'); 20 sessionStorage.setItem('configDropdownOpen', 'true'); 21 } 22 }; 23 24 // Config sayfalarında dropdown'u açık tut 25 const currentPath = window.location.pathname; 26 const isConfigPage = currentPath.includes('/config/'); 27 const wasOpened = sessionStorage.getItem('configDropdownOpen'); 28 29 if (isConfigPage && wasOpened === 'true') { 30 const dropdown = document.querySelector('.config-dropdown'); 31 if (dropdown) { 32 dropdown.classList.add('open'); 33 } 34 } 35 36 // Config dashboard functions 37 window.exportConfig = function() { 38 alert('Export functionality will be implemented'); 39 }; 40 41 window.importConfig = function() { 42 alert('Import functionality will be implemented'); 43 }; 44 45 window.resetConfig = function() { 46 if (confirm('Tüm yapılandırmayı sıfırlamak istediÄinizden emin misiniz?')) { 47 alert('Reset functionality will be implemented'); 48 } 49 }; 50 51 // Sidebar toggle functionality is handled in base.html inline script (airamail style) 52 53 // Theme toggle functionality is handled in base.html inline script (airamail style) 54}); 55 56// Dil deÄiÅtirme fonksiyonu 57function changeLanguage(lang) { 58 console.log(`[DEBUG] Changing language to: ${lang}`); 59 fetch(`/set_language/${lang}`) 60 .then(response => { 61 if (!response.ok) { 62 throw new Error(`HTTP ${response.status}`); 63 } 64 return response.json(); 65 }) 66 .then(data => { 67 if (data.success) { 68 // Sayfayı yenile 69 window.location.reload(); 70 } else { 71 console.error('Language change failed:', data.error); 72 alert('Dil deÄiÅtirme baÅarısız oldu: ' + data.error); 73 } 74 }) 75 .catch(error => { 76 console.error('[DEBUG] Error changing language:', error); 77 console.error('[DEBUG] Language change failed for:', lang); 78 alert('Dil deÄiÅtirme sırasında hata oluÅtu: ' + error.message); 79 }); 80} 81 82// Modal Backdrop Temizleme 83// Ãift backdrop temizleme fonksiyonu 84function clearModalBackdrops() { 85 const backdrops = document.querySelectorAll('.modal-backdrop'); 86 if (backdrops.length > 1) { 87 console.log('DEBUG: Multiple backdrops found, cleaning up...'); 88 backdrops.forEach(backdrop => backdrop.remove()); 89 } 90} 91 92// Her modal açılıÅında backdrop kontrolü 93document.addEventListener('show.bs.modal', function(event) { 94 clearModalBackdrops(); 95}); 96 97// Sayfa yüklendiÄinde backdrop temizliÄi 98document.addEventListener('DOMContentLoaded', function() { 99 clearModalBackdrops(); 100});
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.