PageSourceSearch

https://marmarahaber.com.tr/themes/flow/assets/js/functions.js

js marmarahaber.com.tr collected 2026-10-02 13:34:13 UTC 7,972 bytes, 271 lines download raw bytes

1$(document).ready(function () {
2
3    if (jQuery().datetimepicker) {
4        $.datetimepicker.setLocale($("html").attr("lang"));
5        $(".datepicker2").datetimepicker({
6            dayOfWeekStart: 1,
7            timepicker: false,
8            format: "Y-m-d",
9            scrollMonth: false,
10            scrollTime: false,
11            scrollInput: false
12        });
13
14    }
15
16
17    if (jQuery().fancybox) {
18        $(".article-text img").each(function (index) {
19            var is_link = $(this).closest('a').length;
20
21            if (!is_link) {
22                var imgSrc = $(this).attr("src");
23                var imgAlt = $(this).attr("alt") || ''; // alt etiketi yoksa boş string kullan
24                $(this).addClass('img-fluid').wrap('<a class="fancybox my-3" href="' + imgSrc + '" title="' + imgAlt + '"></a>');
25
26                if (typeof TE.setting.image_alt_tag_as_title !== 'undefined' && TE.setting.image_alt_tag_as_title == 1 && imgAlt.length > 0) {
27                    $(this).after('<i class="d-block small text-secondary">' + imgAlt + '</i>');
28                }
29            }
30        });
31
32        $('.fancybox').fancybox();
33    }
34
35});
36
37
38function getAnalyticUaCode() {
39    var tagManagerUrl = $('script[src*="googletagmanager"]').attr('src');
40
41    if (tagManagerUrl && typeof tagManagerUrl != "undefined") {
42        var tagManagerContainerId = tagManagerUrl.split('?')[1].split('=')[1].split('&')[0];
43
44        if (isAnalytics(tagManagerContainerId)) {
45            return tagManagerContainerId;
46        }
47
48    }
49
50    return false;
51}
52
53
54function isAnalytics(str) {
55    return (/^ua-\d{4,9}-\d{1,4}$/i).test(str.toString());
56}
57
58var analyticId = getAnalyticUaCode() ?? 0;
59
60
61function windowOpen(url, width, height, title, scroll, resize) {
62
63    var x = (window.innerWidth - width) / 2;
64    var y = (window.innerHeight - height) / 2;
65
66    window.open(url, title, "left=" + x + ",top=" + y + ",width=" + width + ",height=" + height + ",scrollbars=" + scroll + ",resizable=" + resize);
67
68    return false;
69}
70
71
72
73/*
74var jsocialShare = function (container) {
75    container.jsSocials({
76        showLabel: false,
77        showCount: false,
78        shareIn: "popup",
79        shares: [
80            { share: "facebook", shareUrl: container.data('facebook-url') },
81            { share: "twitter", shareUrl: container.data('twitter-url') },
82            "linkedin",
83            "pinterest",
84            "telegram",
85            { share: "whatsapp", shareUrl: container.data('whatsapp-url') },
86            //"email",
87            "print"
88        ]
89
90    });
91
92};
93
94$(document).ready(function () {
95    jsocialShare($("#shareIcons"));
96});
97*/
98
99
100function textUp(id) {
101    var div = $('[data-text-id="' + id + '"]');
102    nte = div.css("font-size"),
103        ntt = div.css("line-height"),
104        ntn = parseFloat(nte, 10),
105        ntr = parseFloat(ntt, 10),
106        nti = ntn + 2,
107        nts = ntr + 2;
108    div.css("font-size", nti);
109    div.each(function () {
110        $("span", this).css("font-size", nti);
111    });
112    div.css("line-height", nts + "px");
113}
114function textDown(id) {
115    var div = $('[data-text-id="' + id + '"]');
116    nte = div.css("font-size"),
117        ntt = div.css("line-height"),
118        ntn = parseFloat(nte, 10),
119        ntr = parseFloat(ntt, 10);
120    nti = ntn - 2,
121        nts = ntr - 2;
122    div.css("font-size", nti);
123    div.each(function () {
124        $("span", this).css("font-size", nti);
125    });
126    div.css("line-height", nts + "px");
127}
128
129
130if (typeof TE.setting.fixed_menu != 'undefined' && TE.setting.fixed_menu > 0 && $('header').length) {
131
132    var new_scroll_position = 0;
133    var last_scroll_position;
134
135    var navPosition = $('header').offset().top;
136
137
138    //STICKY MENU
139    $(window).scroll(function () {
140        var navTop = $(window).scrollTop();
141
142        var topHeaderHeight = $('header').find('.top-header').length > 0 ? $('header').find('.top-header').outerHeight() : 0;
143
144        if (
145            $('.header-4').length > 0 ||
146            $('.header-7').length > 0 ||
147            $('.header-3').length > 0 ||
148            $('.header-5').length > 0) {
149            topHeaderHeight = topHeaderHeight + $('header').find('nav.main-menu').outerHeight();
150        }
151
152
153        if (navPosition < navTop) {
154            $('body').css('padding-top', $('header').height())
155            $('header').addClass('sticky-header');
156        }
157        else {
158            $('body').css('padding-top', 0);
159            $('header').removeClass('sticky-header');
160        }
161
162        last_scroll_position = window.scrollY;
163
164        // Scrolling down
165        if (new_scroll_position < last_scroll_position && last_scroll_position > 80) {
166            $('header').removeClass("slideDown");
167            $('header').addClass("slideUp");
168
169            $('header.slideUp').css('transform', 'translateY(-' + topHeaderHeight + 'px)');
170
171            // Scrolling up
172        } else if (new_scroll_position > last_scroll_position) {
173            $('header').removeClass("slideUp");
174            $('header').addClass("slideDown");
175
176            $('header.slideDown').css('transform', 'translateY(0)');
177
178
179        }
180
181
182
183        new_scroll_position = last_scroll_position;
184    });
185
186}
187
188
189// Example starter JavaScript for disabling form submissions if there are invalid fields
190(function () {
191    'use strict'
192
193    // Fetch all the forms we want to apply custom Bootstrap validation styles to
194    var forms = document.querySelectorAll('.needs-validation')
195
196    // Loop over them and prevent submission
197    Array.prototype.slice.call(forms)
198        .forEach(function (form) {
199            form.addEventListener('submit', function (event) {
200                if (!form.checkValidity()) {
201                    event.preventDefault()
202                    event.stopPropagation()
203                }
204
205                form.classList.add('was-validated')
206            }, false)
207        })
208})()
209
210
211
212function copyURL(event, value = false) {
213    event.preventDefault();
214    var input = document.createElement("input");
215    input.type = "text";
216    input.value = (!value) ? window.location.href : value;
217    document.body.appendChild(input);
218    // input.focus(); // scroll'u sona attığı için kaldırıldı
219    input.select();
220    input.setSelectionRange(0, 99999); // Mobil cihazlar için.
221    document.execCommand("copy");
222    document.body.removeChild(input);
223    toastr.success("URL kopyalandı");
224}
225
226function toggleDropdown(element) {
227    element.classList.toggle("open");
228}
229
230// Close the dropdown when clicking outside
231document.addEventListener("click", function (event) {
232    const selectboxes = document.querySelectorAll(".custom-selectbox");
233    selectboxes.forEach(selectbox => {
234        if (!selectbox.contains(event.target)) {
235            selectbox.classList.remove("open");
236        }
237    });
238});
239
240
241
242$(document).ready(function () {
243    // Miktar inputuna keyup veya change olayı bağla
244    $('input[name="n"], select[name="parites"]').on('input change', function () {
245        // Miktarı al
246        var amount = parseFloat($('input[name="n"]').val().replace(',', '.'));
247
248        // Seçilen paritenin data-value değerini al
249        var selectedParite = $('select[name="parites"] option:selected').data('value');
250
251        // Seçili parite değeri veya miktar boşsa işlemi yapma
252        if (isNaN(amount) || !selectedParite) {
253            $('input[name="calculated"]').val(''); // Sonuç alanını temizle
254            return;
255        }
256
257        // Hesaplama yap
258        var result = amount * parseFloat(selectedParite);
259
260        // Sonucu input name="calculated" alanına yaz (formatlı)
261        $('input[name="calculated"]').val(formatNumber(result));
262    });
263
264    // Formatlama fonksiyonu: Binlik ayıracı nokta, ondalık ayıracı virgül
265    function formatNumber(number) {
266        return number
267            .toFixed(2) // 2 ondalık basamak
268            .replace('.', ',') // Ondalık ayıracı için virgül
269            .replace(/\B(?=(\d{3})+(?!\d))/g, '.'); // Binlik ayıracı için nokta
270    }
271});

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.