PageSourceSearch

https://izmir.bel.tr/Scripts/default/aramaScript_v1.1.js

js izmir.bel.tr collected 2026-10-01 10:37:11 UTC 19,126 bytes, 463 lines download raw bytes

1
2    $(function () {
3        $('a[href="#izbb-search"]').on('click', function (event) {
4            event.preventDefault();
5            $("body").css("overflow-y", "hidden");
6            $('#izbb-search').addClass('open');
7            $('#izbb-search > form > input[type="text"]').focus();
8        });
9
10    $('#izbb-search, #izbb-search button.close').on('click keyup', function (event) {
11                if (event.target == this || event.target.className == 'close' || event.keyCode == 27) {
12        $("body").css("overflow-y", "auto");
13    $(this).removeClass('open');
14}
15});
16
17
18});
19  
20
21        (function (theme, $) {
22
23            theme = theme || {};
24
25        var initialized = false;
26
27            $.extend(theme, {
28
29            Search: {
30
31            defaults: {
32            wrapper: $('#searchForm')
33    },
34
35                    initialize: function ($wrapper, opts) {
36                        if (initialized) {
37                            return this;
38    }
39
40    initialized = true;
41    this.$wrapper = ($wrapper || this.defaults.wrapper);
42
43    this
44        .setOptions(opts)
45        .build();
46
47    return this;
48},
49
50                    setOptions: function (opts) {
51            this.options = $.extend(true, {}, this.defaults, opts, this.$wrapper.data(
52                'plugin-options'));
53
54        return this;
55    },
56
57                    build: function () {
58                        if (!($.isFunction($.fn.validate))) {
59                            return this;
60    }
61
62                        this.$wrapper.validate({
63            errorPlacement: function (error, element) {}
64        });
65
66        return this;
67    }
68
69}
70
71});
72
73}).apply(this, [window.theme, jQuery]);
74   
75
76$(document).ready(function () {
77    var aramaKutusu = document.getElementById('search-input');
78    var sonKelime = "";
79    var yazmaBitisSuresi = 750;
80    var textInput = document.getElementById('search-input');
81    var timeout = null;
82    var form = document.getElementsByClassName("formScript")[0];
83    var defBgName = document.getElementById("search-results");
84    var $body = $('body');
85    var aramaBtn = document.getElementById('sonucGoruntule');
86    var $aramaId = $('#aramaId');
87    var allResults = $(".tab-content div > div");
88    var dilId = $('#hdnSozcukArama').val();
89    //var bunuMuDemekIstediniz = document.getElementById("bunuMuDemekIstediniz");
90    /* Arama sonuc tabları =>  custom scroll içerikleri seciliyor*/
91    var $Kategori1Div = $('#Kategori1 div');
92    var $Kategori2Div = $('#Kategori2 div');
93    var $Kategori3Div = $('#Kategori3 div');
94    var $Kategori4Div = $('#Kategori4 div');
95    var $Kategori5Div = $('#Kategori5 div');
96    var tabAktarildiMi = false;
97    var startTime;
98    var startTimeDateVersion;
99    //var duzeltildiMi = false;
100    //Mobil Mi Mobilde Resim gösterilmez
101    var mobilMi = false;
102    if (Modernizr.touch || $(window).width() < 768) {
103        mobilMi = true;
104    }
105    form.onsubmit = function (event) {
106        event.preventDefault();
107        return false;
108    }
109    function isEmpty(el) {
110        return !$.trim(el.html())
111    }
112    function GuncelMi(stringDonus) {
113        return stringDonus == startTime;
114    }
115
116    textInput.onkeyup = function (e) {
117        //duzeltildiMi = false;
118        if (e.keyCode == 20 || e.keyCode == 9 || e.keyCode == 17 || e.keyCode == 16 || e.keyCode == 18) {
119            return false;
120        }
121        if (e.keyCode == 13) {
122            clearTimeout(timeout);
123            SonucGetir();
124        } else {
125            clearTimeout(timeout);
126            timeout = setTimeout(function () {
127                SonucGetir();
128            }, yazmaBitisSuresi);
129        }
130
131        //if (mobilMi == false && textInput.value == "") {
132        //    $body.css("background-image", "url('" + location.protocol + '//' + location.host + "/YuklenenDosyalar/Temalar/Resimler/" + defBgName.getAttribute('data-defBg') + "')");
133        //}
134    };
135
136
137
138    aramaBtn.onclick = function () {
139        clearTimeout(timeout);
140        timeout = setTimeout(function () {
141            SonucGetir();
142        }, yazmaBitisSuresi / 2);
143    };
144
145    /*  */
146    function SonucGetir() {
147       
148        var vid = document.getElementById("myVideo");
149        if (vid) { vid.pause(); }
150        var d = new Date();
151        if (startTimeDateVersion && (d.getTime() - startTimeDateVersion.getTime()) < yazmaBitisSuresi) {
152            return;
153        }
154        startTimeDateVersion = d;
155        /*servise gidip geliyor doğru sorguyu getirmek için*/
156        startTime = d.getSeconds() + "" + d.getMilliseconds();
157
158        if (aramaKutusu.value.toLowerCase() == "haberler" || aramaKutusu.value.toLowerCase() == "haber" || aramaKutusu.value.toLowerCase() == "duyurular" || aramaKutusu.value.toLowerCase() == "duyuru") {
159            $("#main-tab_link_0").tab('show');
160            return;
161        }
162        /* tab aktarilmasi */
163        tabAktarildiMi = false;
164        if (aramaKutusu.value.length > 2) {
165            LoadingBaslat();
166            if (allResults.length == 0) {
167                allResults = $(".tab-content div > div");
168            }
169            allResults.html("");
170            sonKelime = aramaKutusu.value;
171            AramaAnimasyonuBaslat()
172            SonuclariGetir(0, null, startTime);
173
174
175        }
176        else {
177            AramaAnimasyonuBitir();
178        }
179    }
180    function SonuclariGetir(tip, armId, baslangic) {
181
182        $aramaId.val = "";
183        $.ajax({
184            url: '/' + dilId + '/Anasayfa/SonucGetir/',
185            //url: 'https://izmir.bel.tr/' + dilId + '/Anasayfa/SonucGetir/',
186            data: {
187                'tip': tip,
188                'kriter': aramaKutusu.value,
189                'armId': armId,
190                'gittigiZaman': baslangic
191            },
192            async: true,
193            cache: false,
194            type: 'POST',
195            dataType: 'json',
196            success: function (data) {
197              
198                var tb = document.getElementById("arananKelime");
199                sonucGoruntule(JSON.parse(data), tip);
200                if (tip < 4) {
201                    tip++;
202                    SonuclariGetir(tip, $aramaId.val, baslangic);
203                }
204
205                LoadingBitir();
206
207            }
208        });
209
210    }
211    function ImageExist(image_url) {
212        var http = new XMLHttpRequest();
213        http.open('HEAD', image_url, false);
214        http.send();
215        return http.status != 404;
216    }
217    function sonucGoruntule(donenSonuc, tip) {
218        var resultContent = document.getElementById("result");
219
220        if (donenSonuc.length != 0) {
221            var gittigiZaman = donenSonuc[donenSonuc.length - 1].gittigiZaman;
222            var bg = donenSonuc[donenSonuc.length - 1].Bg;
223            $aramaId.val = donenSonuc[donenSonuc.length - 1].AramaId;
224        }
225
226        if (!GuncelMi(gittigiZaman)) return;
227
228
229        //if (!mobilMi) {
230
231        //    if (tip == 0 && bg) {
232        //        $body.css("background-image", "url('" + location.protocol + '//' + location.host + "/YuklenenDosyalar/Menuler/Ikon/tumbnail/" + bg + "')");
233
234        //        $("#bgvid").css("display", "none");
235        //        var img = new Image();
236        //        img.onload = function () {
237        //            document.getElementsByTagName('body')[0].style.WebkitTransition = '0s';
238        //            document.getElementsByTagName('body')[0].style.MozTransition = '0s';
239        //            $body.css("background-image", "url('" + location.protocol + '//' + location.host + "/YuklenenDosyalar/Menuler/Ikon/" + bg + "')");
240        //            document.getElementsByTagName('body')[0].style.WebkitTransition = '2.2s';
241        //            document.getElementsByTagName('body')[0].style.MozTransition = '2.2s';
242
243        //        }
244        //        var resimYol = location.protocol + '//' + location.host + "/YuklenenDosyalar/Menuler/Ikon/" + bg;
245        //        if (ImageExist(resimYol))
246        //            img.src = resimYol;
247        //    } else if (tip == 0 && bg == "") {              
248        //        $body.css("background-image", "url('" + location.protocol + '//' + location.host + "/YuklenenDosyalar/Temalar/Resimler/" + defBgName.getAttribute('data-defBg') + "')");
249        //    }
250        //}
251        var aramaSonucu = "";
252        if (donenSonuc.length > 0) {
253            $.each(donenSonuc, function (index, elem) {
254                if (!GuncelMi(gittigiZaman)) return;
255                aramaSonucu = "";
256                if (elem != null) {
257                    if (elem.EklenmeTarihi != null || elem.EklenmeTarihi != undefined) {
258                        var res = elem.EklenmeTarihi.split(" ");
259                        elem.EklenmeTarihi = res[0];
260                    } else {
261                        elem.EklenmeTarihi = "";
262                    }
263                    if (elem.id != null || elem.id != undefined)
264                        var link = "/AramaYonlendirme/" + elem.URL + "/" + elem.id;
265                    else
266                        var link = "/AramaYonlendirme/" + elem.URL;
267
268                    var yol = "../YuklenenDosyalar/Menuler/Logo/" + elem.FotografYol;
269                    if (elem.MenuId == 0) elem.EklenmeTarihi = "";
270                    if (elem.MenuId == 0 && link.indexOf("izmir.bel.tr") == -1) {
271                        aramaSonucu = "<a class=\"search-details\" target=\"_blank\" + href=\"" + link + "\"><div class=\"search-list-item clearfix\">";
272                    } else {
273                        aramaSonucu = "<a class=\"search-details\" href=\"" + link + "\"><div class=\"search-list-item clearfix\">";
274                    }
275                    if (elem.FotografYol != null && elem.FotografYol != "")
276                        aramaSonucu += "<img class=\"pull-left\" style=\"max-width:155px;\" src=\"" + yol + "\" alt=\"\">";
277                    if (elem.Ozet != null) {
278                        if (elem.EklenmeTarihi == "")
279                            aramaSonucu += "<h4 class=\"search-title\">" + elem.Baslik + "</h4><p class=\"search-details\">" + elem.Ozet + "</p></div></a>";
280                        else
281                            aramaSonucu += "<h4 class=\"search-title\">" + elem.Baslik + "<em>" + elem.EklenmeTarihi + "</em></h4><p class=\"search-details\">" + elem.Ozet + "</p></div></a>";
282                    }
283                    else {
284                        if (elem.EklenmeTarihi == "")
285                            aramaSonucu += "<h4 class=\"search-title\">" + elem.Baslik + "</h4><p class=\"search-details\"></p></div></a>";
286                        else
287                            aramaSonucu += "<h4 class=\"search-title\">" + elem.Baslik + "<em>" + elem.EklenmeTarihi + "</em></h4><p class=\"search-details\"></p></div></a>";
288                    }
289                    //Guncel Sorgu Degil
290                    if (!GuncelMi(gittigiZaman)) return;
291                    //Olusan Html Ilgili dive basılıyor
292                    if (elem.MenuId == 0) {
293                        // custom scrollbar check set;
294                        if ($Kategori1Div.length == 0) {
295                            $Kategori1Div = $('#Kategori1  div > div');
296                        }
297                        if ($Kategori1Div.hasClass('empty')) {
298                            $Kategori1Div.html(aramaSonucu);
299                            $Kategori1Div.removeClass('empty')
300                        } else {
301                            $Kategori1Div.append(aramaSonucu);
302                        }
303                        $("#Kategori1").addClass("active")
304                    } else if (elem.MenuId == 1) {
305                        if ($Kategori2Div.length == 0) {
306                            $Kategori2Div = $('#Kategori2  div > div');
307                        }
308                        if ($Kategori2Div.hasClass('empty')) {
309                            $Kategori2Div.html(aramaSonucu);
310                            $Kategori2Div.removeClass('empty')
311                        } else {
312                            $Kategori2Div.append(aramaSonucu);
313                        }
314                    } else if (elem.MenuId == 3) {
315                        if ($Kategori3Div.length == 0) {
316                            $Kategori3Div = $('#Kategori3  div > div');
317                        }
318                        if ($Kategori3Div.hasClass('empty')) {
319                            $Kategori3Div.html(aramaSonucu);
320                            $Kategori3Div.removeClass('empty')
321                        } else {
322                            $Kategori3Div.append(aramaSonucu);
323                        }
324                    } else if (elem.MenuId == 2) {
325                        if ($Kategori4Div.length == 0) {
326                            $Kategori4Div = $('#Kategori4  div > div');
327                        }
328                        if ($Kategori4Div.hasClass('empty')) {
329                            $Kategori4Div.html(aramaSonucu);
330                            $Kategori4Div.removeClass('empty')
331                        } else {
332                            $Kategori4Div.append(aramaSonucu);
333                        }
334                    } else if (elem.MenuId == 4) {
335                        if ($Kategori5Div.length == 0) {
336                            $Kategori5Div = $('#Kategori5  div > div');
337                        }
338                        if ($Kategori5Div.hasClass('empty')) {
339                            $Kategori5Div.html(aramaSonucu);
340                            $Kategori5Div.removeClass('empty')
341                        } else {
342                            $Kategori5Div.append(aramaSonucu);
343                        }
344                    }
345                }
346            });
347        }
348        if ($Kategori1Div.length == 0) {
349            $Kategori1Div = $('#Kategori1  div > div');
350        }
351        if ($Kategori2Div.length == 0) {
352            $Kategori2Div = $('#Kategori2  div > div');
353        }
354        if ($Kategori3Div.length == 0) {
355            $Kategori3Div = $('#Kategori3  div > div');
356        }
357        if ($Kategori4Div.length == 0) {
358            $Kategori4Div = $('#Kategori4  div > div');
359        }
360        if ($Kategori5Div.length == 0) {
361            $Kategori5Div = $('#Kategori5  div > div');
362        }
363        if (!GuncelMi(gittigiZaman)) return;
364        /* Boşlara boş de */
365        var sonucYokMetni = "";
366        if (dilId == "tr") {
367            sonucYokMetni = " <strong>Aradığınız ölçütte sonuç bulunamadı.</strong>";
368        } else if (dilId == "en") {
369            sonucYokMetni = " <strong>The criteria you have searched for can not be found.</strong>";
370        } else if (dilId == "fr") {
371            sonucYokMetni = " <strong>Les critères que vous avez recherchés ne peuvent pas être trouvés.</strong>";
372        } else if (dilId == "de") {
373            sonucYokMetni = " <strong>Die von Ihnen gesuchten Kriterien können nicht gefunden werden.</strong>";
374        } else if (dilId == "ru") {
375            sonucYokMetni = " <strong>Критерии, которые вы искали, не могут быть найдены.<
375/strong>";
376        } else if (dilId == "cn") {
377            sonucYokMetni = " <strong>找不到您搜索的条件</strong>";
378        } else if (dilId == "es") {
379            sonucYokMetni = " <strong>No se pueden encontrar los criterios que ha buscado.</strong>";
380        } else {
381            sonucYokMetni = " <strong>No se pueden encontrar los criterios que ha buscado.</strong>";
382        }
383
384        if (isEmpty($($Kategori1Div))) {
385            $Kategori1Div.addClass('empty');
386            $Kategori1Div.html(sonucYokMetni);
387        } if (isEmpty($($Kategori2Div))) {
388            $Kategori2Div.addClass('empty');
389            $Kategori2Div.html(sonucYokMetni);
390        } if (isEmpty($($Kategori3Div))) {
391            $Kategori3Div.addClass('empty');
392            $Kategori3Div.html(sonucYokMetni);
393        } if (isEmpty($($Kategori4Div))) {
394            $Kategori4Div.addClass('empty');
395            $Kategori4Div.html(sonucYokMetni);
396        }
397        if (isEmpty($($Kategori5Div))) {
398            $Kategori5Div.addClass('empty');
399            $Kategori5Div.html(sonucYokMetni);
400        }
401
402
403        /* ilk doluyu aktive tab yap*/
404        if ($("#search-results .tab-content > .tab-pane  div > div:not(.empty)").length >= 1) {
405            /* sonuncu tab haberler duyurular tabı. sondan bir önceki tab aktif tab */
406            /* parents kategorileri ve - haberler duyurular tab-pane'i veriyor  */
407            /* negatif eq geriye doğru anlamına geriyor  eq -1 = haberler duyurular modulu eq-2 ilk menu*/
408            var tabId = $("#search-results .tab-content > .tab-pane  div > div:not(.empty)").parents(".tab-pane").eq(-2).attr("id");
409            if (tabId && tabAktarildiMi == false) {
410                $('.nav-tabs a[href="#' + tabId + '"]').tab('show');
411                tabAktarildiMi = true;
412            }
413        }
414        if (tip == 5) {
415            tabAktarildiMi = false;
416        }
417    }
418    function AramaAnimasyonuBaslat() {
419        /* IE KONTROLÜ EKLENDİ */
420        if (Modernizr.smil) {
421            $('#search').addClass("search--active");
422            $('body').addClass("searchNoPadding");
423        } else {
424            $('#search').addClass("search--active");
425            $('body').addClass("searchNoPadding");
426            setTimeout(function () { $('.banner').addClass("finalform"); }, 150);
427        }
428    }
429    function AramaAnimasyonuBitir() {
430        /* IE KONTROLÜ EKLENDİ */
431        if (Modernizr.smil) {
432            $('#search').removeClass("search--active");
433            $('body').removeClass("searchNoPadding");
434        } else {
435            $('.banner').removeClass("finalform");
436            setTimeout(function () { $('#search').removeClass("search--active"); $('body').removeClass("searchNoPadding"); }, 150);
437        }
438
439        //$('#search').removeClass("search--active").queue(function () {
440        //    $('.banner').removeClass("finalform");
441        //});
442    }
443    function LoadingBaslat() {
444        $('#search').addClass("spinner--active");
445    }
446    function LoadingBitir() {
447        setTimeout(function () {
448            $('#search').removeClass("spinner--active");
449        }, 300);
450    }
451
452});
453function ClearSearch() {
454    $('#search-input').val("");
455    $('#search').removeClass("search--active");
456    $('body').removeClass("searchNoPadding");
457    if (document.getElementById('search-input').value == "") {
458        $("body").css("background-image", "url('" + location.protocol + '//' + location.host + "/YuklenenDosyalar/Temalar/Resimler/" + document.getElementById("search-results").getAttribute('data-defBg') + "')");
459    }
460    $('#search-input').focus();
461    var vid = document.getElementById("myVideo");
462    if (vid) { vid.play(); }
463}

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.