PageSourceSearch

https://cheftonycanada.com/wp-content/themes/yidong/js/main.js?ver=299c2ae9d5fa99bc294cd202692389bf

js cheftonycanada.com collected 2026-10-04 05:17:56 UTC 17,670 bytes, 499 lines download raw bytes

1(function ($) {
2    //Preloader Setup:
3    //<![CDATA[
4    $(window).load(function () {
5        // makes sure the whole site is loaded
6
7        $("#status").fadeOut(); // will first fade out the loading animation
8        $("#preloader").delay(350).fadeOut("slow"); // will fade out the white DIV that covers the website.
9        $("body").delay(350).css({ overflow: "visible" });
10        // $('body').delay(350).css({'overflow':'hidden','position':'relative'});
11
12        //Re-enable mousewheel scroll, key down scroll, and mobile swipe on after spin loader is complete
13        enable_scroll();
14        $("body").unbind("touchmove");
15    });
16    //]]>
17
18    // left: 37, up: 38, right: 39, down: 40,
19    // spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36
20    var keys = [37, 38, 39, 40];
21
22    function preventDefault(e) {
23        e = e || window.event;
24        if (e.preventDefault) e.preventDefault();
25        e.returnValue = false;
26    }
27
28    function keydown(e) {
29        for (var i = keys.length; i--; ) {
30            if (e.keyCode === keys[i]) {
31                preventDefault(e);
32                return;
33            }
34        }
35    }
36
37    function wheel(e) {
38        preventDefault(e);
39    }
40
41    function disable_scroll() {
42        if (window.addEventListener) {
43            window.addEventListener("DOMMouseScroll", wheel, false);
44        }
45        window.onmousewheel = document.onmousewheel = wheel;
46        document.onkeydown = keydown;
47    }
48    function enable_scroll() {
49        if (window.removeEventListener) {
50            window.removeEventListener("DOMMouseScroll", wheel, false);
51        }
52        window.onmousewheel = document.onmousewheel = document.onkeydown = null;
53    }
54
55    //$dinmenu_height = $("#dinner_menu").show().outerHeight(true);
56    //$dimsummenu_height = $("#dimsum_menu").show().outerHeight(true);
57
58    $story_height = $(".story_content").outerHeight(true);
59    //$cur_menulist_height = $("div.is_menulist.active").outerHeight(true);
60    //$cur_menulist_height = $(".cur_menu").height();
61    //$visible_menu_height = $(".content.c_alldish:visible").outerHeight(true);
62
63    $(window).resize(function () {
64        if ($(window).width() >= 0) {
65            $("#mobile_nav").css("display", "none");
66        }
67
68        //console.log($("#dimsum_menu").prop('scrollHeight'));
69        //console.log($("#dimsum_menu").attr('height'));
70        //console.log($dimsummenu_height);
71
72        //$("#third .tabs_container").height($("#about_restaurant.cur_story").outerHeight(true));
73
74        if ($(".is_menulist").is(":visible")) {
75            $correct_height = $(".is_menulist.active").outerHeight(true);
76        } else {
77            $correct_height = $(".cur_menu").outerHeight(true);
78        }
79        //$("#second .tabs_container").delay(500).height($correct_height);
80        $("#second .tabs_container").height($correct_height);
81
82        //$("#third .tabs_container").height($story_height);
83        //$("#third .tabs_container").delay(500).height($(".cur_story").outerHeight(true));
84        $("#third .tabs_container").height($(".cur_story").outerHeight(true));
85    }); //end resize
86
87    console.log(jQuery.fn.jquery);
88
89    $(document).ready(function () {
90        //Disable mousewheel scroll, key down scroll, and mobile swipe on initial
91        disable_scroll();
92        $("body").bind("touchmove", function (e) {
93            e.preventDefault();
94        });
95
96        //   $(".tab-links").each(function () {
97        //       var $tabLinks = $(this).find("a");
98        //       var $tabsContainer = $(this).next(".tabs_container");
99
100        //       $tabLinks.click(function (e) {
101        //           e.preventDefault();
102
103        //           var target = $(this).attr("href");
104
105        //           // Hide all tabs within the current tab group
106        //           $tabsContainer.find(".content").removeClass("active").hide();
107        //           $(target).addClass("active").fadeIn();
108
109        //           // Remove active class from all links and add to the clicked one
110        //           $tabLinks.removeClass("active");
111        //           $(this).addClass("active");
112        //       });
113        //   });
114
115        $("#second a").click(function () {
116            //$("#second .tabs_container").height($dinmenu_height);
117        }); //end click
118
119        //Limit to set menu ONLY, use "#set_menu ul.dishes li"
120        //Otherwise, use "ul.dishes li"
121        $("ul.dishes li").click(function (e) {
122            //Disable clicking on circular dish items (Temp.):
123            e.preventDefault();
124
125            //////////////////////////////////////////////////
126            /*Disable clicking on circular dish items (Temp.):
127		
128		*/
129            var $this = $(this);
130
131            if ($this.parent().parent().hasClass("inside")) {
132                $("ul.insidenav a.all").trigger("click");
133                //e.stopPropagation(); // The img children inside li will not trigger the li event.
134            } else {
135                $this.parent().parent().addClass("inside");
136                $this.css("z-index", "5").addClass("active");
137                $this.parents(".content").find("ul.insidenav").fadeIn();
138                //$(this).siblings().css("visibility","hidden");
139                $this.siblings().css("opacity", "0");
140
141                var $cur_classname = $this.attr("class");
142                $cur_classname = $cur_classname.replace("active", "");
143                $(".inside_content ." + $cur_classname)
144                    .addClass("active")
145                    .fadeIn(600);
146
147                //$("#second .tabs_container").height($(".cur_menu .is_menulist.active").height());
148                $("#second .tabs_container").animate(
149                    { height: $(".cur_menu .is_menulist.active").height() },
150                    500
151                );
152            }
153        }); //end click
154
155        /*
156	//ul.dishes li.active img,ul.dishes li.active a
157	$("div.inside ul.dishes li").on( "click", function(e) {
158		e.stopPropagation(); // The img children inside li will not trigger the li event.
159		alert('adfasdf');
160		$("ul.insidenav a.all").trigger( "click" );
161	}); //end click
162*/
163
164        $("a.all").click(function () {
165            var $this = $(this);
166            var $section_el = $(this).parents("div.c_alldish");
167            var cur_dishthumb = $section_el.find(".dishes .active");
168
169            $this.parents(".insidenav").find(".greyout").removeClass("greyout");
170
171            $section_el.removeClass("inside");
172            $section_el
173                .find("ul.dishes li")
174                .css({
175                    "z-index": "1",
176                    opacity: "1",
177                    //,
178                    //"visibility": "visible"
179                })
180                .removeClass("active");
181
182            $section_el.find("ul.insidenav").fadeOut();
183            $section_el.find(".is_menulist").removeClass("active").fadeOut(600);
184
185            //$("ul.dishes li").css("z-index", "1").removeClass("active");
186            //$("ul.insidenav").fadeOut();
187            //$(".is_menulist").fadeOut(600);
188
189            //$("#second .tabs_container").delay(500).height($(".cur_menu").height());
190            $("#second .tabs_container").height($(".cur_menu").height());
191        }); //end click
192
193        $(".insidenav .next").click(function () {
194            var $this = $(this);
195            var $section_el = $this.parents("div.c_alldish");
196            var cur_dishlist = $section_el.find(".is_menulist.active");
197            var cur_dishthumb = $section_el.find(".dishes .active");
198
199            if (cur_dishthumb.is(":last-child")) {
200                $this.addClass("greyout");
201            } else {
202                $this
203                    .parents(".insidenav")
204                    .find(".greyout")
205                    .removeClass("greyout");
206                cur_dishlist.siblings().fadeOut(600);
207                cur_dishlist.fadeOut(600).removeClass("active");
208                cur_dishlist.next().fadeIn(600).addClass("active");
209
210                cur_dishthumb
211                    .css({
212                        opacity: "0",
213                        //,
214                        //"visibility": "hidden"
215                    })
216                    .removeClass("active");
217
218                cur_dishthumb
219                    .next()
220                    .css({
221                        opacity: "1",
222                        //,
223                        //"visibility": "visible"
224                    })
225                    .addClass("active");
226            }
227        }); //end click
228
229        $(".insidenav .prev").click(function () {
230            var $this = $(this);
231            var $section_el = $(this).parents("div.c_alldish");
232            var cur_dishlist = $section_el.find(".is_menulist.active");
233            var cur_dishthumb = $section_el.find(".dishes .active");
234
235            if (cur_dishthumb.is(":first-child")) {
236                $this.addClass("greyout");
237            } else {
238                $this
239                    .parents(".insidenav")
240                    .find(".greyout")
241                    .removeClass("greyout");
242                cur_dishlist.siblings().fadeOut(600);
243                cur_dishlist.fadeOut(600).removeClass("active");
244                cur_dishlist.prev().fadeIn(600).addClass("active");
245
246                cur_dishthumb.css("opacity", "0").removeClass("active");
247                cur_dishthumb.prev().css("opacity", "1").addClass("active");
248            }
249        }); //end click
250
251        /////////////////////////////////
252        //For Menu Tab Navigation Clicks:
253
254        //.tabs a.current, ul.dishes li.active
255        $("#second ul.menu_sub_nav li").on("click", function (event) {
256			event.preventDefault();
257            var $menuhref = $(this).children("a").attr("href");
258            //$menuhref = $menuhref.replace("#", "");
259
260            //Change #second height dynamically according to height of content:
261            var $container = $("#second .tabs_container");
262            $container.children().removeClass("cur_menu");
263            $container.children($menuhref).addClass("cur_menu");
264
265            //Change height from one pt to another:
266            //$("#second .tabs_container").height($(".cur_menu").height());
267            //Change height with gradual aniamtion:
268            $("#second .tabs_container").animate(
269                { height: $(".cur_menu").height() },
270                300
271            );
272
273            $("ul.insidenav a.all").trigger("click");
274        }); //end click
275
276        console.log($("#about_company").outerHeight());
277		
278        $("#third ul.menu_sub_nav li").on("click", function (event) {
279//             storySlider.reloadSlider();
280event.preventDefault();
281            var $menuhref = $(this).children("a").attr("href");
282
283            //Change #second height dynamically according to height of content:
284            var $container = $("#third .tabs_container");
285            $container.children().removeClass("cur_story");
286            $container.children($menuhref).addClass("cur_story");
287			
288			storySlider.reloadSlider();
289			
290            //Change height from one pt to another:
291            //$("#third .tabs_container").height($(".cur_story").height());
292            //Change height with gradual aniamtion:
293
294            setTimeout(function () {
295                console.log($(".cur_story").outerHeight());
296            }, 1000);
297		
298            $("#third .tabs_container").animate(
299                { height: $(".cur_story").height() },
300                300
301            );
302			
303        }); //end click
304
305        //   $("#about_chef div.bx-wrapper .bx-controls-direction a").on(
306        //       "click",
307        //       function () {
308        //           $("#third .tabs_container").animate(
309        //               { height: $(".cur_story").outerHeight(true) },
310        //               300
311        //           );
312        //       }
313        //   ); //end click
314
315        //$("#third .tabs_container").height($story_height);
316        //$("#second .tabs_container").height($("#second .tabs_container .cur_menu").outerHeight(true));
317        $("#third .tabs_container").height($(".cur_story").outerHeight(true));
318
319        var sections = $("section.waypoint");
320        var navigation_links = $("#nav a");
321
322        sections.waypoint({
323            handler: function (direction) {
324                var active_section;
325                active_section = $(this);
326                if (direction === "up") active_section = active_section.prev();
327
328                var active_link = $(
329                    '#nav a[href="#' + active_section.attr("id") + '"]'
330                );
331                navigation_links.removeClass("active");
332                active_link.addClass("active");
333            },
334            offset: 20,
335        });
336
337        // Sliders:
338        pagerSlider = $(".home_slider, .middle_slider, .testimonial").bxSlider({
339            auto: true,
340            mode: "fade",
341            pause: 5000,
342            speed: 1200,
343            swipeThreshold: 160,
344        });
345
346        storySlider = $(".story_slider").bxSlider({
347            auto: false,
348            pager: false,
349            infiniteLoop: false,
350            hideControlOnEnd: true,
351            controls: true,
352            mode: "fade",
353            responsive: false,
354            //adaptiveHeight: true,
355            pause: 3000,
356            speed: 800,
357            swipeThreshold: 160,
358        });
359
360        $(".bx-pager-item a").click(function (e) {
361            var i = $(this).index();
362
363            //cur_slide = $('.home_slider').bxSlider({);
364
365            pagerSlider.goToSlide(i);
366            pagerSlider.stopAuto();
367
368            restart = setTimeout(function () {
369                pagerSlider.startAuto();
370            }, 500);
371
372            return false;
373        });
374
375        //$(function() {
376        //////////////////////////////////////////////////
377        /*Disable (Temp.):	
378	// Smooth Scrolling Effect for menu items:
379	*/
380
381        $("li[title*=#]").click(function (e) {
382            //e.stopPropagation(); // The img children inside li will not trigger the li event.
383            //console.log(this);
384            //console.log(this.getAttribute("title"));
385
386            //if (location.hostname == this.hostname) {
387            //console.log(this.getAttribute("title"));
388
389            var target = this.getAttribute("title"); //#second
390
391            //console.log(target);
392
393            target = target.length
394                ? target
395                : $("[name=" + this.hash.slice(1) + "]");
396            if (target.length) {
397                $("html,body").animate(
398                    {
399                        scrollTop: $(target).offset().top,
400                    },
401                    1000
402                );
403                return false;
404            }
405            //} //end if
406        }); //end click
407
408        // Smooth Scrolling Effect:
409        $(
410            'a[href*="#"]:not([href="#"],[href="#dimsum_menu"],[href="#dinner_menu"],[href="#set_menu"],[href="#about_chef"],[href="#about_restaurant"],[href="#about_company"],[href="#about_others"])'
411        ).click(function (e) {
412            if (
413                location.pathname.replace(/^\//, "") ==
414                    this.pathname.replace(/^\//, "") &&
415                location.hostname == this.hostname
416            ) {
417                var target = $(this.hash);
418                target = target.length
419                    ? target
420                    : $("[name=" + this.hash.slice(1) + "]");
421                if (target.length) {
422                    $("html,body").animate(
423                        {
424                            scrollTop: target.offset().top,
425                        },
426                        1000
427                    );
428                    return false;
429                }
430            }
431        }); //end click
432
433        //}); //closure
434
435        $(".menutoggle").click(function () {
436            $("#mobile_nav").slideToggle();
437        });
438
439        $("#mobile_nav li a").click(function () {
440            $("#mobile_nav").hide();
441        });
442    }); //end ready
443
444    $(window).scroll(function () {
445        var scroll = $(window).scrollTop();
446        var down_nav = $("a#down");
447
448        if (scroll >= 30) {
449            $("#nav_wrapper").addClass("smaller");
450            $("#mobile_bar").addClass("scroll");
451        } else {
452            $("#nav_wrapper").removeClass("smaller");
453            $("#mobile_bar").removeClass("scroll");
454        }
455        /*
456	if (scroll >= 1500 && scroll<=2000) {
457        $('#nav_wrapper').addClass('whitebg');
458    } else {
459        $('#nav_wrapper').removeClass('whitebg');
460    }
461	
462	if (scroll >= 1200 && scroll<=1700) {
463        $('#nav_wrapper').addClass('disappear');
464    } else {
465        $('#nav_wrapper').removeClass('disappear');
466    }*/
467
468        //console.log(scroll);
469
470        if (scroll > 0) {
471            down_nav.attr("href", "#second");
472            $("#nav_wrapper").removeClass("whitebg");
473            $("a#down").removeClass("go_up");
474        }
475        if (scroll > 700) {
476            down_nav.attr("href", "#third");
477            $("#nav_wrapper").removeClass("whitebg");
478            $("a#down").removeClass("go_up");
479        }
480        if (scroll > 1680) {
481            $("#nav_wrapper").addClass("whitebg");
482        }
483        if (scroll > 2165) {
484            down_nav.attr("href", "#fourth");
485
486            $("a#down").removeClass("go_up");
487        }
488        if (scroll > 2545) {
489            $("#nav_wrapper").removeClass("whitebg");
490            $("a#down").removeClass("go_up");
491        }
492        if (scroll > 3045) {
493            down_nav.attr("href", "#first");
494            $("a#down").addClass("go_up");
495            $("#nav_wrapper").removeClass("whitebg");
496        }
497    }); //end scroll
498})(jQuery);
499//end closure

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.