PageSourceSearch

https://batman.bel.tr/tema/genel/assets/js/main.js?v=1790309251

js batman.bel.tr collected 2026-09-25 04:08:02 UTC 33,012 bytes, 830 lines download raw bytes

1/* ===== Slider plugin + Header behaviors + kesfet (Owl) ===== */
2(function ($) {
3    "use strict";
4
5    /* ---------- Minimal #slide plugin (fading + autoplay + dots + arrows) ---------- */
6    function Slider(el, opts) {
7        this.$list = $(el);
8        this.opts = $.extend(true, {}, Slider.defaults, opts);
9        this.$slide = null;
10        this.$items = $();
11        this.current = 0;
12        this.timer = null;
13        this._init();
14    }
15
16    Slider.defaults = {
17        wrapper: '<div class="slide"></div>',
18        classes: { slide: ".slide", list: ".slayt-listesi", item: ".slide--item", dot: ".slide--dot" },
19        state: { active: "is-active" },
20        animation: "fading",
21        speed: 750,
22        activeTimeout: 750,
23        autoplay: true,
24        autoplayTimeout: 8000,
25        pauseHover: true,
26        pagination: true,
27        paginationNumeric: true,
28        arrows: true,
29        arrowsPrev: '<span class="arrow left"></span>',
30        arrowsNext: '<span class="arrow right"></span>'
31    };
32
33    Slider.prototype._init = function () {
34        this.$list.wrap(this.opts.wrapper);
35        this.$slide = this.$list.closest(this.opts.classes.slide);
36
37        this.$slide.find("ul li").addClass(this.opts.classes.item.replace('.', ''));
38        this.$items = this.$list.find(this.opts.classes.item);
39
40        this._applyAnimationType();
41
42        if (this.opts.pagination) this._buildPagination();
43        if (this.opts.arrows)     this._buildArrows();
44        if (this.opts.pauseHover) this._bindPauseHover();
45
46        this._autoplay();
47        this._show(this.current, true);
48    };
49
50    Slider.prototype._applyAnimationType = function () {
51        if (this.opts.animation === "fading") {
52            var h = this.$slide.outerHeight();
53            this.$items.each(function () {
54                $(this).css({
55                    position: "absolute", top: 0, right: 0, bottom: 0, left: 0,
56                    height: h, display: "none"
57                });
58            });
59        }
60    };
61
62    Slider.prototype._buildPagination = function () {
63        var html = '<ul class="slide-pagination">', self = this;
64        for (var i = 0; i < this.$items.length; i++) {
65            var label = this.opts.paginationNumeric ? (i + 1) : "";
66            html += '<li class="slide--dot slide-dot--' + i + '"><a>' + label + '</a></li>';
67        }
68        html += '</ul>';
69        this.$slide.append(html);
70
71        var $dots = this.$slide.find(this.opts.classes.dot);
72        $dots.eq(this.current).addClass("is-active");
73        $dots.on("click", function () {
74            var idx = $(this).index();
75            self._go(idx);
76            self._restartAutoplay();
77            return false;
78        });
79    };
80
81    Slider.prototype._buildArrows = function () {
82        var html = '<ul class="slide-arrows">';
83        html += '<a href="javascript:void(0);" class="prev">' + this.opts.arrowsPrev + '</a>';
84        html += '<a href="javascript:void(0);" class="next">' + this.opts.arrowsNext + '</a>';
85        html += '</ul>';
86        this.$slide.append(html);
87
88        var self = this;
89        this.$slide.find("a.prev").on("click", function () { self.prev(); self._restartAutoplay(); });
90        this.$slide.find("a.next").on("click", function () { self.next(); self._restartAutoplay(); });
91    };
92
93    Slider.prototype._bindPauseHover = function () {
94        var self = this;
95        this.$items.on({
96            mouseenter: function (e) { e.preventDefault(); if (self.opts.autoplay) clearInterval(self.timer); },
97            mouseleave: function (e) { e.preventDefault(); self._autoplay(); }
98        });
99    };
100
101    Slider.prototype._autoplay = function () {
102        var self = this;
103        if (!this.opts.autoplay) return;
104        clearInterval(this.timer);
105        this.timer = setInterval(function () { self.next(); }, this.opts.autoplayTimeout);
106    };
107
108    Slider.prototype._restartAutoplay = function () {
109        if (!this.opts.autoplay) return;
110        clearInterval(this.timer);
111        this._autoplay();
112    };
113
114    Slider.prototype._show = function (index, firstRun) {
115        var self = this;
116
117        if (this.opts.pagination) {
118            var $dots = this.$slide.find(this.opts.classes.dot);
119            $dots.removeClass("is-active").eq(index).addClass("is-active");
120        }
121
122        this.$items.removeClass(this.opts.state.active);
123
124        if (this.opts.animation === "fading") {
125            if (firstRun) this.$items.eq(index).show();
126            else this.$items.fadeOut(this.opts.speed).eq(index).fadeIn(this.opts.speed);
127        } else {
128            this.$items.hide().eq(index).show();
129        }
130
131        setTimeout(function () {
132            self.$items.eq(index).addClass(self.opts.state.active);
133        }, this.opts.activeTimeout);
134    };
135
136    Slider.prototype._go = function (index) {
137        if (index < 0) index = this.$items.length - 1;
138        if (index >= this.$items.length) index = 0;
139        this.current = index;
140        this._show(this.current, false);
141    };
142
143    Slider.prototype.prev = function () { this._go(this.current - 1); };
144    Slider.prototype.next = function () { this._go(this.current + 1); };
145
146    $.fn.slide = function (option) {
147        var args = Array.prototype.slice.call(arguments, 1);
148        return this.each(function () {
149            var $el = $(this);
150            var inst = $el.data("cz.slide");
151            if (!inst) {
152                inst = new Slider(this, typeof option === "object" && option);
153                $el.data("cz.slide", inst);
154            }
155            if (typeof option === "string" && option.charAt(0) !== "_" && typeof inst[option] === "function") {
156                inst[option].apply(inst, args);
157            }
158        });
159    };
160
161})(window.jQuery);
162
163
164/* ---------- INIT: slider + header behaviors + kesfet (Owl) + mobile drawer ---------- */
165jQuery(function ($) {
166    var CFG = window.APPCFG || {i18n:{}};
167
168    /* #slide init */
169    var $slide = $("#slide");
170    if ($slide.length && $.fn.slide) {
171        $slide.slide({
172            autoplay: true,
173            autoplayTimeout: 8000,
174            pauseHover: false,
175            pagination: true,
176            arrows: true,
177            animation: "fading"
178        });
179    }
180
181    /* Header Logo */
182    var $logo = $(".baslik-logo");
183    if ($logo.length) $logo.addClass("is-visible");
184
185    /* Sticky Header */
186    var $header       = $(".header");
187    var $headerSticky = $(".header-sticky");
188    if ($headerSticky.length && $header.length) {
189        var ST_VISIBLE = "is-visible";
190        var last = 0;
191        var target = $header.height();
192        $(window).on("scroll", function () {
193            var st = $(this).scrollTop();
194            if (Math.abs(last - st) <= 5) return;
195            if (st > target) {
196                (last > st) ? $headerSticky.addClass(ST_VISIBLE) : $headerSticky.removeClass(ST_VISIBLE);
197                last = st;
198            } else {
199                $headerSticky.removeClass(ST_VISIBLE);
200            }
201        });
202    }
203
204    /* Header Nav (hover) -> .header.is-active + .baslik-yerlesimi height */
205    (function () {
206        var $items    = $(".baslik-gezinti-ogesi, .header-nav__item");
207        var $overlay  = $(".baslik-yerlesimi");
208        var DROPDOWN  = ".gezinme-katmani";
209        var CLS_ACTIVE_HEADER = "is-active";
210        var CLS_VISIBLE_OVER  = "is-visible";
211
212        if (!$overlay.length && $header.length) {
213            $overlay = $('<div class="baslik-yerlesimi" aria-hidden="true"></div>').appendTo($header);
214        }
215
216        function setOverlayHeightFrom($dd) {
217            var h = 0;
218            if ($dd && $dd.length) {
219                var $ul = $dd.find('ul');
220                if ($ul.length) {
221                    var ulBottom = $ul.offset().top + $ul.outerHeight();
222                    h = ulBottom + 75;
223                } else {
224                    var offsetBottom = $dd.offset().top + $dd.outerHeight(true);
225                    h = offsetBottom;
226                }
227            }
228            $overlay.css("height", h + "px");
229        }
230
231        $items.on("mouseenter", function (e) {
232            e.preventDefault();
233            var $dd = $(this).find(DROPDOWN).first();
234            if ($dd.length) {
235                $header.addClass(CLS_ACTIVE_HEADER);
236                $overlay.addClass(CLS_VISIBLE_OVER);
237                setOverlayHeightFrom($dd);
238            }
239        });
240
241        $items.on("mouseleave", function (e) {
242            e.preventDefault();
243            $header.removeClass(CLS_ACTIVE_HEADER);
244            $overlay.removeClass(CLS_VISIBLE_OVER).css("height", "");
245        });
246
247        $(window).on("resize", function () {
248            if ($header.hasClass(CLS_ACTIVE_HEADER)) {
249                var $open = $(".baslik-gezinti-ogesi:hover, .header-nav__item:hover").find(DROPDOWN).first();
250                setOverlayHeightFrom($open);
251            }
252        });
253
254        $(document).on("keydown", function (e) {
255            if (e.key === "Escape") {
256                $header.removeClass(CLS_ACTIVE_HEADER);
257                $overlay.removeClass(CLS_VISIBLE_OVER).css("height", "");
258            }
259        });
260    })();
261
262    /* kesfet Carousel (Owl) */
263    var $kesfet = $(".kesfet-carousel .owl-kesfet");
264    if ($kesfet.length && $.fn.owlCarousel) {
265        $kesfet.owlCarousel({
266            loop: true,
267            margin: 30,
268            nav: true,
269            dots: true,
270            autoplay: true,
271            autoplayTimeout: 5000,
272            smartSpeed: 800,
273            responsive: {
274                0:    { items: 1 },
275                480:  { items: 2 },
276                768:  { items: 3 },
277                1200: { items: 4 }
278            },
279            navText: [
280                '<span class="arrow left"></span>',
281                '<span class="arrow right"></span>'
282            ]
283        });
284    }
285
286    /* === Mobile Nav (drawer) — mevcut akışla aynı === */
287    (function(){
288        var $content = $(".mobil-gezinme-icerigi");
289        if (!$content.length) return;
290
291        var E = {
292            mobileNav: $(".mobil-navigasyon"),
293            mobileNavContent: $content,
294            mobileNavItem: $content.find("> ul > li"),
295            mobileNavToggle: $(".gezinme-gecisi"),
296            appOverlay: $(".app-overlay"),
297            body: $("body, html")
298        };
299
300        var CLS_OPEN = "acik";
301        var CLS_CLOSE = "kapali";
302        var CLS_VISIBLE = "is-visible";
303        var CLS_DROPDOWN = "is-dropdown";
304        var PLUS_HTML = '<span class="icon mobil-navigasyon__plus"><i class="fas fa-arrow-right"></i></span>';
305
306        if (!E.appOverlay.length) {
307            E.appOverlay = $('<div class="app-overlay" aria-hidden="true"></div>').appendTo(document.body);
308        }
309
310        function openNav() {
311            E.appOverlay.addClass(CLS_VISIBLE);
312            setTimeout(function () {
313                E.mobileNav.addClass(CLS_VISIBLE);
314            }, 300);
315        }
316        function closeNav() {
317            E.mobileNav.removeClass(CLS_VISIBLE);
318            setTimeout(function () {
319                E.appOverlay.removeClass(CLS_VISIBLE);
320            }, 300);
321        }
322
323        E.mobileNavToggle.on("click", function (ev) {
324            ev.preventDefault();
325            var $btn = $(this);
326            if ($btn.hasClass(CLS_OPEN)) {
327                openNav();
328            } else if ($btn.hasClass(CLS_CLOSE)) {
329                closeNav();
330            }
331        });
332
333        E.appOverlay.on("click", function (ev) {
334            ev.preventDefault();
335            closeNav();
336        });
337
338        function Accordion($el, multiple) {
339            this.el = $el || $();
340            this.multiple = !!multiple;
341            this.el.find("li > a").on("click", { el: this.el, multiple: this.multiple }, this.dropdown);
342        }
343        Accordion.prototype.dropdown = function (ev) {
344            var $root = ev.data.el;
345            var $a = $(this);
346            var $next = $a.next();
347            $next.slideToggle();
348            $a.parent().toggleClass(CLS_OPEN);
349
350            if (!ev.data.multiple) {
351                $root.find("ul").not($next).slideUp().parent().removeClass(CLS_OPEN);
352            }
353            var href = ($a.attr("href") || "").trim().toLowerCase();
354            if (href === "" || href === "#" || href.indexOf("javascript") === 0) {
355                ev.preventDefault();
356            }
357        };
358
359        var $accordionRoot = $("#dropdown").length ? $("#dropdown") : E.mobileNavContent;
360        new Accordion($accordionRoot, false);
361
362        E.mobileNavItem.each(function () {
363            var $li = $(this);
364            var $ul = $li.find("> ul");
365            $ul.addClass(CLS_DROPDOWN);
366            if ($ul.hasClass(CLS_DROPDOWN)) {
367                var $a = $li.find("> a").first();
368                if ($a.length && !$a.find(".mobil-navigasyon__plus").length) {
369                    $a.append(PLUS_HTML);
370                }
371            }
372        });
373    })();
374
375    // app-scroll görünür + whatsapp is-active
376    (function(){
377        var $btn=$(".app-scroll"), $wa=$(".whatsapp");
378        if(!$btn.length) return;
379        var th=+$btn.data("threshold")||300, dur=+$btn.data("duration")||500;
380
381        $(window).on("scroll.app", function(){
382            var on=$(this).scrollTop()>th;
383            $btn.toggleClass("is-visible", on);
384            $wa.toggleClass("is-active", on);
385        }).trigger("scroll.app");
386
387        $btn.on("click", function(e){
388            e.preventDefault();
389            $("html,body").animate({scrollTop:0}, dur);
390        });
391    })();
392
393    /* =======================
394       ADDED FROM index.php
395       ======================= */
396
397    /* 1) Swiper: .hero-swiper */
398    (function(){
399        if (typeof Swiper === "undefined") return;
400        var el = document.querySelector('.hero-swiper');
401        if (!el) return;
402        // Navigation elementleri sayfada varsa bağla
403        var nextEl = document.querySelector('.hero-next');
404        var prevEl = document.querySelector('.hero-prev');
405        var pagEl  = document.querySelector('.hero-pagination');
406
407        new Swiper('.hero-swiper', {
408            loop: false,
409            speed: 600,
410            navigation: { nextEl: nextEl, prevEl: prevEl },
411            pagination: {
412                el: pagEl,
413                clickable: true,
414                renderBullet: function (index, className) {
415                    return '<span class="'+className+'">'+(index+1)+'</span>';
416                }
417            }
418        });
419    })();
420
421    /* 2) Owl: #proje-slider + ok-sol/ok-sag */
422    (function(){
423        var $s = $('#proje-slider');
424        if ($s.length && $.fn.owlCarousel){
425            var $owl = $s.owlCarousel({
426                loop:false,
427                margin:16,
428                dots:false,
429                nav:false,
430                responsive:{
431                    0:{items:1.1},
432                    576:{items:2},
433                    768:{items:3},
434                    1200:{items:4}
435                }
436            });
437            var $sol = $('.ok-sol'), $sag = $('.ok-sag');
438            $sol.on('click', function(){ $owl.trigger('prev.owl.carousel'); });
439            $sag.on('click', function(){ $owl.trigger('next.owl.carousel'); });
440        }
441    })();
442
443    /* 3) Basit paginate helper (duyuru/ihale/event) */
444    (function(){
445        function Paginate(container, itemSelector, perPage){
446            this.wrap = document.querySelector(container);
447            if(!this.wrap) return;
448            this.per = perPage; this.page = 0;
449            this.all = Array.from(this.wrap.querySelectorAll(itemSelector));
450            var h = Math.max(this.wrap.scrollHeight, this.per * 68);
451            this.wrap.style.setProperty('--lock-h', h+'px');
452            this.wrap.dataset.locked = '1';
453            this.render = ()=>{ this.wrap.innerHTML = ''; const s = this.page * this.per; this.all.slice(s, s+this.per).forEach(n=>this.wrap.appendChild(n)); };
454            this.hasNext = ()=> (this.page+1)*this.per < this.all.length;
455            this.hasPrev = ()=> this.page>0;
456            this.next = ()=>{ if(this.hasNext()){ this.page++; this.render(); } };
457            this.prev = ()=>{ if(this.hasPrev()){ this.page--; this.render(); } };
458            this.render();
459        }
460        function setNavState(pager, prevId, nextId){
461            var prev = document.getElementById(prevId);
462            var next = document.getElementById(nextId);
463            if(!pager || !prev || !next) return;
464            prev.classList.toggle('is-disabled', !pager.hasPrev());
465            next.classList.toggle('is-disabled', !pager.hasNext());
466        }
467
468        var duyuruPager = new Paginate('#duyuruList','li.duyuru-kalem', 5);
469        var ihalePager  = new Paginate('#ihaleList','li.duyuru-kalem', 5);
470        var eventPager  = new Paginate('#eventWrap','a.event-kutu', 5);
471
472        function updateAllNav(){
473            setNavState(duyuruPager,'duyuruPrev','duyuruNext');
474            setNavState(ihalePager,'ihalePrev','ihaleNext');
475            setNavState(eventPager,'eventPrev','eventNext');
476        }
477        updateAllNav();
478
479        var bind = function(id, fn){
480            var el = document.getElementById(id);
481            if(!el) return;
482            el.addEventListener('click', function(e){ e.preventDefault(); fn(); updateAllNav(); });
483        };
484        bind('duyuruPrev', ()=>duyuruPager && duyuruPager.prev());
485        bind('duyuruNext', ()=>duyuruPager && duyuruPager.next());
486        bind('ihalePrev',  ()=>ihalePager  && ihalePager.prev());
487        bind('ihaleNext',  ()=>ihalePager  && ihalePager.next());
488        bind('eventPrev',  ()=>eventPager  && eventPager.prev());
489        bind('eventNext',  ()=>eventPager  && eventPager.next());
490    })();
491
492    /* 4) Owl: #belediye-slider + oklar */
493    (function(){
494        var $owl = $('#belediye-slider');
495        if ($owl.length && $.fn.owlCarousel){
496            $owl.owlCarousel({
497                margin:12, nav:false, dots:false,
498                autoplay:true, loop:true, center:false,
499                stagePadding:0, smartSpeed:450,
500                responsive:{
501                    0:{ items:2 },
502                    480:{ items:3 },
503                    768:{ items:4 },
504                    992:{ items:5 },
505                    1200:{ items:6 },
506                    1400:{ items:7 }
507                }
508            });
509            $('#ok-belediye-sol').on('click', function(){ $owl.trigger('prev.owl.carousel'); });
510            $('#ok-belediye-sag').on('click', function(){ $owl.trigger('next.owl.carousel'); });
511        }
512    })();
513
514    /* 5) Owl: #ortaOwl */
515    (function(){
516        var $o = $('#ortaOwl');
517        if ($o.length && $.fn.owlCarousel){
518            $o.owlCarousel({
519                items:1, loop:true, margin:0,
520                autoplay:true, autoplayTimeout:4500, autoplayHoverPause:true,
521                smartSpeed:650, dots:true, nav:false
522            });
523        }
524    })();
525
526    /* 6) Owl: .section-quickbar #hizli-serit + oklar */
527    (function(){
528        var $o = $('.section-quickbar #hizli-serit');
529        if ($o.length && $.fn.owlCarousel){
530            $o.owlCarousel({
531                margin:12, nav:false, dots:false,
532                autoplay:false, loop:true, center:false,
533                stagePadding:0, smartSpeed:450,
534                responsive:{
535                    0:{ items:1 },
536                    480:{ items:2 },
537                    768:{ items:3 },
538                    992:{ items:4 },
539                    1200:{ items:8 }
540                }
541            });
542            $('#quickbar-ok-belediye-sol').on('click', function(){ $o.trigger('prev.owl.carousel'); });
543            $('#quickbar-ok-belediye-sag').on('click', function(){ $o.trigger('next.owl.carousel'); });
544        }
545    })();
546
547    /* 7) Fancybox: custom prev/next + caption + sonsuz kapalı */
548    (function(){
549        if (typeof Fancybox === "undefined") return;
550        var SELECTOR = "[data-fancybox='galeri']";
551
552        function toggleDisabled(el, disabled) {
553            if (!el) return;
554            el.classList.toggle("is-off", !!disabled);
555            if (disabled) {
556                el.setAttribute("disabled", "disabled");
557                el.setAttribute("aria-disabled", "true");
558            } else {
559                el.removeAttribute("disabled");
560                el.setAttribute("aria-disabled", "false");
561            }
562        }
563        const currentIndex = (fb) => fb?.getSlide()?.index ?? 0;
564        const totalInGroup = (fb) => fb?.carousel?.slides?.length ?? 0;
565
566        function refreshNav(fb) {
567            if (!fb) return;
568            const idx = currentIndex(fb);
569            const last = Math.max(0, totalInGroup(fb) - 1);
570            const prev = fb.container.querySelector(".kb-prev");
571            const next = fb.container.querySelector(".kb-next");
572            toggleDisabled(prev, idx <= 0);
573            toggleDisabled(next, idx >= last);
574        }
575
576        function ensureNav(fb) {
577            if (!fb || !fb.container) return;
578            const host = fb.container.querySelector(".fancybox__content") || fb.container;
579            let nav = host.querySelector(".kb-nav");
580            if (!nav) {
581                nav = document.createElement("div");
582                nav.className = "kb-nav";
583                nav.innerHTML = `
584                  <button type="button" class="kb-prev" aria-label="Geri">
585                    <svg viewBox="0 0 24 24" width="24" height="24" fill="currentColor" aria-hidden="true">
586                      <path d="M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
587                    </svg>
588                  </button>
589                  <button type="button" class="kb-next" aria-label="İleri">
590                    <svg viewBox="0 0 24 24" width="24" height="24" fill="currentColor" aria-hidden="true">
591                      <path d="M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z"/>
592                    </svg>
593                  </button>`;
594                host.appendChild(nav);
595
596                var prevBtn = nav.querySelector(".kb-prev");
597                var nextBtn = nav.querySelector(".kb-next");
598                prevBtn.addEventListener("click", function(){ if (!prevBtn.hasAttribute("disabled")) fb.prev(); });
599                nextBtn.addEventListener("click", function(){ if (!nextBtn.hasAttribute("disabled")) fb.next(); });
600            }
601            refreshNav(fb);
602        }
603
604        Fancybox.bind(SELECTOR, {
605            Hash: false,
606            dragToClose: false,
607            Thumbs: false,
608            Carousel: {
609                infinite: false,
610                Toolbar: {
611                    display: { left: ["counter"], middle: [], right: ["close"] }
612                }
613            },
614            caption: (fb, slide) => {
615                var t = slide?.$trigger;
616                var img = t?.querySelector?.("img");
617                return t?.getAttribute?.("data-caption") ||
618                       t?.getAttribute?.("title") ||
619                       img?.getAttribute?.("alt") ||
620                       slide?.caption || "";
621            },
622            on: {
623                ready: (fb) => ensureNav(fb),
624                done:  (fb) => refreshNav(fb),
625                "Carousel.change": (fb) => refreshNav(fb),
626                destroy: (fb) => fb?.container?.querySelector(".kb-nav")?.remove()
627            }
628        });
629    })();
630
631    /* 8) Arama popup (sadece kapatma ile kapanır) */
632    (function(){
633        var $toggle = $(".search--toggle");
634        var $popup  = $("#search-popup");
635        if (!$popup.length || !$toggle.length) return;
636        var $close  = $popup.find(".ara-close");
637        var $input  = $popup.find("input[name='q']");
638
639        function openSearch(){
640            $popup.addClass("active");
641            setTimeout(function(){ $input.trigger("focus"); }, 80);
642            document.body.style.overflow = "hidden";
643        }
644        function closeSearch(){
645            $popup.removeClass("active");
646            document.body.style.overflow = "";
647        }
648        $toggle.on("click", function(e){ e.preventDefault(); openSearch(); });
649        $close.on("click", function(){ closeSearch(); });
650        // İstenirse: overlay tıklaması/ESC kapama eklenebilir; şu an sadece close ile kapanır.
651    })();
652
653    /* 9) Dil değiştir (AJAX) + çoklu dil modal */
654    (function(){
655        window.dildegis = function(dilID){
656            $.ajax({
657                url: 'dildegis.php',
658                dataType: 'JSON',
659                data: { id: dilID, current: (CFG.currentLang || '') }
660            })
661            .done(function(msg){
662                if (msg && msg.hata){ alert("Hata"); }
663                else if (msg && msg.redirect){ window.location = msg.redirect; }
664            })
665            .fail(function(jqXHR, textStatus, errorThrown){
666                console.error("Hata ", textStatus, errorThrown);
667            })
668            .always(function(){ console.log("Hata"); });
669        };
670
671        if ((CFG.dilSay || 1) > 1 && $.fn.iziModal){
672            function initializeModal(modalId, triggerClass) {
673                $(modalId).iziModal({
674                    title: "", subtitle: "", iconClass: '',
675                    background: null, theme: 'light',
676                    closeButton: true, overlay: true, overlayClose: true,
677                    transitionInOverlay: 'fadeIn', transitionOutOverlay: 'fadeOut',
678                    overlayColor: 'rgba(0, 0, 0, 0.85)',
679                    width: 500, padding: 20, zindex: 99999
680                });
681                $(document).on('click', triggerClass, function(e){
682                    e.preventDefault(); $(modalId).iziModal('open');
683                });
684                setTimeout(function(){ $(modalId).appendTo("body"); }, 2000);
685            }
686            initializeModal("#modal-demo",".trigger-link");
687        }
688    })();
689
690    /* 10) Ajax form (Swal) */
691    (function(){
692        $(document).on('submit', 'form.ajax-form', function(e){
693            e.preventDefault();
694            var $form = $(this);
695            var $button = $form.find('button[type="submit"]');
696            var defaultButtonText = $button.html();
697
698            if ($form[0].checkValidity()) {
699                var formData = $form.serialize();
700                $button.prop('disabled', true).html(CFG.i18n.sending || 'Gönderiliyor...');
701
702                $.ajax({
703                    url: $form.attr('action') || '_class/site_islem.php',
704                    type: 'POST',
705                    data: formData,
706                    success: function(response){
707                        var result;
708                        try { result = JSON.parse(response); } catch(e){}
709                        var status = (result && result.status) || 'error';
710                        if(status === 'success'){
711                            Swal({
712                                type: 'success',
713                                title: (result.title || CFG.i18n.successTitle || 'Başarılı'),
714                                text:  (result.message || CFG.i18n.successMsg  || 'İşleminiz başarıyla alındı.'),
715                                confirmButtonText: (CFG.i18n.ok || 'Tamam'),
716                                timer: 5000
717                            }).then(function(){ $form[0].reset(); });
718                        } else {
719                            Swal({
720                                type: 'error',
721                                title: (result && result.title) || CFG.i18n.errorTitle || 'Hata',
722                                text:  (result && result.message) || CFG.i18n.errorMsg || 'İşleminiz gerçekleştirilemedi.',
723                                confirmButtonText: (CFG.i18n.ok || 'Tamam'),
724                                timer: 5000
725                            });
726                        }
727                    },
728                    error: function(xhr, status, error){
729                        Swal({
730                            type: 'error',
731                            title: (CFG.i18n.errorTitle || 'Hata'),
732                            text:  'Bir hata oluştu: ' + (error || status),
733                            confirmButtonText: (CFG.i18n.ok || 'Tamam'),
734                            timer: 5000
735                        });
736                    },
737                    complete: function(){
738                        $button.prop('disabled', false).html(defaultButtonText);
739                    }
740                });
741            }
742        });
743    })();
744
745    /* 11) Cookie popup tetikleyici (dışarıda checkAlertCookie varsa çağır) */
746    (function(){
747        setTimeout(function(){
748            if (typeof window.checkAlertCookie === 'function') {
749                window.checkAlertCookie();
750            }
751        }, 1000);
752        // İhtiyaç halinde APPCFG üzerinden HTML üretmek:
753        // var html = '<div id="cookie-alert-popup"> ... ' + (CFG.i18n.cookieBtn||'Kabul') + '</div>';
754    })();
755
756    /* 12) LazyLoad + spinner */
757    (function(){
758        // img.lazy etrafına .lazy-container + .lazy-spinner yerleştir
759        document.querySelectorAll('img.lazy').forEach(function(img){
760            if (img.closest('.lazy-container')) return;
761            var container = document.createElement('div');
762            container.className = 'lazy-container';
763            // bazı bilinen durumlar
764            if (img.closest('.news-image-container')) container.classList.add('news-image-container');
765            if (img.closest('.video-thumbnail'))      container.classList.add('video-thumbnail');
766            if (img.closest('.category-image'))       container.classList.add('category-image');
767
768            var spinner = document.createElement('div');
769            spinner.className = 'lazy-spinner';
770
771            img.parentNode.insertBefore(container, img);
772            container.appendChild(img);
773            container.appendChild(spinner);
774        });
775
776        if (typeof LazyLoad === "undefined") return;
777        var lazyLoadInstance = new LazyLoad({
778            elements_selector: "img.lazy",
779            threshold: 100,
780            callback_loading: function(el){
781                el.classList.remove('lazy-loaded');
782                var spinner = el.closest('.lazy-container')?.querySelector('.lazy-spinner') || el.nextElementSibling;
783                if (spinner && spinner.classList.contains('lazy-spinner')) spinner.style.display = 'block';
784            },
785            callback_loaded: function(el){
786                el.classList.add('lazy-loaded');
787                var spinner = el.closest('.lazy-container')?.querySelector('.lazy-spinner') || el.nextElementSibling;
788                if (spinner && spinner.classList.contains('lazy-spinner')) {
789                    spinner.style.opacity = '0';
790                    setTimeout(function(){ spinner.remove(); }, 300);
791                }
792            },
793            callback_error: function(el){
794                el.src = "https://dummyimage.com/300x200/f8f8f8/d63384&text=" + encodeURIComponent(CFG.firmaAdi || 'FIRMA');
795                var spinner = el.closest('.lazy-container')?.querySelector('.lazy-spinner') || el.nextElementSibling;
796                if (spinner && spinner.classList.contains('lazy-spinner')) spinner.remove();
797            }
798        });
799
800        // Swiper slideChange gibi durumlarda update
801        window.updateLazyLoad = function(){ try{ lazyLoadInstance.update(
801); }catch(e){} };
802        if (typeof Swiper !== 'undefined') {
803            document.querySelectorAll('.swiper').forEach(function(sw){
804                sw.addEventListener('slideChange', window.updateLazyLoad);
805            });
806        }
807    })();
808
809    /* 13) Dil dropdown aç/kapa */
810    (function(){
811        var $triggers = $('.language-dropdown-active');
812        var $dropdowns = $('.language-dropdown');
813        if (!$triggers.length) return;
814
815        $triggers.on('click', function(e){
816            e.preventDefault();
817            var $dd = $(this).next('.language-dropdown');
818            var isActive = $dd.hasClass('active');
819            $dropdowns.removeClass('active');
820            if (!isActive) $dd.addClass('active');
821        });
822
823        $(document).on('click', function(e){
824            if (!$(e.target).closest('.language-box').length){
825                $dropdowns.removeClass('active');
826            }
827        });
828    })();
829
830});

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.