PageSourceSearch

https://parogongroup.co.uk/wp-content/themes/parogon-group/assets/js/scripts.js

js parogongroup.co.uk collected 2026-09-24 13:18:41 UTC 8,981 bytes, 313 lines download raw bytes

1// Utility function to get array of queries
2function getUrlVars() {
3    var vars = [],
4        hash;
5    var hashes = window.location.href
6        .slice(window.location.href.indexOf("?") + 1)
7        .split("&");
8    for (var i = 0; i < hashes.length; i++) {
9        hash = hashes[i].split("=");
10        vars.push(hash[0]);
11        vars[hash[0]] = hash[1];
12    }
13    return vars;
14}
15
16jQuery(document).ready(function ($) {
17    anime({
18        targets: ".restaurant-grid .restaurant",
19        translateY: ["50px", "0"],
20        opacity: [0, 1],
21        duration: 400,
22        delay: anime.stagger(100),
23        easing: "easeInOutQuad",
24    });
25
26    // Runs when specified element has been scrolled past
27    //
28    // To use, do $(elementToChange).changeAfter(elementTrigger, classToChange)
29    $.fn.extend({
30        changeAfter: function (el, classChange) {
31            var elToChange = this;
32
33            function checkDistance() {
34                el = $(el);
35                if (el.length == 0) {
36                    return;
37                } else {
38                    var bottomOfEl = el.height() - $(document).scrollTop();
39                    if (bottomOfEl <= 0) {
40                        elToChange.addClass(classChange);
41                    } else {
42                        elToChange.removeClass(classChange);
43                    }
44                }
45                window.requestAnimationFrame(checkDistance);
46            }
47
48            window.requestAnimationFrame(checkDistance);
49        },
50    });
51
52    $(".hamburger").on("click", function () {
53        $(this).toggleClass("is-active");
54        toggleMenu();
55    });
56
57    function toggleMenu() {
58        var menuOpen = (function () {
59            return $("body").hasClass("menu-open");
60        })();
61        if (menuOpen) {
62            $("body").removeClass("menu-open");
63            $(".mobile-menu").removeClass("active");
64        } else if (!menuOpen) {
65            $("body").addClass("menu-open");
66            $(".mobile-menu").addClass("active");
67            animateMenu();
68        }
69    }
70
71    function animateMenu() {
72        anime({
73            targets: ".mobile-menu .menu-holder li",
74            translateY: ["20px", "0"],
75            opacity: [0, 1],
76            duration: 1200,
77            delay: anime.stagger(200),
78            easing: "easeInOutQuad",
79        });
80        anime({
81            targets: ".mobile-menu .book-table",
82            translateY: ["20px", "0"],
83            opacity: [0, 1],
84            duration: 1200,
85            delay: 500,
86            easing: "easeInOutQuad",
87        });
88        anime({
89            targets: ".mobile-menu .parogon-link",
90            translateY: ["20px", "0"],
91            opacity: [0, 1],
92            duration: 1200,
93            delay: 800,
94            easing: "easeInOutQuad",
95        });
96        anime({
97            targets: ".mobile-menu .icon",
98            translateY: ["20px", "0"],
99            opacity: [0, 1],
100            duration: 1200,
101            delay: anime.stagger(200, { start: 500, from: "center" }),
102            easing: "easeInOutQuad",
103        });
104    }
105
106    // Style woocommerce order select
107    $(".orderby").selectric();
108    // Style checkboxes
109    $("input").icheck({
110        checkboxClass: "icheckbox_square-grey",
111        radioClass: "iradio_square-grey",
112    });
113
114    // Add class to body once page loaded for fadein
115    $("body").addClass("is-loaded");
116
117    // default page banner animations
118    anime({
119        targets: ".default-banner h1",
120        translateY: ["-20%", "-50%"],
121        opacity: [0, 1],
122        duration: 1200,
123        delay: anime.stagger(600),
124        easing: "easeInOutQuad",
125    });
126    anime({
127        targets: ".default-banner a",
128        translateY: ["50px", "0"],
129        opacity: [0, 1],
130        duration: 1200,
131        delay: anime.stagger(600),
132        easing: "easeInOutQuad",
133    });
134    anime({
135        targets: ".default-banner .line",
136        height: [0, "180px"],
137        duration: 1200,
138        delay: anime.stagger(600),
139        easing: "easeInOutQuad",
140    });
141    anime({
142        targets: ".posts-line",
143        height: [0, "180px"],
144        duration: 1200,
145        delay: anime.stagger(600),
146        easing: "easeInOutQuad",
147    });
148
149    // rotate device
150    function checkOrientation() {
151        if (
152            /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
153                navigator.userAgent
154            )
155        ) {
156            if (window.orientation !== 0) {
157                $("body").addClass("is-mobile");
158            } else {
159                $("body").removeClass("is-mobile");
160            }
161        }
162    }
163
164    $(window).on("resize", function () {
165        checkOrientation();
166    });
167
168    // Footer Venues
169
170    $("#venues").on("change", function () {
171        changeVenue();
172    });
173
174    function changeVenue() {}
175
176    // Keep things square (changes height depending on width)
177    updateHeight(".restaurant-grid .restaurant");
178
179    updateHeight(".section-leaders .leader-list .leader", undefined, 1000);
180
181    updateHeight(".venue__image-holder", undefined, 1000);
182
183    function updateHeight(el, stopAt = 0, startAt) {
184        if ($(window).width() > stopAt && $(window).width() < startAt) {
185            $(el).height($(el).width());
186        } else {
187            $(el).height("");
188        }
189        requestAnimationFrame(function () {
190            updateHeight(el, stopAt, startAt);
191        });
192    }
193
194    // Detect item added to cart
195    $("body").on("added_to_cart", function () {
196        $(".floating-cart").addClass("has-items");
197    });
198
199    // Footer restaurant select field
200
201    $("#footer-venues").on("change", function () {
202        let venue = $(this).val();
203        $(".info-list .item").removeClass("active");
204        $(`[data-footer-venue="${venue}"]`).addClass("active");
205    });
206
207    $("#footer-venues").trigger("change");
208
209    // giving tabs
210    $(".giving-tabs .tab[data-giving-tab]").first().addClass("active");
211    $(".giving-tab-content[data-giving-tab]").first().addClass("active");
212
213    $(".giving-tabs .tab").on("click", function () {
214        $("[data-giving-tab].active").removeClass("active");
215
216        let tab = $(this).data("giving-tab");
217        $(`[data-giving-tab="${tab}"]`).addClass("active");
218    });
219
220    ///////////////////////////////
221    //*       Menu Dropdown      //
222    ///////////////////////////////
223
224    let menuDropdownRef = [];
225
226    class MenuDropdown {
227        constructor(trigger, el) {
228            this.trigger = trigger;
229            this.el = el;
230
231            menuDropdownRef.push(this);
232
233            $(this.trigger).on("click", (e) => {
234                if (window.innerWidth <= 1200) {
235                    e.preventDefault();
236                    this.open();
237                }
238            });
239
240            $(this.trigger).on("mouseenter", () => {
241                if (window.innerWidth > 1200) {
242                    this.open();
243                }
244            });
245
246            $(this.el).on("mouseleave", () => {
247                this.close();
248            });
249
250            $(this.el)
251                .find(".submenu-back")
252                .on("click", () => {
253                    this.close();
254                });
255        }
256
257        open() {
258            // Close all other references of the MenuDropdown class
259            menuDropdownRef.forEach((dropdown) => {
260                // if the current item in the loop is the menu we're trying to open, skip it
261                if (this === dropdown) return false;
262
263                dropdown.close();
264            });
265
266            if (!$(this.el).hasClass("active")) {
267                anime({
268                    targets: $(this.el).find(".nav-card").get(),
269                    translateY: ["50px", "0"],
270                    opacity: [0, 1],
271                    delay: anime.stagger(100),
272                    easing: "easeOutQuad",
273                });
274
275                anime({
276                    targets: $(this.el).find(".sub-menu__buttons li").get(),
277                    translateY: ["50px", "0"],
278                    opacity: [0, 1],
279                    delay: anime.stagger(100, { start: 500 }),
280                    easing: "easeOutQuad",
281                });
282            }
283
284            $(this.el).addClass("active");
285
286            $("header").addClass("dropdown-open");
287        }
288
289        close() {
290            $(this.el).removeClass("active");
291            $("header").removeClass("dropdown-open");
292        }
293    }
294
295    $(".sub-menu-trigger").each(function () {
296        const productsDropdown = new MenuDropdown(
297            this,
298            $(this).find(".sub-menu").first()
299        );
300    });
301
302    $(
303        ".mobile-menu .menu-holder .main-mobile-menu ul .menu-item-has-children > a"
304    ).on("click", function (e) {
305        e.preventDefault();
306        $(this).siblings(".sub-menu").stop(true, false).slideToggle();
307    });
308
309    $("#category-select").on("change", function () {
310        const category = $(this).val();
311        window.location = category;
312    });
313});

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.