1(function () { 2 const hero = document.querySelector('[data-home-hero]'); 3 if (!hero) return; 4 5 const slides = Array.from(hero.querySelectorAll('[data-hero-slide]')); 6 const dots = Array.from(hero.querySelectorAll('[data-hero-dot]')); 7 const previous = hero.querySelector('[data-hero-prev]'); 8 const next = hero.querySelector('[data-hero-next]'); 9 const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; 10 let activeIndex = 0; 11 let timer = null; 12 13 const activate = function (index, moveFocus) { 14 activeIndex = (index + slides.length) % slides.length; 15 slides.forEach(function (slide, slideIndex) { 16 const active = slideIndex === activeIndex; 17 slide.classList.toggle('is-active', active); 18 slide.setAttribute('aria-hidden', active ? 'false' : 'true'); 19 const link = slide.querySelector('a'); 20 if (link) link.tabIndex = active ? 0 : -1; 21 }); 22 dots.forEach(function (dot, dotIndex) { 23 const active = dotIndex === activeIndex; 24 dot.classList.toggle('is-active', active); 25 dot.setAttribute('aria-selected', active ? 'true' : 'false'); 26 dot.tabIndex = active ? 0 : -1; 27 }); 28 if (moveFocus && dots[activeIndex]) dots[activeIndex].focus(); 29 }; 30 31 const stop = function () { 32 if (timer) window.clearInterval(timer); 33 timer = null; 34 }; 35 36 const start = function () { 37 if (reduceMotion || slides.length < 2 || timer) return; 38 timer = window.setInterval(function () { 39 activate(activeIndex + 1, false); 40 }, 7000); 41 }; 42 43 if (previous) previous.addEventListener('click', function (event) { event.preventDefault(); event.stopPropagation(); activate(activeIndex - 1, false); }); 44 if (next) next.addEventListener('click', function (event) { event.preventDefault(); event.stopPropagation(); activate(activeIndex + 1, false); }); 45 dots.forEach(function (dot) { 46 dot.addEventListener('click', function (event) { 47 event.preventDefault(); 48 event.stopPropagation(); 49 activate(Number.parseInt(dot.dataset.heroDot || '0', 10), false); 50 }); 51 }); 52 hero.addEventListener('keydown', function (event) { 53 if (event.key === 'ArrowLeft') { 54 event.preventDefault(); 55 activate(activeIndex - 1, true); 56 } 57 if (event.key === 'ArrowRight') { 58 event.preventDefault(); 59 activate(activeIndex + 1, true); 60 } 61 }); 62 hero.addEventListener('mouseenter', stop); 63 hero.addEventListener('mouseleave', start); 64 hero.addEventListener('focusin', stop); 65 hero.addEventListener('focusout', start); 66 document.addEventListener('visibilitychange', function () { 67 if (document.hidden) stop(); else start(); 68 }); 69 70 activate(0, false); 71 start(); 72})(); 73 (function () { 74 const route = document.querySelector('[data-smart-route]'); 75 if (!route) return; 76 77 const tabs = Array.from(route.querySelectorAll('[data-route-tab]')); 78 const panels = Array.from(route.querySelectorAll('[data-route-panel]')); 79 if (!tabs.length || !panels.length) return; 80 81 const activate = function (key) { 82 let matched = false;
83 tabs.forEach(function (tab) { 84 const active = tab.dataset.routeTab === key; 85 tab.classList.toggle('is-active', active); 86 tab.setAttribute('aria-selected', active ? 'true' : 'false'); 87 if (active) matched = true; 88 }); 89 panels.forEach(function (panel) { 90 panel.classList.toggle('is-active', panel.dataset.routePanel === key); 91 }); 92 if (matched) { 93 try { 94 window.localStorage.setItem('dfSmartRoute', key); 95 } catch (error) { 96 } 97 } 98 }; 99 100 tabs.forEach(function (tab) { 101 tab.addEventListener('click', function () { 102 activate(tab.dataset.routeTab || 'new'); 103 }); 104 105 }); 106 107 try { 108 const saved = window.localStorage.getItem('dfSmartRoute'); 109 if (saved) activate(saved); 110 } catch (error) { 111 } 112 })(); 113 114 // Back to Top Button 115 (function () { 116 const backToTop = document.getElementById('backToTop'); 117 if (!backToTop || !('IntersectionObserver' in window)) return; 118 119 const marker = document.createElement('span'); 120 marker.setAttribute('aria-hidden', 'true'); 121 marker.style.cssText = 'position:absolute;top:320px;width:1px;height:1px;pointer-events:none'; 122 document.body.prepend(marker); 123 124 const observer = new IntersectionObserver(function (entries) { 125 backToTop.classList.toggle('visible', !entries[0].isIntersecting); 126 }); 127 observer.observe(marker); 128 129 backToTop.addEventListener('click', function () { 130 window.scrollTo({ 131 top: 0, 132 behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth' 133 }); 134 }); 135 })(); 136 137 // Lazy loading için native `loading="lazy"` kullanılıyor; ek fallback JS kaldırıldı. 138 139document.addEventListener('DOMContentLoaded', function () { 140 if (window.innerWidth > 576) return; 141 142 const cards = document.querySelectorAll('.clean-card--featured, .clean-card--spotlight'); 143 if (!cards.length || !('IntersectionObserver' in window)) return; 144 145 const observer = new IntersectionObserver((entries) => { 146 entries.forEach((entry) => { 147 if (entry.isIntersecting) { 148 entry.target.classList.add('is-inview'); 149 } else { 150 entry.target.classList.remove('is-inview'); 151 } 152 }); 153 }, { 154 threshold: 0.55 155 }); 156 157 cards.forEach((card) => observer.observe(card)); 158}); 159 160document.addEventListener('DOMContentLoaded', function () { 161 const paginationWrap = document.querySelector('[data-pagination-wrap]'); 162 const sentinel = document.querySelector('[data-auto-load-sentinel]'); 163 if (paginationWrap) paginationWrap.classList.remove('is-hidden'); 164 if (sentinel) sentinel.remove(); 165}); 166 167/* Quick Preview Modal Logic */ 168(function () { 169 document.addEventListener('DOMContentLoaded', function () { 170 const modalEl = document.getElementById('dfQuickPreviewModal'); 171 const iframeEl = document.getElementById('dfQuickPreviewIframe'); 172 const titleEl = document.getElementById('dfQuickPreviewTitle'); 173 if (!modalEl || !iframeEl) return; 174 175 document.addEventListener('click', function (event) { 176 const btn = event.target.closest('[data-quick-preview]'); 177 if (!btn) return; 178 179 event.preventDefault(); 180 event.stopPropagation(); 181 182 const videoId = btn.dataset.quickPreview || ''; 183 const title = btn.dataset.videoTitle || 'Fragman Hızlı İzle'; 184 185 if (!videoId) return; 186 187 if (titleEl) titleEl.textContent = title; 188 iframeEl.src = 'https://www.youtube-nocookie.com/embed/' + encodeURIComponent(videoId) + '?autoplay=1&rel=0'; 189 190 if (window.bootstrap && window.bootstrap.Modal) { 191 const modalInstance = window.bootstrap.Modal.getOrCreateInstance(modalEl); 192 modalInstance.show(); 193 } 194 }); 195 196 modalEl.addEventListener('hidden.bs.modal', function () { 197 iframeEl.src = ''; 198 }); 199 }); 200})(); 201 202/* YouTube-Style Hover Video Preview (Muted Autoplay on Mouse Hover) */ 203(function () { 204 if (window.matchMedia('(hover: none)').matches) return; // Skip touch devices 205 206 let hoverTimer = null; 207 let activeWrap = null; 208 209 document.addEventListener('mouseover', function (event) {
210 const wrap = event.target.closest('[data-video-preview]'); 211 if (!wrap || wrap === activeWrap) return; 212 213 const videoId = wrap.dataset.videoPreview; 214 if (!videoId) return; 215 216 if (hoverTimer) clearTimeout(hoverTimer); 217 218 // 350ms Hover Intent Delay 219 hoverTimer = setTimeout(function () { 220 clearActivePreview(); 221 222 activeWrap = wrap; 223 let container = wrap.querySelector('.card-hover-preview-container'); 224 if (!container) { 225 container = document.createElement('div'); 226 container.className = 'card-hover-preview-container'; 227 wrap.appendChild(container); 228 } 229 230 const iframe = document.createElement('iframe'); 231 iframe.src = 'https://www.youtube-nocookie.com/embed/' + encodeURIComponent(videoId) + 232 '?autoplay=1&mute=1&controls=0&modestbranding=1&rel=0&loop=1&playsinline=1&enablejsapi=1&start=0'; 233 iframe.title = 'Video Ãnizleme'; 234 iframe.setAttribute('allow', 'autoplay; encrypted-media'); 235 iframe.setAttribute('tabindex', '-1'); 236 237 container.innerHTML = ''; 238 container.appendChild(iframe); 239 240 const badge = document.createElement('span'); 241 badge.className = 'card-preview-live-badge'; 242 badge.innerHTML = '<i class="fas fa-play"></i> CANLI ÃNİZLEME'; 243 container.appendChild(badge); 244 245 requestAnimationFrame(function () { 246 container.classList.add('is-active'); 247 }); 248 }, 350); 249 }); 250 251 document.addEventListener('mouseout', function (event) { 252 const wrap = event.target.closest('[data-video-preview]'); 253 if (!wrap) return; 254 255 const related = event.relatedTarget; 256 if (!related || !wrap.contains(related)) { 257 if (hoverTimer) { 258 clearTimeout(hoverTimer); 259 hoverTimer = null; 260 } 261 if (activeWrap === wrap) { 262 clearActivePreview(); 263 } 264 } 265 }); 266 267 function clearActivePreview() { 268 if (!activeWrap) return; 269 const container = activeWrap.querySelector('.card-hover-preview-container'); 270 if (container) { 271 container.classList.remove('is-active'); 272 setTimeout(function () { 273 container.remove(); 274 }, 200); 275 } 276 activeWrap = null; 277 } 278})(); 279 280 281
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.