PageSourceSearch

https://www.iway.ch/wp-content/plugins/megamenu-pro/assets/public.js?ver=2.5

js iway.ch collected 2026-09-24 09:40:40 UTC 32,156 bytes, 878 lines download raw bytes

1/*jslint browser: true, white: true */
2/*global console,jQuery,megamenu,window,navigator*/
3
4/**
5 * EDD Ajax Cart
6 */
7(function($) {
8    "use strict";
9
10    $(function() {
11        $('body').on('edd_cart_item_added', function(event, data) {
12            $('.mega-menu-edd-cart-total').html(data.total);
13            $('.mega-menu-edd-cart-count').html(data.cart_quantity);
14        });
15    });
16
17    $(".max-mega-menu").on("after_mega_menu_init", function() {
18        $('li.mega-menu-megamenu').on('open_panel', function() {
19            // reset default
20            var placeholder = $(this).closest(".mega-menu-megamenu").find(".widget_maxmegamenu_image_swap img.mega-placeholder");
21            var default_src = placeholder.attr('data-default-src');
22            var default_alt = placeholder.attr('data-default-alt');
23            placeholder.attr('src', default_src);
24            placeholder.attr('alt', default_alt);
25
26            // preload
27            $('.mega-sub-menu [data-image-swap-url]', $(this) ).not(['data-preloaded']).each( function() {
28                $('<img/>')[0].src = $(this).attr('data-image-swap-url');
29                $(this).attr('data-preloaded', 'true');
30            });
31        });
32
33        if ( typeof $.fn.hoverIntent !== "function" ) {
34            return;
35        }
36        
37        $('.mega-sub-menu [data-image-swap-url]').hoverIntent({
38            over: function () {
39                var placeholder = $(this).closest(".mega-menu-megamenu").find(".widget_maxmegamenu_image_swap img.mega-placeholder");
40                var new_src = $(this).attr('data-image-swap-url');
41                var new_alt = $(this).is("[data-image-swap-alt]") ? $(this).attr('data-image-swap-alt') : "";
42                placeholder.attr('src', new_src);
43                placeholder.attr('alt', new_alt);
44            },
45            out: function() {}
46        });
47    });
48
49})(jQuery);
50
51/**
52 * Sliding Panels (horizontal) mobile submenu helpers.
53 */
54(function($) {
55    "use strict";
56
57    var menuSupportsSideToSide = function($menu) {
58        return $menu.attr("data-mobile-direction") === "horizontal" &&
59            $menu.attr("data-effect-mobile").indexOf("slide_") === 0;
60    };
61
62    var getParentTitleForBackLink = function($item) {
63        var $link = $item.children("a.mega-menu-link").first();
64        var $titleEl = $link.find(".mega-menu-title").first();
65        var $clone;
66
67        if ($titleEl.length) {
68            $clone = $titleEl.clone();
69            $clone.find(".mega-menu-badge").remove();
70        } else {
71            $clone = $link.clone();
72            $clone.find(".mega-indicator, .mega-menu-description, .mega-menu-badge").remove();
73        }
74
75        return $.trim($clone.text());
76    };
77
78    var getBackLabel = function($menu, parentTitle) {
79        var template = $menu.attr("data-mobile-back-text") || "{parent_title}";
80        var safeParentTitle = parentTitle || "";
81
82        if (template.indexOf("{parent_title}") !== -1) {
83            return template.split("{parent_title}").join(safeParentTitle);
84        }
85
86        return template;
87    };
88
89    var addBackLinks = function($menu) {
90        var secondClick = $menu.attr("data-second-click");
91
92        // Top-level non-tabbed panels; tabbed panels (treated as a single panel);
93        // tabbed sub-panels (each tab's children); flyout nested panels (any depth).
94        var $targets = $("> li.mega-menu-item-has-children:not(.mega-menu-tabbed) > ul.mega-sub-menu", $menu).add(
95            $("> li.mega-menu-tabbed > ul.mega-sub-menu", $menu)
96        ).add(
97            $("li.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item-has-children > ul.mega-sub-menu", $menu)
98        ).add(
99            $("li.mega-menu-flyout li.mega-menu-item-has-children > ul.mega-sub-menu", $menu)
100        );
101
102        $targets.each(function() {
103            if ($("> li.mega-mobile-back", this).length) {
104                return;
105            }
106
107            var $submenu = $(this);
108            var $item = $submenu.parent("li.mega-menu-item-has-children");
109
110            if ($item.hasClass("mega-collapse-children")) {
111                return;
112            }
113
114            var $parentLink = $item.children("a.mega-menu-link").first();
115            var isLinkDisabled = $parentLink.hasClass("mega-disable-link");
116            var parentHref = $parentLink.attr("href");
117            var useFollowLink = secondClick === "go" && !isLinkDisabled && !!parentHref && parentHref !== "#";
118            var parentTitle = getParentTitleForBackLink($item);
119            var backLabel = getBackLabel($menu, parentTitle);
120            var $row = $("<li class='mega-mobile-back'></li>");
121            var $parentDescription = $parentLink.find(".mega-menu-description").first();
122
123            var $iconBtn = $("<button type='button' class='mega-mobile-back-link'></button>");
124            $iconBtn.append('<span class="mega-mobile-back-link-icon" aria-hidden="true"></span>');
125
126            var $textEl = useFollowLink
127                ? $("<a class='mega-mobile-back-link-text'></a>").attr("href", parentHref)
128                : $("<span class='mega-mobile-back-link-text'></span>");
129
130            if ($parentDescription.length) {
131                var $group = $('<span class="mega-description-group"></span>');
132                $group.append($('<span class="mega-menu-title"></span>').text(backLabel));
133                $group.append($parentDescription.clone());
134                $textEl.append($group);
135            } else {
136                $textEl.text(backLabel);
137            }
138
139            if (useFollowLink) {
140                $iconBtn.attr("aria-label", backLabel);
141                $row.append($iconBtn).append($textEl);
142            } else {
143                $row.append($iconBtn.append($textEl));
144            }
145            $submenu.prepend($row);
146        });
147    };
148
149    var removeBackLinks = function($menu) {
150        $menu.find("li.mega-mobile-back").remove();
151    };
152
153    /**
154     * Core sets data("view") to "desktop" | "mobile". Switch events fire before
155     * after_mega_menu_init, so apply once here after listeners are bound.
156     */
157    var syncMobileBackLinks = function($menu) {
158        if (!menuSupportsSideToSide($menu)) {
159            return;
160        }
161
162        if ($menu.data("view") === "mobile") {
163            addBackLinks($menu);
164        } else {
165            removeBackLinks($menu);
166        }
167    };
168
169    $(".max-mega-menu").on("after_mega_menu_init", function() {
170        var $menu = $(this);
171
172        if (!menuSupportsSideToSide($menu)) {
173            return;
174        }
175
176        $menu.on("mmm:switchToDesktop.mmmMobileBack", function() {
177            removeBackLinks($menu);
178        });
179
180        $menu.on("mmm:switchToMobile.mmmMobileBack", function() {
181            addBackLinks($menu);
182        });
183
184        syncMobileBackLinks($menu);
185
186        $menu.on("click.megamenu", ".mega-mobile-back-link", function(e) {
187            e.preventDefault();
188            e.stopPropagation();
189
190            var $submenu = $(this).closest("ul.mega-sub-menu");
191            var $parentItem = $submenu.parent("li.mega-menu-item-has-children");
192            var $parentLink = $parentItem.children("a.mega-menu-link").first();
193            var menuPlugin = $menu.data("maxmegamenu");
194
195            menuPlugin.hidePanel($parentLink, false);
196
197            $parentLink.trigger("focus");
198        });
199    });
200})(jQuery);
201
202/**
203 * Searchbox jQuery plugin
204 */
205(function($) {
206    "use strict";
207
208    $.maxmegamenu_searchbox = function(form, options) {
209
210        var plugin = this;
211        var form = $(form);
212        var $menu = form.parents('.max-mega-menu');
213        var $wrap = $menu.parent();
214        var breakpoint = $menu.attr('data-breakpoint');
215        var input = $('input[type=text]', form);
216        var icon = $('.search-icon', form);
217
218        plugin.isDesktopView = function() {
219            return Math.max(window.outerWidth, $(window).width()) >= breakpoint; // account for scrollbars
220        };
221
222        plugin.monitorView = function() {
223            if (typeof $menu.data("view") === 'undefined') {
224                if (plugin.isDesktopView()) {
225                    $menu.data("view", "desktop");
226                } else {
227                    $menu.data("view", "mobile");
228                }
229            }
230
231            plugin.checkWidth();
232
233            $(window).on('resize', function() {
234                plugin.checkWidth();
235            });
236        };
237
238        plugin.checkWidth = function() {
239            var expanding_search = $("li.mega-menu-item .mega-search.expand-to-left input[type=text], li.mega-menu-item .mega-search.expand-to-right input[type=text]", $menu);
240
241            if ( $menu.data("view") === "mobile" ) {
242                var placeholder = expanding_search.attr('data-placeholder');
243                expanding_search.attr('placeholder', placeholder);
244                expanding_search.attr('aria-hidden', 'false');
245            }
246
247            if ( $menu.data("view") === "desktop" ) {
248                expanding_search.attr('placeholder', '');
249                expanding_search.attr('aria-hidden', 'true');
250            }
251        };
252
253        plugin.close_search = function(moveFocus = true) {
254            $menu.triggerHandler("mmm:closeSearch");
255            input.val("");
256            input.attr('placeholder', '');
257            input.attr('tabindex', '-1');
258            input.attr('aria-hidden', 'true');
259            form.removeClass('mega-search-open');
260            form.addClass('mega-search-closed');
261            icon.attr('aria-expanded', 'false');
262
263            if (moveFocus) {
264                icon.trigger("focus");
265            }
266        }
267
268        plugin.open_search = function() {
269            $menu.triggerHandler("mmm:openSearch");
270            input.attr('placeholder', input.attr('data-placeholder'));
271            input.attr('tabindex', '0');
272            input.attr('aria-hidden', 'false');
273            form.removeClass('mega-search-closed');
274            form.addClass('mega-search-open');
275            icon.attr('aria-expanded', 'true');
276            input.trigger("focus");
277        }
278
279        plugin.detect_background_click = function() {
280            var dragging = false;
281
282            $(document).on({
283                "touchmove": function(e) { dragging = true; },
284                "touchstart": function(e) { dragging = false; }
285            });
286
287            $(document).on("click touchend", function(e) { // hide menu when clicked away from
288                if ( form.parent().hasClass('mega-static') ) {
289                    return;
290                }
291                if ( ! dragging && ! $(e.target).closest(".max-mega-menu li").length && ! $(e.target).closest(".mega-menu-toggle").length ) {
292                    plugin.close_search(false);
293                }
294                dragging = false;
295            });
296        }
297
298        plugin.init_replacements_search = function() {
299            if ( $menu.data("view") === "mobile" ) {
300                input.attr('tabindex', '0');
301
302                $(".search-icon", $menu).on('click', function(e) {
303                    $(this).parents(".mega-search").submit();
304                });
305            }
306
307            if ( $menu.data("view") === "desktop" ) {
308                input.on('blur', function(e) {
309                    if ( $menu.parent().hasClass("mega-keyboard-navigation") && input.val() == '' && ! form.parent().hasClass('mega-static') && form.hasClass('mega-search-open') ) {
310                        plugin.close_search();
311                    }
312                });
313
314                icon.on('keypress click', function(e) {
315                    var enter_key = 13;
316                    var space_key = 32;
317
318                    if (e.which === enter_key || e.which === space_key || e.type === 'click') {
319                        e.preventDefault();
320
321                        if (form.parent().hasClass('mega-static') ) {
322                            form.submit();
323                            return;
324                        }
325
326                        if ( input.val() != '' ) {
327                            form.submit();
328                            return;
329                        }
330
331                        if ( form.hasClass('mega-search-open') ) {
332                            plugin.close_search();
333                            return;
334                        }
335
336                        if ( form.hasClass('mega-search-closed') ) {
337                            plugin.open_search();
338                            return;
339                        }
340                    };
341                });
342
343                icon.on('blur', function() {
344                    if ( ! form.parent().hasClass('mega-static') && form.hasClass('mega-search-open') && $wrap.hasClass('mega-keyboard-navigation') ) {
345                        setTimeout(function(){
346                            if ( form.find(":focus").length == 0 ) {
347                                plugin.close_search(false);
348                            }
349                        }, 100);
350                    }
351                });
352
353                $menu.on('keydown', function(e) {
354                    var escape_key = 27;
355
356                    if (e.which === escape_key) {
357                        if (! form.parent().hasClass('mega-static') && form.hasClass('mega-search-open') ) {
358                            plugin.close_search();
359                            return;
360                        }
361                    }
362                });
363            }
364        };
365
366        plugin.monitorView();
367        plugin.init_replacements_search();
368        plugin.detect_background_click();
369    };
370
371    $.fn.maxmegamenu_searchbox = function(options) {
372        return this.each(function() {
373            if (undefined === $(this).data('maxmegamenu_searchbox')) {
374                var plugin = new $.maxmegamenu_searchbox(this, options);
375                $(this).data('maxmegamenu_searchbox', plugin);
376            }
377        });
378    };
379
380    $(".max-mega-menu").on("after_mega_menu_init", function() {
381        $(".mega-search", this).maxmegamenu_searchbox();
382    });
383})(jQuery);
384
385
386/**
387 * Searchbox jQuery plugin
388 */
389(function($) {
390    "use strict";
391
392    $.maxmegamenu_toggle_searchbox = function(form, options) {
393
394        var plugin = this;
395        var form = $(form);
396        var $wrap = form.parents('.mega-menu-wrap');
397        var input = $("input[type=text]", form);
398        var icon = $(".search-icon", form);
399        
400        plugin.open_search = function() {
401            input.attr('placeholder', input.attr('data-placeholder'));
402            form.removeClass('mega-search-closed');
403            form.addClass('mega-search-open');
404        }
405
406        plugin.close_search = function() {
407            input.attr('placeholder', '');
408            form.removeClass('mega-search-open');
409            form.addClass('mega-search-closed');
410        }
411
412        plugin.init_toggle_search = function() {
413
414            input.val("");
415
416            input.on('focus', function(e) {
417                if (! form.parent().hasClass('mega-static') && form.hasClass('mega-search-closed') && $wrap.hasClass('mega-keyboard-navigation') ) {
418                    plugin.open_search();
419                }
420            });
421
422            input.on('blur', function(e) {
423                if ( ! form.parent().hasClass('mega-static') && form.hasClass('mega-search-open') && $wrap.hasClass('mega-keyboard-navigation') ) {
424                    plugin.close_search();
425                }
426            });
427
428            icon.on('click', function(e) {
429                if (form.hasClass('static') ) {
430                    if ( input.attr('required') == 'required' && input.val() == "" ) {
431                        return;
432                    } else {
433                        form.submit();
434                    }
435                } else if (form.hasClass('mega-search-closed')) {
436                    input.focus();
437                    plugin.open_search();
438                } else if ( input.val() == '' ) {
439                    plugin.close_search();
440                } else {
441                    form.submit();
442                }
443            });
444
445        };
446
447        plugin.init_toggle_search();
448
449    };
450
451    $.fn.maxmegamenu_toggle_searchbox = function(options) {
452        return this.each(function() {
453            if (undefined === $(this).data('maxmegamenu_toggle_searchbox')) {
454                var plugin = new $.maxmegamenu_toggle_searchbox(this, options);
455                $(this).data('maxmegamenu_toggle_searchbox', plugin);
456            }
457        });
458    };
459
460    $(function() {
461        $(".mega-menu-toggle .mega-search").maxmegamenu_toggle_searchbox();
462    });
463})(jQuery);
464
465/**
466 * Sticky jQuery Plugin
467 */
468(function($) {
469
470    "use strict";
471
472    $.maxmegamenu_sticky = function(menu, options) {
473        var plugin = this;
474        var $menu = $(menu);
475        var $wrap = $menu.parent();
476        var breakpoint = $menu.attr('data-breakpoint');
477        var sticky_on_mobile = $menu.attr('data-sticky-mobile');
478        var sticky_on_desktop = $menu.attr('data-sticky-desktop');
479        var sticky_expand = $menu.attr('data-sticky-expand');
480        var sticky_expand_mobile = $menu.attr('data-sticky-expand-mobile');
481        var sticky_offset = isNaN(parseInt($menu.attr('data-sticky-offset'))) ? 0 : parseInt($menu.attr('data-sticky-offset'));
482        var sticky_hide_until_scroll_up = $menu.attr('data-sticky-hide');
483        var sticky_hide_until_scroll_up_tolerance = isNaN(parseInt($menu.attr('data-sticky-hide-tolerance'))) ? 0 : parseInt($menu.attr('data-sticky-hide-tolerance'));
484        var sticky_hide_until_scroll_up_offset = isNaN(parseInt($menu.attr('data-sticky-hide-offset'))) ? 0 : parseInt($menu.attr('data-sticky-hide-offset'));
485        var sticky_transition = $menu.attr('data-sticky-transition');
486        var sticky_menu_offset_top;
487        var sticky_menu_offset_left;
488        var sticky_menu_width;
489        var sticky_menu_width_round_up;
490        var sticky_menu_height;
491        var is_stuck = false;
492        var admin_bar_height = 0;
493        var last_scroll_top = 0;
494        var saved_scroll_top = 0;
495        var is_vertical = $menu.hasClass('mega-menu-vertical') || $menu.hasClass('mega-menu-accordion');
496
497        plugin.isDesktopView = function() {
498            var width = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
499            return width > breakpoint;
500        };
501
502        var sticky_hide_until_scroll_up_enabled = function() {
503            return $menu.hasClass('mega-menu-horizontal') && sticky_hide_until_scroll_up == "true";
504        }
505
506        var sticky_enabled = function() {
507            if ( plugin.isDesktopView() ) {
508                return sticky_on_desktop === 'true';
509            } else {
510                return sticky_on_mobile === 'true';
511            }
512
513            return false;
514        };
515
516        plugin.calculate_menu_position = function() {
517            sticky_menu_offset_top = $wrap.offset().top;
518
519            if ($('body').hasClass('admin-bar') && $("#wpadminbar").is(":visible") && $("#wpadminbar").css('top') == '0px' && $("#wpadminbar").css('position') == 'fixed') {
520                admin_bar_height = $('#wpadminbar').height();
521                sticky_menu_offset_top = sticky_menu_offset_top - admin_bar_height;
522            }
523
524            if (sticky_offset < 0) {
525                sticky_menu_offset_top = sticky_menu_offset_top + sticky_offset;
526            } else {
527                sticky_menu_offset_top = sticky_menu_offset_top - sticky_offset;
528            }
529
530            sticky_menu_offset_left = $menu.parent().offset().left;
531            sticky_menu_width = window.getComputedStyle($wrap[0]).width;
532            sticky_menu_width_round_up = Math.ceil(parseFloat(sticky_menu_width));
533            sticky_menu_height = $wrap.height();
534        };
535
536        plugin.stick_menu = function() {
537            is_stuck = true;
538
539            var total_offset = parseInt(admin_bar_height, 10) + parseInt(sticky_offset, 10);
540
541            if (sticky_offset < 0) {
542                total_offset = parseInt(admin_bar_height, 10);
543            }
544
545            var placeholder = $("<div />").addClass("mega-sticky-wrapper").css({
546                'height' : sticky_menu_height + 'px',
547                'position' :'static'
548            });
549
550            $wrap.addClass('mega-sticky').wrap(placeholder).css({
551                'margin-top' : total_offset + 'px'
552            });
553
554            $("body").addClass($menu.attr("id") + "-mega-sticky");
555
556            $menu.css({
557                'max-width' : sticky_menu_width_round_up + 'px'
558            });
559
560            if (sticky_menu_offset_left > 0) {
561                $menu.css({
562                    'margin-left' : sticky_menu_offset_left + 'px'
563                });
564            }
565
566            if (is_vertical || sticky_expand === 'false') {
567                $wrap.css({
568                    'margin-left' : '0',
569                    'margin-right' : '0',
570                    'width' : sticky_menu_width_round_up + 'px',
571                    'left' : sticky_menu_offset_left + 'px'
572                });
573
574                $menu.css({
575                    'margin-left' : '0'
576                });
577            }
578
579            if ( $(window).width() <= breakpoint ) {
580                $wrap.css({
581                    'width' : sticky_menu_width_round_up + 'px'
582                });
583
584                if (sticky_expand_mobile === 'true') {
585                   $wrap.css({
586                        'margin-left' : '',
587                        'margin-right' : '',
588                        'width' : '',
589                        'left' : ''
590                    });
591
592                    $menu.css({
593                        'max-width' : '',
594                        'margin-left' : '',
595                        'width' : '',
596                        'left' : ''
597                    });
598                }
599            }
600
601            $wrap.delay(0).queue(function(next){
602                $(this).addClass('mega-stuck');
603                next();
604            });
605        };
606
607        plugin.unstick_menu = function(doing_resize) {
608            doing_resize = doing_resize || false;
609            is_stuck = false;
610            
611            $wrap.removeClass('mega-sticky').removeClass('mega-hide').css({
612                'margin' : '',
613                'width' : '',
614                'left': ''
615            });
616
617            $("body").removeClass($menu.attr("id") + "-mega-sticky");
618
619            if ( ! doing_resize ) { // this class is used for the height transition, do not remove it if we are simply resizing the window
620                $wrap.delay(0).queue(function(next){
621                    $(this).removeClass('mega-stuck');
622                    next();
623                });
624            }
625
626            $menu.css({
627                'margin-left' : '',
628                'max-width' : '',
629                'left' : '',
630                'width' : ''
631            });
632            
633            if ( $(window).width() <= breakpoint ) {
634                $menu.data('maxmegamenu').toggleBarForceWidth();
635            }
636
637            if (sticky_transition == 'true' && ! doing_resize ) {
638                var delay = 250; // allows the transiton to complete before unwrapping the menu
639            } else {
640                var delay = 0;
641            }
642
643            $wrap.delay(delay).queue(function(next){
644                $(this).unwrap();
645                next();
646            });
647        };
648
649        plugin.mega_sticky_on_scroll = function(){
650            if ( ! sticky_enabled() ) {
651                return;
652            }
653
654            var scroll_top = $(window).scrollTop();
655
656            if (scroll_top > sticky_menu_offset_top) {
657                if (!is_stuck) {
658                    plugin.stick_menu();
659                }
660            } else {
661                if (is_stuck) {
662                    plugin.unstick_menu();
663                }
664            }
665        };
666
667        var mega_hide_on_scroll_up = function() {
668            if (sticky_hide_until_scroll_up_enabled()) {
669
670                if ( $menu.data("view") === "mobile" && $('.mega-menu-toggle', $wrap).hasClass('mega-menu-open') ) {
671                    return;
672                }
673
674                var scroll_top = $(window).scrollTop();
675                
676                if ( scroll_top < sticky_hide_until_scroll_up_offset ) {
677                    $wrap.removeClass('mega-hide');
678                    $("body").removeClass($menu.attr("id") + "-mega-hide");
679                }
680                
681                saved_scroll_top = last_scroll_top;
682
683                if (scroll_top < last_scroll_top) {
684                    // scroll up
685                    if (saved_scroll_top - scroll_top > sticky_hide_until_scroll_up_tolerance) {
686                        $wrap.removeClass('mega-hide');
687                        $("body").removeClass($menu.attr("id") + "-mega-hide");
688                    }
689                } else {
690                    // scroll down
691                    if (is_stuck && scroll_top - saved_scroll_top > sticky_hide_until_scroll_up_tolerance) {
692                        $wrap.addClass('mega-hide');
693                        $("body").addClass($menu.attr("id") + "-mega-hide");
694                    }
695                }
696
697                last_scroll_top = scroll_top;
698            }
699        }
700
701        plugin.mega_sticky_on_resize = function() {
702            if ($('input', $wrap).is(':focus')) {
703                return;
704            }
705
706            if ( sticky_enabled() ) {
707                if (is_stuck) {
708                    plugin.unstick_menu(true);
709                    plugin.calculate_menu_position();
710                    plugin.stick_menu();
711                } else {
712                    plugin.calculate_menu_position();
713                    plugin.mega_sticky_on_scroll();
714                }
715            } else {
716                if (is_stuck) {
717                    plugin.unstick_menu();
718                }
719            }
720        };
721
722        plugin.init = function() {
723            plugin.calculate_menu_position();
724            plugin.mega_sticky_on_scroll();
725
726            $('.mega-menu-accordion li.mega-menu-item').on('open_panel', function() {
727                plugin.calculate_menu_position();
728            });
729
730            var $window = $(window);
731
732            $window.scroll(function() {
733                 plugin.mega_sticky_on_scroll();
734                 mega_hide_on_scroll_up();
735            });
736
737            var windowWidth = $window.width();
738            var resizeTimer;
739
740            $window.on('resize', function() {
741                clearTimeout(resizeTimer);
742                resizeTimer = setTimeout(function(){    
743                    windowWidth = $window.width();
744                    plugin.mega_sticky_on_resize();
745                }, 100);
746            });
747        };
748
749        plugin.init();
750    };
751
752    $.fn.maxmegamenu_sticky = function(options) {
753
754        return this.each(function() {
755            if (undefined === $(this).data('maxmegamenu_sticky')) {
756                var plugin = new $.maxmegamenu_sticky(this, options);
757                $(this).data('maxmegamenu_sticky', plugin);
758            }
759        });
760
761    };
762
763    $(window).on('load', function (e) {
764        $(".max-mega-menu[data-sticky-enabled]").maxmegamenu_sticky();
765    });
766
767})(jQuery);
768
769/**
770 * Handle tabbed functionality
771 */
772(function($) {
773    $(function() {
774
775        var calculate_tabbed_sub_menu_widths = function( menu_item ) {
776            var menu = menu_item.parents('.max-mega-menu');
777
778            if( $(menu.attr('data-panel-inner-width')).length > 0 ) {
779                if ( menu.data("view") === "desktop" ) {
780                    $('> ul.mega-sub-menu', menu_item).each(function() {
781                        var tab_content = $(this);
782                        var parent_submenu_content_width = parseInt(tab_content.width());
783                        var parent_submenu_left_padding = parseInt(tab_content.css('paddingLeft'));
784                        var tabs_width = $(this).find('a.mega-menu-link').first().outerWidth();
785
786                        $('> li.mega-menu-item > ul.mega-sub-menu', $(this)).each(function() {
787                            $(this).css('width', parent_submenu_content_width - tabs_width + 'px');
788                            $(this).css('left', parent_submenu_left_padding + tabs_width + 'px'); 
789                        });
790                    });
791                } else {
792                    $('> ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu', menu_item).each(function() {
793                        $(this).css('width', '');
794                        $(this).css('left', ''); 
795                    });
796                }
797            }
798        }
799
800        var calculate_tabbed_sub_menu_heights = function( menu_item ) {
801
802            var menu = menu_item.parents('.max-mega-menu');
803            var max_height = 0;
804
805            if ( menu.data("view") === "desktop" ) {
806
807                $('> ul.mega-sub-menu', menu_item).css('minHeight', '');
808                
809                $('> ul.mega-sub-menu > li.mega-menu-item > ul.mega-sub-menu', menu_item).each(function() {
810                    var tab_content = $(this);
811                    var this_height = parseInt(tab_content.css('height'));
812
813                    if (this_height > max_height) {
814                        max_height = this_height;
815                    }
816                });
817
818                var border_top_width = parseInt($('> ul.mega-sub-menu', menu_item).css('borderTopWidth'),10);
819                var border_bottom_width = parseInt($('> ul.mega-sub-menu', menu_item).css('borderBottomWidth'),10);
820                
821                $('> ul.mega-sub-menu', menu_item).css('minHeight', max_height + border_bottom_width + border_top_width);
822            } else {
823                $('> ul.mega-sub-menu', menu_item).css('minHeight', '');
824            }
825        }
826
827        var $window = $(window);
828
829        var windowWidth = $window.width();
830
831        $window.on('resize', function() {
832            if ($window.width() != windowWidth) {
833                calculate_tabbed_sub_menu_widths($('li.mega-menu-tabbed'));
834                calculate_tabbed_sub_menu_heights($('li.mega-menu-tabbed'));
835            }            
836        });
837
838        $('li.mega-menu-tabbed, li.mega-menu-tabbed li.mega-collapse-children').on('open_panel', function() {
839            var menu = $(this).parents('.max-mega-menu');
840            var menu_item = $(this).closest(".mega-menu-tabbed");
841
842            calculate_tabbed_sub_menu_widths( menu_item );
843
844            $(">
844 ul.mega-sub-menu", $(this)).promise().done(function(){ // wait until slide animation has completed
845                calculate_tabbed_sub_menu_heights( menu_item );
846            });
847
848            if ( menu.data('view') == 'desktop' ) {
849                if ($('> ul.mega-sub-menu > li.mega-menu-item-has-children.mega-toggle-on', menu_item).length == 0 ) {
850                    
851
852                    if ( $('> ul.mega-sub-menu > li.mega-current-menu-item:visible', menu_item).length ) {
853                        $('> ul.mega-sub-menu > li.mega-current-menu-item:visible', menu_item).first().addClass('mega-toggle-on');
854                    } else if ( $('> ul.mega-sub-menu > li.mega-current-menu-ancestor:visible', menu_item).length ) {
855                        $('> ul.mega-sub-menu > li.mega-current-menu-ancestor:visible', menu_item).first().addClass('mega-toggle-on');
856                    }
857                    
858
859                    if ($('> ul.mega-sub-menu > li.mega-toggle-on', menu_item).length == 0 ) {
860                        $('> ul.mega-sub-menu > li.mega-menu-item-has-children:visible', menu_item).first().addClass('mega-toggle-on');
861                    }
862                }
863
864                $('li.mega-menu-tabbed', menu).on('close_panel', function() {
865                    $('li.mega-menu-tabbed .mega-toggle-on', menu).removeClass('mega-toggle-on');
866                });
867            }
868
869            $('li.mega-menu-tabbed li.mega-collapse-children').on('close_panel', function() {
870                var menu_item = $(this).closest('.mega-menu-tabbed');
871
872                $("> ul.mega-sub-menu", $(this)).promise().done(function(){ // wait until slide animation has completed
873                    calculate_tabbed_sub_menu_heights( menu_item );
874                });
875            });
876        });
877    });
878})(jQuery);

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.