PageSourceSearch

https://www.justfood.tv/js/common.js?1

js justfood.tv collected 2026-09-25 05:50:29 UTC 10,339 bytes, 362 lines download raw bytes

1isMobile = false;
2
3$(document).ready(function () {
4
5    if ($(window).width() <= 992) {
6        $(".menu-logo").addClass("visible");
7        isMobile = true;
8
9    }
10    handleDownloadAppBanner.init();
11    handleSideMenu();
12    handleSubMenu();
13
14    handlePhotoGallarySlider.init();
15	
16    handleVideoLandingGallerySlider.init();
17})
18
19$(window).resize(function () {
20
21    // $('.menu-main-container .menu-logo').css({ 'display': 'none' });
22
23    hideSideMenu();
24    handleSubMenu();
25
26    if ($(window).width() <= 992) {
27
28        $(".menu-logo").addClass("visible");
29
30        isMobile = true;
31
32    } else if ($(window).width() > 992) {
33
34        $(".menu-logo").removeClass("visible");
35
36        isMobile = false;
37
38    }
39
40    $("#sidemainMenu .menuContainer .main > li.sub-header").find("ul").hide();
41
42});
43
44$(window).scroll(function () {
45    windowScroll = $(window).scrollTop();
46    if ($(window).width() <= 992) {
47
48        $('.menu-main-container .menu-logo').addClass('visible')
49        //   $('#subMenu').css({ 'position': 'fixed', 'top': '0px' });
50    } else {
51
52        $('.menu-main-container .menu-logo').removeClass('visible')
53        //  $('#subMenu').removeAttr('style');
54    }
55    var mheight = ($("#topheader").height() + $("#header").height());
56    if (windowScroll > mheight) {
57        $('.menu-main-container').css({ 'position': 'fixed', 'top': '0' });
58        $('#subMenu').css({ 'top': '50px' });
59
60        //   $('#subMenu').css({ 'position': 'fixed', 'top': '0px' });
61    } else {
62        $('.menu-main-container').removeAttr('style');
63        $('#subMenu').css({ 'top': '0' });
64
65        //  $('#subMenu').removeAttr('style');
66    }
67});
68
69//functions
70utils = {
71    isMobile: function () {
72        return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
73    },
74    getHashValue: function () {
75        return window.location.hash.replace("#", "");
76    },
77    updateHashValue: function (val) {
78        if (history.pushState) {
79            history.pushState(null, null, '#' + val);
80        }
81        else {
82            location.hash = '#' + val;
83        }
84    },
85    isFacebookApp: function () {
86        var ua = navigator.userAgent || navigator.vendor || window.opera;
87        return (ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1);
88    },
89    getMobileOperatingSystem: function () {
90        var e = navigator.userAgent || navigator.vendor || window.opera;
91        return /windows phone/i.test(e) ? "Windows Phone" : /android/i.test(e) ? "Android" : /iPad|iPhone|iPod/.test(e) && !window.MSStream ? "iOS" : "unknown"
92    },
93    getOS: function () {
94
95        var userAgent = window.navigator.userAgent,
96            platform = window.navigator.platform,
97            macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'],
98            windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'],
99            iosPlatforms = ['iPhone', 'iPad', 'iPod'],
100            os = null;
101
102        if (macosPlatforms.indexOf(platform) !== -1) {
103            os = 'Mac OS';
104        } else if (iosPlatforms.indexOf(platform) !== -1) {
105            os = 'iOS';
106        } else if (windowsPlatforms.indexOf(platform) !== -1) {
107            os = 'Windows';
108        } else if (/Android/.test(userAgent)) {
109            os = 'Android';
110        } else if (!os && /Linux/.test(platform)) {
111            os = 'Linux';
112        }
113        return os;
114    },
115    getCookie: function (e) {
116        for (var i = e + "=", o = document.cookie.split(";"), t = 0; t < o.length; t++) {
117            for (var n = o[t]; " " === n.charAt(0) ;)
118                n = n.substring(1, n.length);
119            if (0 === n.indexOf(i))
120                return n.substring(i.length, n.length)
121        }
122        return null
123    },
124    setCookie: function (cname, cvalue, exdays) {
125        var d = new Date();
126        d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
127        var expires = "expires=" + d.toGMTString();
128        var path = "path=/";
129        document.cookie = cname + "=" + cvalue + "; " + expires + "; " + path;
130    },
131
132    getCookie: function (cname) {
133        var name = cname + "=";
134        var ca = document.cookie.split(';');
135        for (var i = 0; i < ca.length; i++) {
136            var c = ca[i].trim();
137            if (c.indexOf(name) == 0)
138                return c.substring(name.length, c.length);
139        }
140        return "";
141    }
142}
143handleDownloadAppBanner = {
144    options: {
145        domain: $(location).attr('host'),
146        expires: 7,
147        path: "/"
148    },
149    init: function () {
150        try {
151            handleDownloadAppBanner.setupDownloadAppBanner();
152        } catch (e) {
153            console.log("handleDownloadAppBanner >>" + e.message);
154        }
155    },
156    setupDownloadAppBanner: function () {
157
158        if (utils.isMobile() && !handleDownloadAppBanner.mobileAp
158pCheck()) {
159            var mOperator = utils.getMobileOperatingSystem();
160            if (mOperator == "Android") {
161                $("#downloadAppBanner .android-ctx").show();
162                handleDownloadAppBanner.handleCloseClick($("#downloadAppBanner .android-ctx .sb-close"));
163            } else if (mOperator == "iOS") {
164                $("#downloadAppBanner .iphone-ctx").show();
165                handleDownloadAppBanner.handleCloseClick($("#downloadAppBanner .iphone-ctx .sb-close"));
166
167            }
168        }
169
170    },
171    handleCloseClick: function (ele) {
172        $(ele).click(function () {
173            $(this).parent(".sb-container").hide();
174            handleDownloadAppBanner.mobileAppClose();
175        })
176    },
177    mobileAppClose: function () {
178        utils.setCookie("downloadApp", !0, handleDownloadAppBanner.options.expires)
179
180
181    },
182    mobileAppCheck: function () {
183        return utils.getCookie("downloadApp")
184    }
185
186}
187
188var handlePhotoGallarySlider = {
189
190    init: function () {
191
192        try {
193
194            if ($(".js-photo-gallary").length > 0) {
195
196                handlePhotoGallarySlider.setup();
197            }
198
199        } catch (e) {
200
201            console.log(e);
202        }
203    },
204    setup: function () {
205
206        $(".js-photo-gallary").slick({
207            autoplay: true,
208            infinite: true,
209            initialSlide: utils.getHashValue() != "" ? parseInt(utils.getHashValue()) : 0,
210            autoplaySpeed: 4000,
211            dots: false,
212            rtl: true,
213            speed: 300,
214            slidesToShow: 1,
215            adaptiveHeight: true
216        });
217
218        $(".js-photo-gallary").on('beforeChange', function (event, slick, currentSlide, nextSlide) {
219            utils.updateHashValue($(".js-photo-gallary").slick('slickCurrentSlide') + 1);
220
221            var pageURL = "";
222
223            pageURL = document.location.href.replace("http://justfood.nawa3em.com", "").toString();
224
225            //ga.push(['_trackPageview', pageURL]);
226            ga('send', 'pageview', pageURL);
227
228            _em.trackAjaxPageview(document.location.href);
229        });
230    }
231
232
233}
234
235var handleVideoLandingGallerySlider = {
236
237    init: function () {
238        try {
239            if ($(".js-video-gallary").length > 0) {
240                handleVideoLandingGallerySlider.setup();
241            }
242        } catch (e) {
243            console.log(e);
244        }
245    },
246	
247    setup: function () {
248        $(".js-video-gallary").slick({
249            autoplay: true,
250            infinite: true,
251            initialSlide: utils.getHashValue() != "" ? parseInt(utils.getHashValue()) : 0,
252            autoplaySpeed: 4000,
253            dots: false,
254            rtl: true,
255            speed: 300,
256            slidesToShow: 1,
257            adaptiveHeight: false
258        });
259    }
260
261}
262
263function hideSideMenu() {
264
265    $('#sidemainMenu').removeClass("nav-open");
266
267    $('#blackOverlay').fadeOut(250);
268
269}
270
271function handleSideMenu() {
272
273    //handle side menu
274
275    $('.menu-main-container a.menu-btn').click(function () {
276
277
278        $('#blackOverlay').fadeIn(250);
279
280        $('#sidemainMenu').addClass("nav-open");
281    });
282
283    $("#sidemainMenu .menuContainer .main > li.sub-header a").click(function (e) {
284
285        // e.preventDefault();
286
287
288        $(this).parent().find("ul").toggle();
289
290
291        //return false;
292    });
293
294    $('.side-menu-bar a.close').click(function () {
295
296        $('#blackOverlay').fadeOut(250);
297
298        $('#sidemainMenu').removeClass("nav-open");
299
300        $("#sidemainMenu .menuContainer .main > li.sub-header ul").hide();
301
302    });
303    $('#blackOverlay').click(function () {
304
305        $('#blackOverlay').fadeOut(250);
306
307        $('#sidemainMenu').removeClass("nav-open");
308
309        $("#sidemainMenu .menuContainer .main > li.sub-header ul").hide();
310    })
311}
312
313function handleSubMenu() {
314    //submenu
315    $('#mainMenu a').mouseover(function () {
316        if (!$(this).hasClass('active')) {
317            var submenu = $(this).attr('class');
318            $('#mainMenu a').removeClass('active');
319            $(this).addClass('active');
320            $('.submenu').css({ 'display': 'none' });
321            $('#' + submenu + 'Submenu').fadeIn(250);
322            //clearTimeout(subMenuTimeout);
323            //subMenuTimeout = setTimeout(hideSubmenu, 5000);
324        }
325    });
326
327    $('.submenu').mouseenter(function () {
328        clearTimeout(subMenuTimeout);
329    });
330
331    $('.submenu').mouseleave(hideSubmenu);
332
333    $('#header').mouseenter(hideSubmenu);
334}
335
336function hideSubmenu() {
337    $('.submenu').fadeOut(250);
338    $('#mainMenu a').removeClass('active');
339}
340
341
342
343
344
345
346
347
348
349
350//Moving logo to very top of page on mobile. While i hid it from 2nd row with css here: @media (max-width:767px) {
351$(window).on('resize', function(){
352	if (window.matchMedia('(max-width: 767px)').matches) {
353		$("#logo").prependTo("#topheader .container");
354		$("#logo").css({"position": "absolute", "height": "32px", "margin": "4px 14px"});
355		$("#logo img").css("height", "100%");
356	}else{//resetting logo on desktop
357		$("#logo").prependTo("#header .table .tableCell .container");
358		$("#logo").css({"position": "", "height": "", "margin": ""});
359		$("#logo img").css("height", "");
360	}
361});
362$(window).trigger('resize');

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.