Türkçe English
Menü
Giriş
Hesabına giriş yap ve devam et
veya
Hesabınız yok mu? Kayıt
bölümündeki sayfa script'lerini çalıştır ── // Marker'lar arası: data-spa-marker="start" ile "end" arasındaki script'ler var collecting = false; var pageScriptsInline = []; var pageScriptsExternal = []; doc.body.querySelectorAll('script').forEach(function (s) { if (s.dataset.spaMarker === 'start') { collecting = true; return; } if (s.dataset.spaMarker === 'end') { collecting = false; return; } if (!collecting) return; if (s.getAttribute('src')) { pageScriptsExternal.push(s.getAttribute('src')); } else if (s.textContent.trim()) { pageScriptsInline.push(s.textContent); } }); // External script'leri sırayla yükle, sonra inline script'leri çalıştır function loadExternalScript(src) { return new Promise(function (resolve, reject) { // Zaten yüklü mü kontrol et if (document.querySelector('script[src="' + src + '"]')) { resolve(); return; } var ns = document.createElement('script'); ns.src = src; ns.dataset.spaInjected = '1'; ns.onload = resolve; ns.onerror = function () { console.warn('[SPA] external script failed:', src); resolve(); }; document.body.appendChild(ns); }); } // External'ları sırayla yükle var extChain = Promise.resolve(); pageScriptsExternal.forEach(function (src) { extChain = extChain.then(function () { return loadExternalScript(src); }); }); // External'lar yüklendikten sonra inline'ları çalıştır extChain.then(function () { // DOMContentLoaded ve jQuery ready SPA'da tekrar tetiklenmez // Geçici olarak patch'le: DOMContentLoaded listener'ları hemen çalışsın var origAddEventListener = document.addEventListener.bind(document); document.addEventListener = function (type, fn, opts) { if (type === 'DOMContentLoaded') { try { fn(); } catch (e) { console.warn('[SPA] DOMContentLoaded handler error:', e); } return; } return origAddEventListener(type, fn, opts); }; pageScriptsInline.forEach(function (code) { try { // const/let redeclaration önlemek için IIFE ile scope'la var ns = document.createElement('script'); ns.textContent = '(function(){' + code + '\n})();'; ns.dataset.spaInjected = '1'; document.body.appendChild(ns); } catch (se) { console.warn('[SPA] page script error:', se); } }); // Patch'i geri al document.addEventListener = origAddEventListener; // Custom event dispatch et document.dispatchEvent(new Event('spa:loaded')); }); // page-leaving varsa temizle (main.js fade-out) document.body.classList.remove('page-leaving'); document.body.style.opacity = '1'; document.title = doc.title; currentUrl = url; updateActiveLink(url); window.scrollTo(0, 0); // pushState: popstate ile çakışmaması için navigate bitince if (window.location.href !== url) { history.pushState({ url: url }, '', url); } } catch (e) { console.error('[SPA] navigation failed, falling back:', e); if (main) main.classList.remove('spa-loading'); window.location = url; } } document.addEventListener('DOMContentLoaded', function () { // Mobile menu var mobileToggle = document.getElementById('mobileToggle'); var mobileMenu = document.getElementById('mobileMenu'); if (mobileToggle && mobileMenu) { mobileToggle.addEventListener('click', function () { this.classList.toggle('active'); mobileMenu.classList.toggle('active'); document.body.style.overflow = mobileMenu.classList.contains('active') ? 'hidden' : ''; }); mobileMenu.querySelectorAll('a').forEach(function (link) { link.addEventListener('click', function () { mobileToggle.classList.remove('active'); mobileMenu.classList.remove('active'); document.body.style.overflow = ''; }); }); } // Aktif link updateActiveLink(window.location.href); // Sidebar link tıklamalarını yakala document.addEventListener('click', function (e) { var link = e.target.closest('.sidebar-nav a, .sidebar-link'); if (!link) return; if (link.hasAttribute('onclick')) return; if (link.target === '_blank') return; var href = link.href; if (!href || href.indexOf('#') !== -1 || href.startsWith('javascript:')) return; try { if (new URL(href).origin !== window.location.origin) return; } catch (e) { return; } e.preventDefault(); spaNavigate(href); }); // Tarayıcı geri/ileri window.addEventListener('popstate', function (e) { if (e.state && e.state.url) spaNavigate(e.state.url); else window.location.reload(); }); history.replaceState({ url: window.location.href }, ''); }); })();