PageSourceSearch

https://beyagac.bel.tr/tema/genel/assets/js/main.js

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

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.