PageSourceSearch

https://s.turkiyegazetesi.com.tr/s/js/script.js?v=c7038b79-3739-4d

js turkiyegazetesi.com.tr collected 2026-09-24 18:34:16 UTC 42,314 bytes, 1,252 lines download raw bytes

1;(function(){
2  'use strict';
3
4  /**
5   * 1) HTML parçalarını yükleme
6   */
7  const loadComponents = async () => {
8    const divs = Array.from(document.querySelectorAll('.componentPath'));
9    const items = await Promise.all(divs.map(async div => {
10      const url = div.dataset.targetUrl;
11      if (!url) return { div, html: '' };
12      try {
13        const res  = await fetch(url);
14        const html = await res.text();
15        return { div, html };
16      } catch (err) {
17        console.error('Component load error:', url, err);
18        return { div, html: '' };
19      }
20    }));
21    items.forEach(({ div, html }) => { div.innerHTML = html; });
22  };
23
24  /**
25   * 2) Tüm init fonksiyonları bu diziye ekleniyor
26   */
27  const initializers = [
28    headerScroll,
29    headerHamburgerNav,
30    initHomePageMatchSwipers,
31    initHomePageAuthorSwipers,
32    initHomePageVideoPlayers,
33    initHomePageAudioPlayers,
34    initOurpageListen,
35    initHomePageMarkets,
36    initSoundPlayers,
37    initPrayerTimer,
38    initModalPopups,
39    categorySlider,
40    mostReadSlider,
41    objectiveSlider,
42    topCategorySlider,
43    videoSlider,
44    bannerSlider,
45    detailShareClick,
46    initDatePicker,
47    staticPageMenu,
48    initSettingsSidebar,
49    initLoginToggle,
50    passwordToggle,
51    pricingCard,
52    footer,
53    initCustomSelect,
54    initDynamicSelectWidths,
55    initFixedSearchToggle,
56    initDetailHeadlinesSwipers,
57    initCustomHeroCardsSliders,
58    initAboneBannerRotator
59  ];
60
61  /**
62   * 3) Sayfa yüklendiğinde önce component’leri, sonra init’leri çalıştır
63   */
64  document.addEventListener('DOMContentLoaded', async () => {
65    await loadComponents();
66    initializers.forEach(fn => {
67      try { fn(); }
68      catch (err) { console.error(`Error in ${fn.name}:`, err); }
69    });
70  });
71
72  /**
73   * 4) Aşağıda tüm init fonksiyonları
74   */
75  
76
77  function initAboneBannerRotator() {
78    const rotator = document.querySelector('.abone-banner-features__rotator');
79    if (!rotator) return;
80    const slides = rotator.querySelectorAll('.abone-banner-features__slide');
81    if (slides.length < 2) return;
82
83    let currentIndex = 0;
84    setInterval(() => {
85      const prevSlide = slides[currentIndex];
86      currentIndex = (currentIndex + 1) % slides.length;
87      const nextSlide = slides[currentIndex];
88
89      prevSlide.classList.remove('active');
90      prevSlide.classList.add('exit');
91
92      nextSlide.classList.remove('exit');
93      nextSlide.classList.add('active');
94
95      setTimeout(() => {
96        prevSlide.classList.remove('exit');
97      }, 750);
98    }, 5000);
99  }
100
101  function headerScroll() {
102    const header = document.querySelector('.header');
103    if (!header) return;
104    window.addEventListener('scroll', () => {
105      const scrolled = window.scrollY > 10;
106      header.classList.toggle('scrolled', scrolled);
107      document.body.classList.toggle('scrolled-header-active', scrolled);
108    });
109  }
110
111  function pricingCard() {
112    const settingsCard = document.querySelector('.settings-card');
113    if (!settingsCard) return;
114    
115    document.querySelectorAll('.settings-card').forEach(card => {
116      const toggle = card.querySelector('.toggle input[type="checkbox"]');
117      if (!toggle) return;
118      
119      const priceEl = card.querySelector('.price .amount');
120      const periodEl = card.querySelector('.price .period');
121      const monthly = parseInt(card.querySelector('.price').dataset.monthly, 10);
122      const yearly = parseInt(card.querySelector('.price').dataset.yearly, 10);
123
124      function updatePrice() {
125        if (toggle.checked) {
126          priceEl.textContent = yearly;
127          periodEl.textContent = 'yıllık';
128        } else {
129          priceEl.textContent = monthly;
130          periodEl.textContent = 'aylık';
131        }
132      }
133
134      // Başlangıç durumu
135      updatePrice();
136      // Olayı dinle
137      toggle.addEventListener('change', updatePrice);
138    });
139
140  }
141
142  function passwordToggle() {
143    const buttons = document.querySelectorAll('.toggle-visibility');
144    if (!buttons.length) return;
145
146    buttons.forEach(btn => {
147      // .input-wrapper içindeki input'u bul
148      const input = btn.closest('.input-wrapper').querySelector('input');
149      if (!input) return;
150
151      btn.addEventListener('click', () => {
152        // Mevcut durum
153        const isVisible = input.type === 'text';
154
155        // Tipi değiştir
156        input.type = isVisible ? 'password' : 'text';
157
158        // Butona active sınıfı ekle/çıkart
159        btn.classList.toggle('active', !isVisible);
160      });
161    });
162  }
163
164  function initSettingsSidebar() {
165    const sidebar = document.querySelector('.settings-sidebar');
166    if (!sidebar) return;
167
168    const btn   = sidebar.querySelector('.sidebar-toggle');
169    const menu  = sidebar.querySelector('.menu');
170    const label = sidebar.querySelector('.current-label');
171    if (!btn || !menu || !label) return;
172
173    // Başlangıçta butondaki yazıyı ve ikonu aktif öğeye göre ayarla
174    const activeItem = menu.querySelector('.menu-item.active');
175    // Mobil hızlı menüdeki sayfalarda (Arşiv vb.) toggle "Ayarlar" göstersin
176    if (activeItem?.closest('.menu-link-desktop-only')) {
177      label.textContent = 'Ayarlar';
178      btn.classList.add('icon-info');
179    } else if (activeItem) {
180      label.textContent = activeItem.textContent.trim();
181      [...activeItem.classList]
182        .filter(cls => cls.startsWith('icon-') && cls !== 'icon')
183        .forEach(iconCls => btn.classList.add(iconCls));
184    }
185
186    // Mobilde toggle
187    btn.addEventListener('click', () => {
188      const isOpen = sidebar.classList.toggle('open');
189      btn.setAttribute('aria-expanded', isOpen);
190    });
191  }
192
193  function initLoginToggle() {
194    const nav  = document.querySelector('.headerTop-login-after');
195    if (!nav) return;
196
197    const btn  = nav.querySelector('.headerTop-login');
198    const menu = nav.querySelector('.login-menu');
199    if (!btn || !menu) return;
200
201    btn.addEventListener('click', () => {
202      const isActive = menu.classList.toggle('active');
203      btn.classList.toggle('active');
204      btn.setAttribute('aria-expanded', isActive);
205    });
206  }
207
208
209  function headerHamburgerNav() {
210    const btn  = document.querySelector('.headerTop-navbutton');
211    const menu = document.querySelector('.header-hamburger-menu');
212    const menubg = document.querySelector('.header-hamburger-bg');
213    const close  = document.querySelector('.mth-close');
214    if (!btn || !menu || !menubg) return;
215    btn.addEventListener('click', () => {
216      menu.classList.toggle('open');
217      menubg.classList.toggle('active');
218      btn.classList.toggle('active');
219      document.body.classList.toggle('no-scroll', menu.classList.contains('open'));
220    });
221    close.addEventListener('click', () => {
222      menu.classList.remove('open');
223      menubg.classList.remove('active');
224      btn.classList.remove('active');
225      document.body.classList.remove('no-scroll');
226    });
227
228    menubg.addEventListener('click', () => {
229      menu.classList.remove('open');
230      menubg.classList.remove('active');
231      btn.classList.remove('active');
232      document.body.classList.remove('no-scroll');
233    });
234  }
235
236
237  function initDetailHeadlinesSwipers() {
238    const sliderBlocks = document.querySelectorAll('.featured-headlines-slider');
239    if (!sliderBlocks.length) return;
240
241    sliderBlocks.forEach(sliderBlock => {
242      const container    = sliderBlock.querySelector('.featured-headlines-swiper');
243      const paginationEl = sliderBlock.querySelector('.swiper-pagination');
244      const nextEl       = sliderBlock.querySelector('.swiper-button-next');
245      const prevEl       = sliderBlock.querySelector('.swiper-button-prev');
246      if (!container || !paginationEl || !nextEl || !prevEl) return;
247
248      new Swiper(container, {
249        slidesPerView: 'auto',
250        spaceBetween: 15,
251        loop: false,
252
253        pagination: {
254          el: paginationEl,
255          clickable: true,
256          enabled: window.innerWidth < 768
257        },
258        navigation: {
259          nextEl: nextEl,
260          prevEl: prevEl,
261          enabled: window.innerWidth >= 768
262        },
263
264        breakpoints: {
265          768: {
266            pagination: { enabled: false },
267            navigation: { enabled: true }
268          }
269        },
270
271        on: {
272          breakpoint() {
273            // pagination
274            if (this.params.pagination.enabled) {
275              this.pagination.init();
276              this.pagination.render();
277              this.pagination.update();
278            } else {
279              this.pagination.destroy();
280            }
281            // navigation
282            if (this.params.navigation.enabled) {
283              this.navigation.init();
284              this.navigation.update();
285            } else {
286              this.navigation.destroy();
287            }
288          }
289        }
290      });
291    });
292  }
293
294  function initCustomHeroCardsSliders() {
295    const heroSliderScope = document.querySelector('.heroSliderScope');
296    if (!heroSliderScope) return;
297
298    // Thumbnail-slider (cards)
299    const thumbsSwiper = new Swiper('.cards-swiper', {
300      loop: false,
301      slidesPerView: 'auto',
302      spaceBetween: 15,
303      watchSlidesProgress: true,   // üst slider’ın pozisyonunu izlesin
304      slideToClickedSlide: true,   // tıklayınca o slide’a geçsin
305      navigation: {
306        nextEl: '.cards-section .swiper-button-next',
307        prevEl: '.cards-section .swiper-button-prev',
308      },
309      breakpoints: {
310        320:  { slidesPerView: 2.4 },
311        768:  { slidesPerView: 2.2   },
312        980: { slidesPerView: 3   },
313        1260: { slidesPerView: 4   }
314      }
315    });
316
317    // 2) Üst – hero slider
318    const heroSwiper = new Swiper('.hero-swiper', {
319      loop: true,
320      slidesPerView: 1,
321      spaceBetween: 0,
322      speed: 800,
323      autoplay: {
324        delay: 5000,
325        disableOnInteraction: false
326      },
327      thumbs: {
328        swiper: thumbsSwiper    // alt slider’a abone oluyoruz
329      }
330    });
331  }
332  function initHomePageMatchSwipers() {
333    const container = document.querySelector('.match-swiper');
334    if (!container) return;
335    new Swiper(container, {
336      slidesPerView: 1,
337      spaceBetween: 0,
338      loop: true,
339      autoplay: { delay: 3000, disableOnInteraction: false },
340      navigation: {
341        nextEl: container.querySelector('.match-swiper-next'),
342        prevEl: container.querySelector('.match-swiper-prev')
343      }
344    });
345  }
346
347  function initHomePageAuthorSwipers() {
348    const container = document.querySelector('#authorSlider .author-swiper');
349    if (!container) return;
350    new Swiper(container, {
351      slidesPerView: 3,
352      spaceBetween: 60,
353      navigation: {
354        nextEl: '#authorSlider .swiper-button-next',
355        prevEl: '#authorSlider .swiper-button-prev'
356      },
357      breakpoints: {
358        0:   { slidesPerView:1, spaceBetween:20 },
359        576: { slidesPerView:2, spaceBetween:40 },
360        992: { slidesPerView:3, spaceBetween:60 }
361      }
362    });
363  }
364
365  function initOurpageListen() {
366    const root = document.querySelector('.ourpage-listen');
367    if (!root) return;
368
369    // ➊ Her karta süre bilgisini yükle
370    root.querySelectorAll('.opl-card').forEach(card => {
371      const audio = card.querySelector('audio');
372      const durEl = card.querySelector('.opl-duration');
373      if (!audio || !durEl) return;
374      audio.addEventListener('loadedmetadata', () => {
375        const d = audio.duration;
376        const m = Math.floor(d / 60);
377        const s = Math.floor(d % 60).toString().padStart(2, '0');
378        durEl.textContent = `${m}:${s}`;
379      });
380      // metadata’yı hemen çekmesi için:
381      audio.load();
382    });
383
384    let currentItem = null;
385
386    // ➋ Mevcut play/durdur logic’iniz
387    root.querySelectorAll('.opl-play-btn').forEach(btn => {
388      btn.addEventListener('click', () => {
389        const item  = btn.closest('.opl-item');
390        const audio = item.querySelector('audio');
391        if (!audio) return;
392
393        if (currentItem && currentItem !== item) {
394          const prevAudio = currentItem.querySelector('audio');
395          prevAudio.pause();
396          prevAudio.currentTime = 0;
397          currentItem.classList.remove('playing');
398          currentItem.querySelector('.opl-play-btn').classList.remove('active');
399        }
400
401        if (item.classList.contains('playing')) {
402          audio.pause();
403          audio.currentTime = 0;
404          item.classList.remove('playing');
405          btn.classList.remove('active');
406          currentItem = null;
407        } else {
408          item.classList.add('playing');
409          btn.classList.add('active');
410          audio.play();
411          currentItem = item;
412        }
413      });
414    });
415  }
416
417
418  function initHomePageAudioPlayers() {
419    const tabs   = Array.from(document.querySelectorAll('.custom-audio__tabs button'));
420    const lists  = Array.from(document.querySelectorAll('.custom-audio__list'));
421    const player = document.getElementById('customAudioPlayer');
422    if (!tabs.length || !player) return;
423
424    const stopAll = () => {
425      player.pause();
426      player.src = '';
427      document.querySelectorAll('.custom-audio__track.playing')
428              .forEach(t => t.classList.remove('playing'));
429    };
430
431    tabs.forEach(btn => {
432      btn.addEventListener('click', () => {
433        stopAll();
434        tabs.forEach(b => b.classList.remove('active'));
435        btn.classList.add('active');
436        lists.forEach(l => {
437          l.style.display = (l.dataset.list === btn.dataset.tab) ? '' : 'none';
438        });
439      });
440    });
441
442    document.querySelectorAll('.custom-audio__track')
443      .forEach(track => track.addEventListener('click', () => {
444        document.querySelectorAll('.custom-audio__track.playing')
445                .forEach(t => t.classList.remove('playing'));
446        track.classList.add('playing');
447        const src = track.dataset.src;
448        if (player.src !== src) player.src = src;
449        player.play();
450      }));
451
452    if (tabs[0]) tabs[0].click();
453  }
454
455  function initHomePageVideoPlayers() {
456    document.querySelectorAll('.video-player-wrap').forEach(wrap => {
457      const video = wrap.querySelector('.video-player');
458      const btnP  = wrap.querySelector('.ctrl-play');
459      const btnM  = wrap.querySelector('.ctrl-mute');
460      const prog  = wrap.querySelector('.progress');
461      const bar   = wrap.querySelector('.progress-bar');
462      if (!video||!btnP||!btnM||!prog||!bar) return;
463
464      let rafId = null;
465      const update = () => {
466        const pct = video.duration
467          ? (video.currentTime / video.duration)*100
468          : 0;
469        bar.style.width = pct + '%';
470      };
471      const loop = () => {
472        update();
473        if (!video.paused && !video.ended) rafId = requestAnimationFrame(loop);
474        else rafId = null;
475      };
476      const start = () => { if (!rafId) rafId = requestAnimationFrame(loop); };
477
478      btnP.addEventListener('click', () => {
479        if (video.paused) { video.play(); start(); btnP.textContent='❚❚'; }
480        else              { video.pause();               btnP.textContent='▶'; }
481      });
482      btnM.addEventListener('click', () => {
483        video.muted = !video.muted;
484        btnM.textContent = video.muted ? '🔇' : '🔊';
485      });
486      video.addEventListener('loadedmetadata', () => bar.style.width='0%');
487      video.addEventListener('play',  () => { btnP.textContent='❚❚'; start(); });
488      video.addEventListener('pause', () => { btnP.textContent='▶'; });
489      video.addEventListener('ended', () => { btnP.textContent='▶'; bar.style.width='100%'; });
490      prog.addEventListener('click', e => {
491        const r = prog.getBoundingClientRect();
492        video.currentTime = ((e.clientX - r.left)/r.width) * video.duration;
493        update();
494      });
495    });
496  }
497
498    function initHomePageMarkets() {
499        const root = document.querySelector('.markets-widget');
500        if (!root) return;
501        const tbody = root.querySelector('#markets-body');
502        const tabs = Array.from(root.querySelectorAll('.tab'));
503        const data = {
504            dunya: JSON.parse(root.dataset.dunya || "[]"),
505            doviz: JSON.parse(root.dataset.doviz || "[]"),
506            emtia: JSON.parse(root.dataset.emtia || "[]"),
507            kripto: JSON.parse(root.dataset.kripto || "[]")
508        };
509        const render = cat => {
510            tbody.innerHTML = data[cat]
511                .map(r => `<tr>
512          <td>${r.sym}</td>
513          <td class="right">${r.last}</td>
514          <td class="right ${r.ch >= 0 ? 'pos' : 'neg'}">%${Math.abs(r.ch).toFixed(2)}</td>
515        </tr>`).join('');
516        };
517        tabs.forEach(btn => btn.addEventListener('click', () => {
518            root.querySelector('.tab.active')?.classList.remove('active');
519            btn.classList.add('active');
520            render(btn.dataset.cat);
521        }));
522        render('dunya');
523    }
524
525  function initPrayerTimer() {
526    const root = document.querySelector('.prayer-time');
527    if (!root) return;
528    const items = Array.from(root.querySelectorAll('.times__item'));
529    const bar   = root.querySelector('.progress-bar');
530    const clock = root.querySelector('.countdown');
531    if (!items.length || !bar || !clock) return;
532
533    const MS_DAY = 86_400_000;
534    const build = () => {
535      const now = new Date();
536      return items.map(it => {
537        const [h,m] = it.querySelector('.time').textContent.split(':').map(Number);
538        const dt = new Date(now.getFullYear(), now.getMonth(), now.getDate(), h, m);
539        if (dt <= now) dt.setTime(dt.getTime() + MS_DAY);
540        return { dt, el: it };
541      }).sort((a,b) => a.dt - b.dt);
542    };
543    let prayers = build();
544
545    setInterval(() => {
546      const now = new Date();
547      while (prayers[0].dt <= now) {
548        const p = prayers.shift();
549        p.dt.setTime(p.dt.getTime() + MS_DAY);
550        prayers.push(p);
551      }
552      prayers.sort((a,b) => a.dt - b.dt);
553      const next = prayers[0], prev = prayers[prayers.length - 1];
554      items.forEach(i => i.classList.remove('active'));
555      prev.el.classList.add('active');
556      const diff = next.dt - now;
557      const secs = Math.floor(diff / 1000);
558      const hh = String(Math.floor(secs/3600)).padStart(2,'0');
559      const mm = String(Math.floor((secs%3600)/60)).padStart(2,'0');
560      const ss = String(secs%60).padStart(2,'0');
561      clock.textContent = `${hh}:${mm}:${ss}`;
562      let total  = next.dt - prev.dt; if (total <= 0) total += MS_DAY;
563      let passed = now - prev.dt;     if (passed < 0) passed += MS_DAY;
564      bar.style.width = (passed/total*100).toFixed(2) + '%';
565    }, 1000);
566  }
567
568  function categorySlider() {
569    const root = document.querySelector('.categorySlider');
570    if (!root) return;
571    const tabs = Array.from(root.querySelectorAll('.categoryTabs button'));
572    const bars = Array.from(root.querySelectorAll('.categoryProgress .bar'));
573    const AUTOPLAY = 4000, SPC = 4;
574    let currentCat = 0;
575
576    const update = swiper => {
577      const real = swiper.realIndex;
578      const cat  = Math.floor(real/SPC), pos = real%SPC;
579      if (cat !== currentCat) {
580        currentCat = cat;
581        tabs.forEach((t,i) => t.classList.toggle('active', i===cat));
582        bars.forEach(b => b.classList.remove('filled','animate'));
583      }
584      bars.forEach((b,i) => {
585        b.classList.toggle('filled',  i < pos);
586        b.classList.toggle('animate', i === pos);
587      });
588    };
589
590    const swiper = new Swiper(root.querySelector('.categorySwiper'), {
591      loop: true,
592      autoplay: { delay: AUTOPLAY, disableOnInteraction: false },
593      navigation: {
594        nextEl: root.querySelector('.categoryNext'),
595        prevEl: root.querySelector('.categoryPrev')
596      },
597      on: { init: update, slideChange: update }
598    });
599
600    tabs.forEach(btn => {
601      btn.addEventListener('click', () => {
602        swiper.slideToLoop(+btn.dataset.cat * SPC);
603      });
604    });
605  }
606
607  function mostReadSlider() {
608    const el = document.querySelector('.most-read-swiper');
609    if (!el) return;
610    new Swiper(el, {
611      slidesPerView: 'auto',
612      spaceBetween: 15,
613      loop: false,
614      navigation: {
615        nextEl: '.most-read-swiper-control .swiper-button-next',
616        prevEl: '.most-read-swiper-control .swiper-button-prev'
617      },
618      keyboard: { enabled: true }
619    });
620  }
621
622  function objectiveSlider() {
623    document.querySelectorAll('.objectiveSlider').forEach(root => {
624      const swiperEl = root.querySelector('.objective-swiper');
625      if (!swiperEl) return;
626
627      new Swiper(swiperEl, {
628        slidesPerView: 'auto',
629        centeredSlides: true,
630        loop: true,
631        navigation: {
632          prevEl:  root.querySelector('.swiper-button-prev'),
633          nextEl:  root.querySelector('.swiper-button-next')
634        },
635        pagination: {
636          el:        root.querySelector('.swiper-pagination'),
637          clickable: true,
638          bulletClass:       'swiper-pagination-bullet',
639          bulletActiveClass: 'swiper-pagination-bullet-active'
640        },
641        breakpoints: {
642          0:   { slidesPerView: 1 },
643          768: { slidesPerView: 'auto' },
644          992: { slidesPerView: 'auto' }
645        },
646        on: {
647          init() {
648            this.slideToLoop(0, 0, false);
649          }
650        }
651      });
652    });
653  }
654
655  function videoSlider() {
656    const el = document.querySelector('.video-slider');
657    if (!el) return;
658    new Swiper(el, {
659      slidesPerView: 1.5,
660      spaceBetween: 0,
661      navigation: {
662        nextEl: '.swiper-button-next',
663        prevEl: '.swiper-button-prev'
664      },
665      breakpoints: {
666        768:  { slidesPerView: 3.5 },
667        1260: { slidesPerView: 5 }
668      }
669    });
670  }
671
672  function bannerSlider() {
673    const el  = document.querySelector('.bannerSwiper');
674    const bar = document.querySelector('.swiper-progress-bar');
675    if (!el || !bar) return;
676    new Swiper(el, {
677      loop: true,
678      effect: 'cards',
679      grabCursor: true,
680      autoplay: { delay: 2000, disableOnInteraction: false },
681      pagination: { el: '.swiper-pagination', clickable: true },
682      navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev' },
683      cardsEffect: {
684        slideShadows: true,
685        perSlideRotate: 5,
686        perSlideOffset: 15
687      },
688      on: {
689        slideChange(s) {
690          const total  = s.slides.length - 2;
691          const current = s.realIndex + 1;
692          bar.style.width = `${(current/total)*100}%`;
693        }
694      }
695    });
696  }
697
698  function topCategorySlider() {
699    const root   = document.querySelector('#exclusive-news-slider');
700    if (!root) return;
701    const btns   = Array.from(root.querySelectorAll('.category-btn'));
702    const slides = Array.from(root.querySelectorAll('.swiper-slide'));
703    const swiper = new Swiper(".exclusive-swiper", {
704      navigation: { nextEl: ".exclusive-next", prevEl: ".exclusive-prev" },
705      slidesPerView: 'auto',
706      spaceBetween: 13
707    });
708    btns.forEach(b => b.addEventListener('click', () => {
709      btns.forEach(x => x.classList.remove('active'));
710      b.classList.add('active');
711      const cat = b.dataset.category;
712      slides.forEach(s => {
713        s.style.display = (s.dataset.category === cat) ? 'block' : 'none';
714      });
715      swiper.update();
716      swiper.slideTo(0);
717    }));
718  }
719
720  function detailShareClick() {
721    const toggles = Array.from(document.querySelectorAll('.detailShareClick'));
722    toggles.forEach(toggle => {
723      const container = toggle.parentElement;
724      const menu      = container.querySelector('.detailShareMenu');
725      const closeBtn  = container.querySelector('.detailShareClose');
726      if (!menu || !closeBtn) return;
727      toggle.addEventListener('click', e => { e.stopPropagation(); menu.classList.toggle('open'); });
728      closeBtn.addEventListener('click', e => { e.stopPropagation(); menu.classList.remove('open'); });
729      menu.addEventListener('click', e => e.stopPropagation());
730    });
731    document.addEventListener('click', () => {
732      document.querySelectorAll('.detailShareMenu.open')
733              .forEach(m => m.classList.remove('open'));
734    });
735  }
736
737  function initDynamicSelectWidths() {
738    const ARROW = 24;
739    const measure = (txt, font) => {
740      const ctx = document.createElement('canvas').getContext('2d');
741      ctx.font = font;
742      return ctx.measureText(txt).width;
743    };
744    const adjust = sel => {
745      const cs    = getComputedStyle(sel);
746      const font  = `${cs.fontSize} ${cs.fontFamily}`;
747      const txt   = sel.options[sel.selectedIndex]?.text || '';
748      const textW = measure(txt, font);
749      const pad   = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight);
750      sel.style.width = Math.ceil(textW + pad + ARROW) + 'px';
751    };
752    const initSel = sel => {
753      if (sel.__init) return;
754      sel.__init = true;
755      adjust(sel);
756      sel.addEventListener('change', () => adjust(sel));
757    };
758    document.querySelectorAll('select').forEach(initSel);
759    new MutationObserver(muts => {
760      muts.forEach(m => {
761        m.addedNodes.forEach(node => {
762          if (node.nodeType !== 1) return;
763          if (node.tagName === 'SELECT') initSel(node);
764          node.querySelectorAll?.('select').forEach(initSel);
765        });
766      });
767    }).observe(document.body, { childList: true, subtree: true });
768  }
769
770  function initFixedSearchToggle() {
771    const openBtn      = document.querySelector('.headerTop-search');
772    const closeBtn     = document.querySelector('.search-close');
773    const searchFixed  = document.querySelector('.search-fixed');
774
775    if (!openBtn || !closeBtn || !searchFixed) return;
776
777    // Açma
778    openBtn.addEventListener('click', () => {
779      searchFixed.classList.add('active');
780      document.body.classList.add('no-scroll');
781    });
782
783    // Kapama
784    closeBtn.addEventListener('click', () => {
785      searchFixed.classList.remove('active');
786      document.body.classList.remove('no-scroll');
787    });
788  }
789
790  function initDatePicker() {
791    const daySelect   = document.getElementById("day");
792    const monthSelect = document.getElementById("month");
793    const yearSelect  = document.getElementById("year");
794
795    // Eğer ilgili <select>’ler sayfada yoksa çık
796    if (!daySelect || !monthSelect || !yearSelect) return;
797
798    const months = [
799      "Ocak", "Şubat", "Mart", "Nisan",
800      "Mayıs", "Haziran", "Temmuz", "Ağustos",
801      "Eylül", "Ekim", "Kasım", "Aralık"
802    ];
803
804    // Yılları doldur (1950–2030 arası örnek)
805    const currentYear = new Date().getFullYear();
806    for (let y = currentYear - 75; y <= currentYear + 5; y++) {
807      const opt = new Option(y, y);
808      if (y === currentYear) opt.selected = true;
809      yearSelect.add(opt);
810    }
811
812    // Ayları doldur
813    months.forEach((m, i) => {
814      const opt = new Option(m, i + 1);
815      if (i === new Date().getMonth()) opt.selected = true;
816      monthSelect.add(opt);
817    });
818
819    // Günleri dolduran fonksiyon
820    function populateDays() {
821      const year  = parseInt(yearSelect.value,  10);
822      const month = parseInt(monthSelect.value, 10);
823      const daysInMonth = new Date(year, month, 0).getDate();
824
825      daySelect.innerHTML = "";
826      for (let d = 1; d <= daysInMonth; d++) {
827        const opt = new Option(d, d);
828        // Eğer bugün ise seçili hâle getir
829        if (
830          year  === new Date().getFullYear() &&
831          month === new Date().getMonth() + 1 &&
832          d     === new Date().getDate()
833        ) {
834          opt.selected = true;
835        }
836        daySelect.add(opt);
837      }
838    }
839
840    // İlk doldurma ve değişiklikleri dinle
841    populateDays();
842    yearSelect.addEventListener("change",  populateDays);
843    monthSelect.addEventListener("change", populateDays);
844  }
845
846  function staticPageMenu() {
847    const cats = Array.from(document.querySelectorAll('.static-page-sidebar'));
848    if (!cats.length) return;
849    cats.forEach(cat => {
850      const btn  = cat.querySelector('[data-toggle="collapse"]');
851      const menu = cat.querySelector('.static-page-sidebar-link');
852      if (!btn || !menu) return;
853      btn.addEventListener('click', () => {
854        cat.classList.toggle('open');
855        btn.classList.toggle('open');
856        if (window.innerWidth < 992) {
857          menu.style.maxHeight = cat.classList.contains('open')
858            ? menu.scrollHeight + 'px'
859            : '0';
860        }
861      });
862    });
863    window.addEventListener('resize', () => {
864      document.querySelectorAll('.static-page-sidebar-link').forEach(menu => {
865        if (window.innerWidth >= 992) {
866          menu.style.maxHeight = 'none';
867        } else if (!menu.parentElement.classList.contains('open')) {
868          menu.style.maxHeight = '0';
869        }
870      });
871    });
872  }
873
874  function initCustomSelect() {
875  let currentOpen = null; // şimdilik açık olan dropdown referansı
876
877  // menu'yü body'ye çıkarır
878  function detachMenu(selectEl) {
879    const menu = selectEl.querySelector('.custom-select__menu');
880    if (!menu || menu.dataset.detached) return menu;
881
882    const placeholder = document.createComment('custom-select-placeholder');
883    menu.__ph = placeholder;
884    selectEl.insertBefore(placeholder, menu);
885
886    document.body.appendChild(menu);
887    Object.assign(menu.style, {
888      position: 'fixed',
889      zIndex: 9999
890    });
891    menu.dataset.detached = 'true';
892
893    // referansı sakla
894    selectEl._menu = menu;
895    return menu;
896  }
897
898  // menu'yü eski yerine geri koyar
899  function restoreMenu(selectEl) {
900    const menu = selectEl._menu;
901    if (!menu || !menu.dataset.detached) return;
902
903    const ph = menu.__ph;
904    ph.parentNode.insertBefore(menu, ph);
905    ph.remove();
906
907    delete menu.__ph;
908    delete menu.dataset.detached;
909    menu.style.position = '';
910    menu.style.top      = '';
911    menu.style.left     = '';
912    menu.style.width    = '';
913    menu.style.zIndex   = '';
914    selectEl._menu = null;
915  }
916
917  // tek bir dropdown'u kapat
918  function close(selectEl) {
919    selectEl.classList.remove('custom-select--open');
920    restoreMenu(selectEl);
921    currentOpen = null;
922  }
923
924  document.addEventListener('click', e => {
925    const toggle = e.target.closest('.custom-select__toggle');
926
927    // toggle üzerine tıklandıysa
928    if (toggle) {
929      const selectEl = toggle.closest('.custom-select');
930      const menu = detachMenu(selectEl);
931
932      // zaten açıksa -> kapat
933      if (selectEl.classList.contains('custom-select--open')) {
934        close(selectEl);
935        return;
936      }
937
938      // başkası açıksa onu kapat
939      if (currentOpen) {
940        close(currentOpen);
941      }
942
943      // yeni menüyü pozisyonla
944      const rect = toggle.getBoundingClientRect();
945      Object.assign(menu.style, {
946        top:   `${rect.bottom}px`,
947        left:  `${rect.left}px`,
948        width: `${rect.width}px`
949      });
950
951      // yeni dropdown'u aç
952      selectEl.classList.add('custom-select--open');
953      currentOpen = selectEl;
954      return;
955    }
956
957    // sayfanın başka bir yerine tıklandıysa
958    if (currentOpen) {
959      close(currentOpen);
960    }
961  });
962}
963
964function initSoundPlayers(selector = '.sound-player') {
965  // Hız dizisi
966  const SPEEDS = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
967
968  const players = document.querySelectorAll(selector);
969  if (!players.length) return;
970
971  players.forEach(player => {
972    const audio             = player.querySelector('audio');
973    const btnPlayPause      = player.querySelector('.play-pause');
974    const iconPlay          = player.querySelector('.icon-play');
975    const iconPause         = player.querySelector('.icon-pause');
976    const btnBackward       = player.querySelector('.skip.backward');
977    const btnForward        = player.querySelector('.skip.forward');
978    const btnVolume         = player.querySelector('.volume');
979    const iconVolOn         = player.querySelector('.icon-volume-on');
980    const iconVolOff        = player.querySelector('.icon-volume-off');
981    const progressContainer = player.querySelector('.progress-container');
982    const progressBar       = player.querySelector('.progress');
983    const currentTimeEl     = player.querySelector('.current-time');
984    const durationEl        = player.querySelector('.duration');
985    const btnSpeedDown      = player.querySelector('.speed-down');
986    const btnSpeedUp        = player.querySelector('.speed-up');
987    const speedValueEl      = player.querySelector('.speed-value');
988
989    // mm:ss format
990    const formatTime = sec => {
991      const m = Math.floor(sec / 60);
992      const s = Math.floor(sec % 60);
993      return `${m}:${s < 10 ? '0' : ''}${s}`;
994    };
995
996    // play/pause ikonunu güncelle
997    const updatePlayIcon = () => {
998      if (audio.paused) {
999        iconPlay.style.display  = 'block';
1000        iconPause.style.display = 'none';
1001      } else {
1002        iconPlay.style.display  = 'none';
1003        iconPause.style.display = 'block';
1004      }
1005    };
1006
1007    // speedValue göstergesini güncelle
1008    const updateSpeedDisplay = () => {
1009      speedValueEl.textContent = audio.playbackRate + 'x';
1010    };
1011
1012    // SPEEED dizisindeki mevcut indeksi bulur
1013    const getCurrentSpeedIndex = () =>
1014      SPEEDS.indexOf(audio.playbackRate);
1015
1016    // Meta yüklendiğinde toplam süreyi ayarla ve başlangıç hızını 1x olarak ata
1017    audio.addEventListener('loadedmetadata', () => {
1018      durationEl.textContent = formatTime(audio.duration);
1019      audio.playbackRate = 1;       // 1x başlangıç
1020      updateSpeedDisplay();
1021    });
1022
1023    // Zaman güncellendiğinde progress ve current-time
1024    audio.addEventListener('timeupdate', () => {
1025      const pct = audio.duration
1026        ? (audio.currentTime / audio.duration) * 100
1027        : 0;
1028      progressBar.style.width   = pct + '%';
1029      currentTimeEl.textContent = formatTime(audio.currentTime);
1030    });
1031
1032    // Progress bar’a tıkla → seek
1033    progressContainer.addEventListener('click', e => {
1034      const rect    = progressContainer.getBoundingClientRect();
1035      const clickX  = e.clientX - rect.left;
1036      const newTime = (clickX / rect.width) * audio.duration;
1037      audio.currentTime = newTime;
1038    });
1039
1040    // Oynat / duraklat
1041    btnPlayPause.addEventListener('click', () => {
1042      audio.paused ? audio.play() : audio.pause();
1043      updatePlayIcon();
1044    });
1045
1046    // 15 sn geri / 15 sn ileri
1047    btnBackward.addEventListener('click', () => {
1048      audio.currentTime = Math.max(0, audio.currentTime - 15);
1049    });
1050    btnForward.addEventListener('click', () => {
1051      audio.currentTime = Math.min(audio.duration, audio.currentTime + 15);
1052    });
1053
1054    // Ses aç / kapat (mute)
1055    btnVolume.addEventListener('click', () => {
1056      audio.muted = !audio.muted;
1057      iconVolOn.style.display  = audio.muted ? 'none' : 'block';
1058      iconVolOff.style.display = audio.muted ? 'block' : 'none';
1059    });
1060
1061    // Hız azalt
1062    btnSpeedDown.addEventListener('click', () => {
1063      const idx = getCurrentSpeedIndex();
1064      const newIdx = idx > 0 ? idx - 1 : 0;
1065      audio.playbackRate = SPEEDS[newIdx];
1066      updateSpeedDisplay();
1067    });
1068
1069    // Hız arttır
1070    btnSpeedUp.addEventListener('click', () => {
1071      const idx = getCurrentSpeedIndex();
1072      const newIdx = idx < SPEEDS.length - 1 ? idx + 1 : SPEEDS.length - 1;
1073      audio.playbackRate = SPEEDS[newIdx];
1074      updateSpeedDisplay();
1075    });
1076  });
1077}
1078
1079function initModalPopups(scope) {
1080  var root = scope || document;
1081  var MODAL_SELECTOR = '.tg-modal-popup';
1082  var ACTIVE_CLASS = 'active';
1083
1084  function closeAllModals() {
1085    document.querySelectorAll(MODAL_SELECTOR).forEach(function(modal) {
1086      var audio = modal.querySelector('audio');
1087      if (audio) { audio.pause(); audio.currentTime = 0; }
1088      modal.classList.remove(ACTIVE_CLASS);
1089    });
1090  }
1091
1092  root.querySelectorAll('.modal-click').forEach(function(link) {
1093    link.addEventListener('click', function(e) {
1094      e.preventDefault();
1095      closeAllModals();
1096      var articleId = link.getAttribute('data-article-id');
1097      var key = link.getAttribute('data-url');
1098      var modal;
1099      if (articleId) {
1100        modal = document.querySelector(MODAL_SELECTOR + '[data-modal="' + key + '"][data-article-id="' + articleId + '"]');
1101      } else {
1102        modal = document.querySelector(MODAL_SELECTOR + '[data-modal="' + key + '"]');
1103      }
1104      if (!modal) return;
1105      modal.classList.add(ACTIVE_CLASS);
1106    });
1107  });
1108
1109  root.querySelectorAll('.lssSummary, .lssListen').forEach(function(link) {
1110    link.addEventListener('click', function(e) {
1111      e.preventDefault();
1112      closeAllModals();
1113      var articleId = link.getAttribute('data-article-id');
1114      var modalKey = link.classList.contains('lssSummary') ? 'popup-summary' : 'popup-sound-player';
1115      loadSubscriberModal(articleId, modalKey, root);
1116    });
1117  });
1118
1119  function loadSubscriberModal(articleId, modalKey, scopeEl) {
1120    var container = (scopeEl && scopeEl !== document)
1121      ? scopeEl.querySelector('#article-modal-container')
1122      : document.getElementById('article-modal-container');
1123    if (!container) return;
1124
1125    if (!container.dataset.loadedArticleId || container.dataset.loadedArticleId !== String(articleId)) {
1126      fetch('/article/get-subscriber-content/' + articleId)
1127        .then(function(response) {
1128          if (response.redirected || response.status === 401 || response.status === 403) {
1129            Swal.fire({
1130              icon: 'info',
1131              title: 'Dijital Abonelik Gerekli',
1132              text: 'Bu özelliği kullanabilmek için dijital abonelik satın almanız gerekmektedir.',
1133              confirmButtonText: 'Abone Ol',
1134              showCancelButton: true,
1135              cancelButtonText: 'Kapat',
1136              confirmButtonColor: '#D03F43'
1137            }).then(function(result) {
1138              if (result.isConfirmed) window.location.href = '/abone-ol';
1139            });
1140            return null;
1141          }
1142          return response.text();
1143        })
1144        .then(function(html) {
1145          if (!html) return;
1146          container.innerHTML = html;
1147          container.dataset.loadedArticleId = articleId;
1148          var soundPlayer = container.querySelector('.sound-player');
1149          if (soundPlayer) initSoundPlayers('.sound-player');
1150          var modal = container.querySelector(MODAL_SELECTOR + '[data-modal="' + modalKey + '"]');
1151          if (modal) modal.classList.add(ACTIVE_CLASS);
1152        });
1153    } else {
1154      var modal = container.querySelector(MODAL_SELECTOR + '[data-modal="' + modalKey + '"]');
1155      if (modal) modal.classList.add(ACTIVE_CLASS);
1156    }
1157  }
1158
1159  if (!document._modalCloseListenerAdded) {
1160    document.addEventListener('click', function(e) {
1161      var btn = e.target.closest('.tg-modal-popup-close');
1162      if (!btn) return;
1163      var modal = btn.closest(MODAL_SELECTOR);
1164      if (!modal) return;
1165      var audio = modal.querySelector('audio');
1166      if (audio) { audio.pause(); audio.currentTime = 0; }
1167      modal.classList.remove(ACTIVE_CLASS);
1168    });
1169    document._modalCloseListenerAdded = true;
1170  }
1171
1172  window.initSubscriberButtons = function(scope) {
1173    var root = scope || document;
1174    root.querySelectorAll('.lssSummary, .lssListen').forEach(function(link) {
1175      link.addEventListener('click', function(e) {
1176        e.preventDefault();
1177        document.querySelectorAll(MODAL_SELECTOR).forEach(function(m) {
1178          var a = m.querySelector('audio');
1179          if (a) { a.pause(); a.currentTime = 0; }
1180          m.classList.remove(ACTIVE_CLASS);
1181        });
1182        var articleId = link.getAttribute('data-article-id');
1183        var modalKey = link.classList.contains('lssSummary') ? 'popup-summary' : 'popup-sound-player';
1184        var container = root.querySelector('#article-modal-container') || document.getElementById('article-modal-container');
1185        if (!container) return;
1186        if (!container.dataset.loadedArticleId || container.dataset.loadedArticleId !== String(articleId)) {
1187          fetch('/article/get-subscriber-content/' + articleId)
1188            .then(function(response) {
1189              if (response.redirected || response.status === 401 || response.status === 403) {
1190                Swal.fire({
1191                  icon: 'info',
1192                  title: 'Dijital Abonelik Gerekli',
1193                  text: 'Bu özelliği kullanabilmek için dijital abonelik satın almanız gerekmektedir.',
1194                  confirmButtonText: 'Abone Ol',
1195                  showCancelButton: true,
1196                  cancelButtonText: 'Kapat',
1197                  confirmButtonColor: '#D03F43'
1198                }).then(function(result) {
1199                  if (result.isConfirmed) window.location.href = '/abone-ol';
1200                });
1201                return null;
1202              }
1203              return response.text();
1204            })
1205            .then(function(html) {
1206              if (!html) return;
1207              container.innerHTML = html;
1208              container.dataset.loadedArticleId = articleId;
1209              var soundPlayer = container.querySelector('.sound-player');
1210              if (soundPlayer) initSoundPlayers('.sound-player');
1211              var modal = container.querySelector(MODAL_SELECTOR + '[data-modal="' + modalKey + '"]');
1212              if (modal) modal.classList.add(ACTIVE_CLASS);
1213            });
1214        } else {
1215          var modal = container.querySelector(MODAL_SELECTOR + '[data-modal="' + modalKey + '"]');
1216          if (modal) modal.classList.add(ACTIVE_CLASS);
1217        }
1218      });
1219    });
1220  };
1221}
1222
1223  
1224  function footer() {
1225    const cats = Array.from(document.querySelectorAll('.footer-cat'));
1226    if (!cats.length) return;
1227    cats.forEach(cat => {
1228      const btn  = cat.querySelector('[data-toggle="collapse"]');
1229      const menu = cat.querySelector('.footer-cat__menu');
1230      if (!btn || !menu) return;
1231      btn.addEventListener('click', () => {
1232        cat.classList.toggle('open');
1233        btn.classList.toggle('open');
1234        if (window.innerWidth < 992) {
1235          menu.style.maxHeight = cat.classList.contains('open')
1236            ? menu.scrollHeight + 'px'
1237            : '0';
1238        }
1239      });
1240    });
1241    window.addEventListener('resize', () => {
1242      document.querySelectorAll('.footer-cat__menu').forEach(menu => {
1243        if (window.innerWidth >= 992) {
1244          menu.style.maxHeight = 'none';
1245        } else if (!menu.parentElement.classList.contains('open')) {
1246          menu.style.maxHeight = '0';
1247        }
1248      });
1249    });
1250  }
1251
1252})();

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.