PageSourceSearch

https://tocka.com.mk/js/scripts/script.js?v=1790242555

js tocka.com.mk collected 2026-09-24 09:36:12 UTC 9,308 bytes, 352 lines download raw bytes

1$.fn.isOnScreen = function(){
2
3    var win = $(window);
4
5    var viewport = {
6        top : win.scrollTop(),
7        left : win.scrollLeft()
8    };
9    viewport.right = viewport.left + win.width();
10    viewport.bottom = viewport.top + win.height();
11
12    var bounds = this.offset();
13
14    if(typeof(bounds) != 'undefined') {
15        bounds.right = bounds.left + this.outerWidth();
16        bounds.bottom = bounds.top + this.outerHeight();
17        return (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
18    }
19};
20
21/*
22$.fn.isOnScreen = function(x, y){
23    
24    if(x == null || typeof x == 'undefined') x = 1;
25    if(y == null || typeof y == 'undefined') y = 1;
26    
27    var win = $(window);
28    
29    var viewport = {
30        top : win.scrollTop(),
31        left : win.scrollLeft()
32    };
33    viewport.right = viewport.left + win.width();
34    viewport.bottom = viewport.top + win.height();
35    
36    var height = this.outerHeight();
37    var width = this.outerWidth();
38 
39    if(!width || !height){
40        return false;
41    }
42    
43    var bounds = this.offset();
44    bounds.right = bounds.left + width;
45    bounds.bottom = bounds.top + height;
46    
47    var visible = (!(viewport.right < bounds.left || viewport.left > bounds.right || viewport.bottom < bounds.top || viewport.top > bounds.bottom));
48    
49    if(!visible){
50        return false;   
51    }
52    
53    var deltas = {
54        top : Math.min( 1, ( bounds.bottom - viewport.top ) / height),
55        bottom : Math.min(1, ( viewport.bottom - bounds.top ) / height),
56        left : Math.min(1, ( bounds.right - viewport.left ) / width),
57        right : Math.min(1, ( viewport.right - bounds.left ) / width)
58    };
59    
60    return (deltas.left * deltas.right) >= x && (deltas.top * deltas.bottom) >= y;
61    
62};
63*/
64
65
66
67var mainSite = 'tocka';
68var navBarLoaded = false;
69
70$("document").ready(function()
71{
72    if('scrollRestoration' in history)
73    {
74        history.scrollRestoration = 'auto';
75    }
76
77    setTimeout(function()
78    {
79        $('html, body').animate({
80            scrollTop: 0
81        }, 10);
82    }, 50);
83
84    $(".nav-menu-news").click(function() {
85        loadNavMenuNews();
86    });
87
88    eppFix();
89
90    mainSite = $('#mainSite').val();
91
92    if(mainSite == 'karmin') {
93        $('.karmin-footer-social-links').show();
94    }
95    else if(mainSite == 'supermen') {
96        $('.supermen-footer-social-links').show();
97    }
98    else if(mainSite == 'tv') {
99        $('.tv-footer-social-links').show();
100    }
101    else {
102        $('.tocka-footer-social-links').show();
103    }
104
105    // getWeatherData();
106
107    // Check if mobile device and .top-14-pading has 14px or smaller padding, then remove the class
108    if (/Mobi|Android/i.test(navigator.userAgent)) {
109        var el = $('.top-14-pading');
110        if (el.length) {
111            var padding = parseInt(el.css('padding-top'), 10);
112            if (!isNaN(padding) && padding <= 14) {
113                el.removeClass('top-14-pading');
114            }
115        }
116    }
117
118});
119
120function getWeatherData(){
121    var url = "/api/get-weather";
122    $.get(url).done(function(data)
123    {
124        startWeatherAnimation(data);
125    });
126}
127
128function startWeatherAnimation(weatherData){
129    let counter = 0;
130    let header = $('#header-weather-animation');
131
132    if(!header || weatherData.length == 0){
133        return;
134    }
135
136    function switchWeatherTown(){
137        header.fadeOut(500);
138        if(counter === weatherData.length) {
139            counter = 0;
140        }
141
142        let weather = 
143            "<a href='/vremenska-prognoza' class='top-weather'>" +
144                "<span class='slika'><i class='wi " + weatherData[counter]['weather_code'] +  "'></i></span>"+
145                "<span class='info'>" +
146                    "<span class='grad'>" + weatherData[counter]['city_cyrilic'] + "</span>" +
147                    "<span class='temperatura'>" + weatherData[counter]['temperature'] + "°</span>" +
148                "</span>" +
149            "</a>";
150
151        setTimeout(function() {
152            header.empty();
153            header.append(weather).hide().fadeIn(500);
154        }, 500);
155
156        counter++;
157    }
158
159    switchWeatherTown();
160    setInterval(function() {
161        switchWeatherTown();
162    }, 4000);
163}
164
165function loadNajcitani(category)
166{
167    var url = "/api/get-najcitani/" + category;
168
169    $.get(url + "/0", {  }, function(data) {
170            $("#24-chasa").html(data);
171        });
172
173    setTimeout(function()
174    {
175        $.get(url + "/7", {  }, function(data) {
176            $("#7-dena").html(data);
177        });
178    }, 1000);
179
180    setTimeout(function()
181    {
182        $.get(url + "/30", {  }, function(data) {
183            $("#30-dena").html(data);
184        });
185    }, 2000);
186}
187
188function loadArchiveModule(type, category, numberOfItems, moduleId, carousel)
189{
190    var url = "/api/get-archive-module/" + type + "/" + category + "/" + numberOfItems;
191
192    if(type == "najnovi")
193    {
194        $("#" + moduleId).hide();
195    }
196
197    $.get(url).done(function(data)
198        {
199            if(type == "najnovi")
200            {
201                $("#" + moduleId).html(data).show(500).css("display", "");
202            }
203            else
204            {
205                setTimeout(function()
206                {
207                    $("#" + moduleId).html(data);
208                }, 2000);
209            }
210
211            if(typeof carousel !== 'undefined')
212            {
213                setTimeout(function()
214                {
215                    var fn = window[carousel];
216                    if(typeof fn === 'function') {
217                        fn();
218                    }
219                }, 600);
220            }
221        });
222}
223
224function loadNavMenuNews()
225{
226    if(navBarLoaded)
227    {
228        return false;
229    }
230
231    var category = $('#categoryName').val();
232    var countCategory = 'all';
233
234    if(typeof category == 'undefined')
235    {
236        category = $('#mainSite').val();
237    }
238
239    if(category == 'karmin') {
240        $('.all-news-link').attr('href', '/karmin/arhiva');
241        countCategory = 'karmin';
242    }
243    else if(category == 'supermen') {
244        $('.all-news-link').attr('href', '/supermen/arhiva');
245        countCategory = 'supermen';
246    }
247    else if(category == 'tv') {
248        $('.all-news-link').attr('href', '/tv/arhiva');
249        countCategory = 'tv';
250    }
251
252    $.get("/api/get-nav-menu-news/najnovi/" + category, {  }, function(data) {
253        $("#nav-menu-najnovi").html(data);
254        navBarLoaded = true;
255    });
256
257    $.get("/api/news-count/" + countCategory, {  }, function(data) {
258        $('.all-news-link').text('Денес ('+ data +')');
259        navBarLoaded = true;
260    });
261
262    setTimeout(function()
263    {
264        $.get("/api/get-nav-menu-news/najcitani/" + category, {  }, function(data) {
265            $("#nav-menu-najcitani").html(data);
266        });
267    }, 2000);
268}
269
270function loadRelatedGalleriesInArchive(category)
271{
272    $.get("/api/get-archive-related-galleries/" + category, {  }, function(data) {
273        $("#archive_related_galleries").html(data);
274    });
275}
276
277function eppFix()
278{
279    setTimeout(function()
280    {
281        var jumboHeight = $('.epp-jumbo').height();
282
283        if(jumboHeight > 0) {
284            // $('.epp-jumbo').css('margin-top', '20px');
285
286            if(mainSite == 'supermen') {
287                $('.epp-jumbo').css('margin-bottom', '30px');
288            } else if(mainSite == 'tv') {
289                $('.epp-jumbo').css('margin-bottom', '20px');
290            }
291        }
292
293        var floaterWidth = $('.epp-floater').width();
294
295        if(floaterWidth > 0) {
296            var windowWidth = $(window).width();
297            var floaterLeft = (windowWidth - floaterWidth) / 2;
298            $('.epp-floater').css('margin-left', floaterLeft);
299        }
300        else {
301            $(".epp-floater div").each(function()
302            {
303                floaterWidth = $(this).width();
304                if(floaterWidth > 10) {
305                    var windowWidth = $(window).width();
306                    var floaterLeft = (windowWidth - floaterWidth) / 2;
307                    $('.epp-floater').css('margin-left', floaterLeft);
308                    return false;
309                }
310            });
311        }
312    }, 1000);
313
314    setTimeout(function()
315    {
316        var jumboHeight = $('.epp-jumbo-top').height();   
317        if(jumboHeight < 80) {
318            $('header').removeClass('padding-top-310');
319        }
320    }, 400);
321}
322
323
324function closeBanner() {
325    
326    $('.top-vesti').css('padding-top', '0');
327    $('.single-page-top').css('padding-top', '0');
328    $('.avtomobili-top').css('padding-top', '0');
329    $('.erotika-top').css('padding-top', '0');
330    $('.planeta-top').css('padding-top', '0');
331    $('.foto-top').css('padding-top', '0');
332    $('.video-top').css('padding-top', '0');
333
334    $('.banner-container-jumbo-top').slideUp(900);
335
336    $('.header-bg-vesti').removeAttr('style');
337    $('.banner-container-jumbo-top').remove();
338    
339    var eppJumbo = $('.epp-jumbo').height();
340    $('.background-white').css('padding-top', '0'); 
341    if (eppJumbo > 80) {
342        $('.epp-jumbo').css('padding-top', '13px');
343    } else {
344        
345        $('body.theme-video .single-page').css('padding-top', '15px');
346        $('.addspacing').css('padding-top', '15px');
347        
348    }
349
350    $('header').removeClass('padding-top-310');
351    
352}

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.