PageSourceSearch

https://www.pomiglianojazz.com/wp-content/plugins/megamenu/js/maxmegamenu.js?ver=2.7.1.4

js pomiglianojazz.com collected 2026-10-03 22:29:17 UTC 27,842 bytes, 642 lines download raw bytes

1/*jslint browser: true, white: true, this: true, long: true */
2/*global console,jQuery,megamenu,window,navigator*/
3
4/*! Max Mega Menu jQuery Plugin */
5(function ( $ ) {
6    "use strict";
7
8    $.maxmegamenu = function(menu, options) {
9        var plugin = this;
10        var $menu = $(menu);
11        var $toggle_bar = $menu.siblings(".mega-menu-toggle");
12        var html_body_class_timeout;
13
14        var defaults = {
15            event: $menu.attr("data-event"),
16            effect: $menu.attr("data-effect"),
17            effect_speed: parseInt($menu.attr("data-effect-speed")),
18            effect_mobile: $menu.attr("data-effect-mobile"),
19            effect_speed_mobile: parseInt($menu.attr("data-effect-speed-mobile")),
20            panel_width: $menu.attr("data-panel-width"),
21            panel_inner_width: $menu.attr("data-panel-inner-width"),
22            mobile_force_width: $menu.attr("data-mobile-force-width"),
23            mobile_overlay: $menu.attr("data-mobile-overlay"),
24            second_click: $menu.attr("data-second-click"),
25            vertical_behaviour: $menu.attr("data-vertical-behaviour"),
26            document_click: $menu.attr("data-document-click"),
27            breakpoint: $menu.attr("data-breakpoint"),
28            unbind_events: $menu.attr("data-unbind")
29        };
30
31        plugin.settings = {};
32
33        var items_with_submenus = $("li.mega-menu-megamenu.mega-menu-item-has-children," +
34                                    "li.mega-menu-flyout.mega-menu-item-has-children," +
35                                    "li.mega-menu-tabbed > ul.mega-sub-menu > li.mega-menu-item-has-children," +
36                                    "li.mega-menu-flyout li.mega-menu-item-has-children", menu);
37
38
39
40        plugin.addAnimatingClass = function(element) {
41            if (plugin.settings.effect === "disabled") {
42                return;
43            }
44
45            $(".mega-animating").removeClass("mega-animating");
46
47            var timeout = plugin.settings.effect_speed + parseInt(megamenu.timeout, 10);
48
49            element.addClass("mega-animating");
50
51            setTimeout(function() {
52               element.removeClass("mega-animating");
53            }, timeout );
54        };
55
56        plugin.hideAllPanels = function() {
57            $(".mega-toggle-on > a.mega-menu-link", $menu).each(function() {
58                plugin.hidePanel($(this), false);
59            });
60        };
61
62        plugin.hideSiblingPanels = function(anchor, immediate) {
63            anchor.parent().parent().find(".mega-toggle-on").children("a.mega-menu-link").each(function() { // all open children of open siblings
64                plugin.hidePanel($(this), immediate);
65            });
66        };
67
68        plugin.isDesktopView = function() {
69            return Math.max(window.outerWidth, $(window).width()) > plugin.settings.breakpoint; // account for scrollbars
70        };
71
72        plugin.isMobileView = function() {
73            return !plugin.isDesktopView();
74        };
75
76        plugin.showPanel = function(anchor) {
77            anchor.parent().triggerHandler("before_open_panel");
78
79            anchor.attr("aria-expanded", "true");
80
81            $(".mega-animating").removeClass("mega-animating");
82
83            if (plugin.isMobileView() && anchor.parent().hasClass("mega-hide-sub-menu-on-mobile")) {
84                return;
85            }
86
87            if (plugin.isDesktopView() && ( $menu.hasClass("mega-menu-horizontal") || $menu.hasClass("mega-menu-vertical") ) && !anchor.parent().hasClass("mega-collapse-children")) {
88                plugin.hideSiblingPanels(anchor, true);
89            }
90
91            if ((plugin.isMobileView() && $menu.hasClass("mega-keyboard-navigation")) || plugin.settings.vertical_behaviour === "accordion") {
92                plugin.hideSiblingPanels(anchor, false);
93            }
94
95            plugin.calculateDynamicSubmenuWidths(anchor);
96
97            // apply jQuery transition (only if the effect is set to "slide", other transitions are CSS based)
98            if ( anchor.parent().hasClass("mega-collapse-children") || plugin.settings.effect === "slide" || 
99                ( plugin.isMobileView() && ( plugin.settings.effect_mobile === "slide" || plugin.settings.effect_mobile === "slide_left" || plugin.settings.effect_mobile === "slide_right" ) )
100               ) {
101                var speed = plugin.isMobileView() ? plugin.settings.effect_speed_mobile : plugin.settings.effect_speed;
102
103                anchor.siblings(".mega-sub-menu").css("display", "none").animate({"height":"show", "paddingTop":"show", "paddingBottom":"show", "minHeight":"show"}, speed, function() {
104                    $(this).css("display", "");
105                });
106            }
107
108            anchor.parent().addClass("mega-toggle-on").triggerHandler("open_panel");
109        };
110        
111        plugin.hidePanel = function(anchor, immediate) {
112            anchor.parent().triggerHandler("before_close_panel");
113
114            anchor.attr("aria-expanded", "false");
115
116            if ( anchor.parent().hasClass("mega-collapse-children") || ( ! immediate && plugin.settings.effect === "slide" ) || 
117                ( plugin.isMobileView() && ( plugin.settings.effect_mobile === "slide" || plugin.settings.effect_mobile === "slide_left" || plugin.settings.effect_mobile === "slide_right" ) )
118               ) {
119                var speed = plugin.isMobileView() ? plugin.settings.effect_speed_mobile : plugin.settings.effect_speed;
120
121                anchor.siblings(".mega-sub-menu").animate({"height":"hide", "paddingTop":"hide", "paddingBottom":"hide", "minHeight":"hide"}, speed, function() {
122                    anchor.siblings(".mega-sub-menu").css("display", "");
123                    anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
124                });
125
126                return;
127            }
128
129            if (immediate) {
130                anchor.siblings(".mega-sub-menu").css("display", "none").delay(plugin.settings.effect_speed).queue(function(){
131                    $(this).css("display", "").dequeue();
132                });
133            }
134
135            // pause video widget videos
136            anchor.siblings(".mega-sub-menu").find(".widget_media_video video").each(function() {
137                this.player.pause();
138            });
139
140            anchor.parent().removeClass("mega-toggle-on").triggerHandler("close_panel");
141            plugin.addAnimatingClass(anchor.parent());
142        };
143
144        plugin.calculateDynamicSubmenuWidths = function(anchor) {
145            // apply dynamic width and sub menu position (only to top level mega menus)
146            if (anchor.parent().hasClass("mega-menu-megamenu") && anchor.parent().parent().hasClass("max-mega-menu") && plugin.settings.panel_width && $(plugin.settings.panel_width).length > 0) {
147                if (plugin.isDesktopView()) {
148                    var submenu_offset = $menu.offset();
149                    var target_offset = $(plugin.settings.panel_width).offset();
150
151                    anchor.siblings(".mega-sub-menu").css({
152                        width: $(plugin.settings.panel_width).outerWidth(),
153                        left: (target_offset.left - submenu_offset.left) + "px"
154                    });
155                } else {
156                    anchor.siblings(".mega-sub-menu").css({
157                        width: "",
158                        left: ""
159                    });
160                }
161            }
162
163            // apply inner width to sub menu by adding padding to the left and right of the mega menu
164            if (anchor.parent().hasClass("mega-menu-megamenu") && anchor.parent().parent().hasClass("max-mega-menu") && plugin.settings.panel_inner_width && $(plugin.settings.panel_inner_width).length > 0) {
165                var target_width = 0;
166
167                if ($(plugin.settings.panel_inner_width).length) {
168                    // jQuery selector
169                    target_width = parseInt($(plugin.settings.panel_inner_width).width(), 10);
170                } else {
171                    // we"re using a pixel width
172                    target_width = parseInt(plugin.settings.panel_inner_width, 10);
173                }
174
175                var submenu_width = parseInt(anchor.siblings(".mega-sub-menu").innerWidth(), 10);
176
177                if (plugin.isDesktopView() && target_width > 0 && target_width < submenu_width) {
178                    anchor.siblings(".mega-sub-menu").css({
179                        "paddingLeft": (submenu_width - target_width) / 2 + "px",
180                        "paddingRight": (submenu_width - target_width) / 2 + "px"
181                    });
182                } else {
183                    anchor.siblings(".mega-sub-menu").css({
184                        "paddingLeft": "",
185                        "paddingRight": ""
186                    });
187                }
188            }
189        };
190
191        var bindClickEvents = function() {
192            var dragging = false;
193
194            $(document).on({
195                "touchmove": function(e) { dragging = true; },
196                "touchstart": function(e) { dragging = false; }
197            });
198
199            $(document).on("click touchend", function(e) { // hide menu when clicked away from
200                if (!dragging && plugin.settings.document_click === "collapse" && ! $(e.target).closest(".max-mega-menu li").length && ! $(e.target).closest(".mega-menu-toggle").length ) {
201                    plugin.hideAllPanels();
202                    plugin.hideMobileMenu();
203                }
204                dragging = false;
205            });
206
207            var collapse_children_parents = $("li.mega-menu-megamenu li.mega-menu-item-has-children.mega-collapse-children > a.mega-menu-link");
208            var clickable_parents = $("> a.mega-menu-link", items_with_submenus).add(collapse_children_parents);
209
210            clickable_parents.on("touchend.megamenu", function(e) {
211                plugin.unbindHoverEvents();
212                plugin.unbindHoverIntentEvents();
213            });
214
215            clickable_parents.on("click.megamenu", function(e) {
216                if (plugin.isDesktopView() && $(this).parent().hasClass("mega-toggle-on") && $(this).parent().parent().parent().hasClass("mega-menu-tabbed") ) {
217                    if (plugin.settings.second_click === "go") {
218                        return;
219                    } else {
220                        e.preventDefault();
221                        return;
222                    }
223                }
224                if (dragging) {
225                    return;
226                }
227                if (plugin.isMobileView() && $(this).parent().hasClass("mega-hide-sub-menu-on-mobile")) {
228                    return; // allow all clicks on parent items when sub menu is hidden on mobile
229                }
230                if ((plugin.settings.second_click === "go" || $(this).parent().hasClass("mega-click-click-go")) && $(this).attr("href") !== undefined) { // check for second click
231                    if (!$(this).parent().hasClass("mega-toggle-on")) {
232                        e.preventDefault();
233                        plugin.showPanel($(this));
234                    }
235                } else {
236                    e.preventDefault();
237
238                    if ($(this).parent().hasClass("mega-toggle-on")) {
239                        plugin.hidePanel($(this), false);
240                    } else {
241                        plugin.showPanel($(this));
242                    }
243                }
244            });
245        };
246
247        var bindHoverEvents = function() {
248            items_with_submenus.on({
249                "mouseenter.megamenu" : function() {
250                    plugin.unbindClickEvents();
251                    if (! $(this).hasClass("mega-toggle-on")) {
252                        plugin.showPanel($(this).children("a.mega-menu-link"));
253                    }
254                },
255                "mouseleave.megamenu" : function() {
256                    if ($(this).hasClass("mega-toggle-on") && ! $(this).hasClass("mega-disable-collapse") && ! $(this).parent().parent().hasClass("mega-menu-tabbed")) {
257                        plugin.hidePanel($(this).children("a.mega-menu-link"), false);
258                    }
259                }
260            });
261        };
262
263        var bindHoverIntentEvents = function() {
264            items_with_submenus.hoverIntent({
265                over: function () {
266                    plugin.unbindClickEvents();
267                    if (! $(this).hasClass("mega-toggle-on")) {
268                        plugin.showPanel($(this).children("a.mega-menu-link"));
269                    }
270                },
271                out: function () {
272                    if ($(this).hasClass("mega-toggle-on") && ! $(this).hasClass("mega-disable-collapse") && ! $(this).parent().parent().hasClass("mega-menu-tabbed")) {
273                        plugin.hidePanel($(this).children("a.mega-menu-link"), false);
274                    }
275                },
276                timeout: megamenu.timeout,
277                interval: megamenu.interval
278            });
279        };
280
281        var bindKeyboardEvents = function() {
282            var tab_key = 9;
283            var escape_key = 27;
284            var enter_key = 13;
285            var left_arrow_key = 37;
286            var right_arrow_key = 39;
287            var space_key = 32;
288
289            $menu.parent().on("keyup.megamenu", function(e) {
290                var keyCode = e.keyCode || e.which;
291
292                if (keyCode === tab_key) {
293                    $menu.parent().addClass("mega-keyboard-navigation");
294                }
295            });
296
297            $menu.parent().on("keydown.megamenu", function(e) {
298                var keyCode = e.keyCode || e.which;
299                var active_link = $(e.target);
300
301                if ( keyCode === space_key && active_link.is(".mega-menu-link") && $menu.parent().hasClass("mega-keyboard-navigation") ) {
302                    e.preventDefault();
303
304                    // pressing space on a parent item will always toggle the sub menu
305                    if ( active_link.parent().is(items_with_submenus) ) {
306                        if ( active_link.parent().hasClass("mega-toggle-on") && ! active_link.parent().parent().parent().hasClass("mega-menu-tabbed") ) {
307                            plugin.hidePanel(active_link);
308                        } else {
309                            plugin.showPanel(active_link);
310                        }
311                    }
312                }
313            });
314
315            $menu.parent().on("keyup.megamenu", function(e) {
316                var keyCode = e.keyCode || e.which;
317                var active_link = $(e.target);
318                
319                if ( keyCode === tab_key && $menu.parent().hasClass("mega-keyboard-navigation") ) {
320                    if ( active_link.parent().is(items_with_submenus) && active_link.is("[href]") !== false ) {
321                        plugin.showPanel(active_link);
322                    } else {
323                        if ( ! active_link.parent().parent().parent().hasClass("mega-menu-tabbed") ) {
324                            plugin.hideSiblingPanels(active_link);
325                        }
326                    }
327                }
328
329                if ( keyCode === escape_key && $menu.parent().hasClass("mega-keyboard-navigation") ) {
330                    var submenu_open = $("> .mega-toggle-on", $menu).length !== 0;
331
332                    $("> .mega-toggle-on > a.mega-menu-link", $menu).focus();
333
334                    plugin.hideAllPanels();
335
336                    if ( plugin.isMobileView() && ! submenu_open ) {
337                        plugin.hideMobileMenu();
338                        $(".mega-menu-toggle-block, button.mega-toggle-animated", $toggle_bar).first().focus();
339                    }
340                }
341
342                if ( keyCode === enter_key && $menu.parent().hasClass("mega-keyboard-navigation") ) {
343                    if ( active_link.hasClass("mega-menu-toggle-block") ) {
344                        if ( $toggle_bar.hasClass("mega-menu-open") ) {
345                            plugin.hideMobileMenu();
346                        } else {
347                            plugin.showMobileMenu();
348                        }
349                    }
350
351                    // pressing enter on a parent item without a link 
351will toggle the sub menu
352                    if ( active_link.parent().is(items_with_submenus) && active_link.is("[href]") === false ) {
353                        if ( active_link.parent().hasClass("mega-toggle-on") && ! active_link.parent().parent().parent().hasClass("mega-menu-tabbed") ) {
354                            plugin.hidePanel(active_link);
355                        } else {
356                            plugin.showPanel(active_link);
357                        }
358                    }
359                }
360
361                if ( keyCode === right_arrow_key && plugin.isDesktopView() && $menu.parent().hasClass("mega-keyboard-navigation") && $menu.hasClass("mega-menu-horizontal") ) {
362                    var next_top_level_item = $("> .mega-toggle-on", $menu).nextAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search input[type=text]").first();
363
364                    if (next_top_level_item.length === 0) {
365                        next_top_level_item = $(":focus", $menu).parent().nextAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search input[type=text]").first();
366                    }
367
368                    next_top_level_item.focus();
369
370                    if ( next_top_level_item.parent().is(items_with_submenus) && next_top_level_item.is("[href]") !== false ) {
371                        plugin.showPanel(next_top_level_item);
372                    } else {
373                        plugin.hideSiblingPanels(next_top_level_item);
374                    }
375                }
376
377                if ( keyCode === left_arrow_key && plugin.isDesktopView() && $menu.parent().hasClass("mega-keyboard-navigation") && $menu.hasClass("mega-menu-horizontal") ) {
378                    var prev_top_level_item = $("> .mega-toggle-on", $menu).prevAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search input[type=text]").last();
379
380                    if (prev_top_level_item.length === 0) {
381                        prev_top_level_item = $(":focus", $menu).parent().prevAll("li.mega-menu-item:visible").find("> a.mega-menu-link, .mega-search input[type=text]").last();
382                    }
383
384                    prev_top_level_item.focus();
385
386                    if ( prev_top_level_item.parent().is(items_with_submenus) && prev_top_level_item.is("[href]") !== false  ) {
387                        plugin.showPanel(prev_top_level_item);
388                    } else {
389                        plugin.hideSiblingPanels(prev_top_level_item);
390                    }
391                }
392
393            });
394
395            $menu.parent().on("focusout.megamenu", function(e) {
396                if ( $menu.parent().hasClass("mega-keyboard-navigation") ) {
397                    setTimeout(function() {
398                        var menu_has_focus = $menu.parent().find(":focus").length > 0;
399                        if (! menu_has_focus) {
400                            $menu.parent().removeClass("mega-keyboard-navigation");
401                            plugin.hideAllPanels();
402                            plugin.hideMobileMenu();
403                        }
404                    }, 10);
405                }
406            });
407        };
408
409        plugin.unbindAllEvents = function() {
410            $("ul.mega-sub-menu, li.mega-menu-item, li.mega-menu-row, li.mega-menu-column, a.mega-menu-link, span.mega-indicator", menu).off().unbind();
411        };
412
413        plugin.unbindClickEvents = function() {
414            $("> a.mega-menu-link", items_with_submenus).off("click.megamenu touchend.megamenu");
415        };
416
417        plugin.unbindHoverEvents = function() {
418            items_with_submenus.unbind("mouseenter.megamenu mouseleave.megamenu");
419        };
420
421        plugin.unbindHoverIntentEvents = function() {
422            items_with_submenus.unbind("mouseenter mouseleave").removeProp("hoverIntent_t").removeProp("hoverIntent_s"); // hoverintent does not allow namespaced events
423        };
424
425        plugin.unbindKeyboardEvents = function() {
426            $menu.parent().off("keyup.megamenu keydown.megamenu focusout.megamenu");
427        };
428
429        plugin.unbindMegaMenuEvents = function() {
430            if (plugin.settings.event === "hover_intent") {
431                plugin.unbindHoverIntentEvents();
432            }
433
434            if (plugin.settings.event === "hover") {
435                plugin.unbindHoverEvents();
436            }
437
438            plugin.unbindClickEvents();
439            plugin.unbindKeyboardEvents();
440        };
441
442
443        plugin.bindMegaMenuEvents = function() {
444            if (plugin.isDesktopView() && plugin.settings.event === "hover_intent") {
445                bindHoverIntentEvents();
446            }
447
448            if (plugin.isDesktopView() && plugin.settings.event === "hover") {
449                bindHoverEvents();
450            }
451
452            bindClickEvents(); // always bind click events for touch screen devices
453            bindKeyboardEvents();
454        };
455
456        plugin.monitorView = function() {
457            if (plugin.isDesktopView()) {
458                $menu.data("view", "desktop");
459            } else {
460                $menu.data("view", "mobile");
461                plugin.switchToMobile();
462            }
463
464            plugin.checkWidth();
465
466            $(window).resize(function() {
467                plugin.checkWidth();
468            });
469        };
470
471        plugin.checkWidth = function() {
472            if ( plugin.isMobileView() && $menu.data("view") === "desktop" ) {
473                $menu.data("view", "mobile");
474                plugin.switchToMobile();
475            }
476
477            if ( plugin.isDesktopView() && $menu.data("view") === "mobile" ) {
478                $menu.data("view", "desktop");
479                plugin.switchToDesktop();
480            }
481
482            plugin.calculateDynamicSubmenuWidths($("> li.mega-menu-megamenu > a.mega-menu-link", $menu));
483        };
484
485        plugin.reverseRightAlignedItems = function() {
486            if ( ! $("body").hasClass("rtl") ) {
487                $menu.append($menu.children("li.mega-item-align-right").get().reverse());
488            }
489        };
490
491        plugin.addClearClassesToMobileItems = function() {
492            $(".mega-menu-row", $menu).each(function() {
493                $("> .mega-sub-menu > .mega-menu-column:not(.mega-hide-on-mobile)", $(this)).filter(":even").addClass("mega-menu-clear"); // :even is 0 based
494            });
495        };
496
497        plugin.switchToMobile = function() {
498            plugin.unbindMegaMenuEvents();
499            plugin.bindMegaMenuEvents();
500            plugin.reverseRightAlignedItems();
501            plugin.addClearClassesToMobileItems();
502            plugin.hideAllPanels();
503        };
504
505        plugin.switchToDesktop = function() {
506            plugin.unbindMegaMenuEvents();
507            plugin.bindMegaMenuEvents();
508            plugin.reverseRightAlignedItems();
509            plugin.hideAllPanels();
510
511            $menu.css({
512                width: "",
513                left: "",
514                display: ""
515            });
516
517            $toggle_bar.removeClass("mega-menu-open");
518        };
519
520        plugin.initToggleBar = function() {
521            // mobile menu
522            $toggle_bar.on("click", function(e) {
523                if ( $(e.target).is(".mega-menu-toggle, .mega-menu-toggle-block, .mega-menu-toggle-animated-block, .mega-menu-toggle-animated-block *, .mega-toggle-blocks-left, .mega-toggle-blocks-center, .mega-toggle-blocks-right, .mega-toggle-label, .mega-toggle-label span") ) {                    if ($(this).hasClass("mega-menu-open")) {
524                        plugin.hideMobileMenu();
525                    } else {
526                        plugin.showMobileMenu();
527                    }
528                }
529            });
530        };
531
532        plugin.hideMobileMenu = function() {
533            if ( ! $toggle_bar.is(":visible")) {
534                return;
535            }
536
537            html_body_class_timeout = setTimeout(function() {
538                $("body").removeClass($menu.attr("id") + "-mobile-open");
539                $("html").removeClass($menu.attr("id") + "-off-canvas-open");
540            }, plugin.settings.effect_speed_mobile);
541
542            $(".mega-toggle-label, .mega-toggle-animated", $toggle_bar).attr("aria-expanded", "false");
543
544            if (plugin.settings.effect_mobile === "slide") {
545                $menu.animate({"height":"hide"}, plugin.settings.effect_speed_mobile, function() {
546                    $menu.css({
547                        width: "",
548                        left: "",
549                        display: ""
550                    });
551                });
552            }
553
554            $toggle_bar.removeClass("mega-menu-open");
555        };
556
557        plugin.showMobileMenu = function() {
558            if ( ! $toggle_bar.is(":visible")) {
559                return;
560            }
561
562            clearTimeout(html_body_class_timeout);
563
564            $("body").addClass($menu.attr("id") + "-mobile-open");
565
566            if ( plugin.settings.effect_mobile === "slide_left" || plugin.settings.effect_mobile === "slide_right" ) {
567                $("html").addClass($menu.attr("id") + "-off-canvas-open");
568            }
569
570            $(".mega-toggle-label, .mega-toggle-animated", $toggle_bar).attr("aria-expanded", "true");
571
572            plugin.toggleBarForceWidth();
573
574            if (plugin.settings.effect_mobile === "slide") {
575                $menu.animate({"height":"show"}, plugin.settings.effect_speed_mobile);
576            }
577
578            $toggle_bar.addClass("mega-menu-open");
579        };
580
581        plugin.toggleBarForceWidth = function() {
582
583            if ($(plugin.settings.mobile_force_width).length && ( plugin.settings.effect_mobile == 'slide' || plugin.settings.effect_mobile == 'disabled' ) ) {
584                var submenu_offset = $toggle_bar.offset();
585                var target_offset = $(plugin.settings.mobile_force_width).offset();
586
587                $menu.css({
588                    width: $(plugin.settings.mobile_force_width).outerWidth(),
589                    left: (target_offset.left - submenu_offset.left) + "px"
590                });
591            }
592        };
593
594        plugin.init = function() {
595            $menu.triggerHandler("before_mega_menu_init");
596            plugin.settings = $.extend({}, defaults, options);
597            $menu.removeClass("mega-no-js");
598
599            plugin.initToggleBar();
600            
601            if (plugin.settings.unbind_events === "true") {
602                plugin.unbindAllEvents();
603            }
604
605            $("span.mega-indicator", $menu).on("click.megamenu", function(e) {
606                e.preventDefault();
607                e.stopPropagation();
608
609                if ( $(this).parent().parent().hasClass("mega-toggle-on") ) {
610                    if ( ! $(this).parent().parent().parent().parent().hasClass("mega-menu-tabbed") || plugin.isMobileView() ) {
611                        plugin.hidePanel($(this).parent(), false);
612                    }
613                } else {
614                    plugin.showPanel($(this).parent(), false);
615                }
616            });
617
618            $(window).on("load", function() {
619                plugin.calculateDynamicSubmenuWidths($("> li.mega-menu-megamenu > a.mega-menu-link", $menu));
620            });
621
622            plugin.bindMegaMenuEvents();
623            plugin.monitorView();
624            $menu.triggerHandler("after_mega_menu_init");
625        };
626
627        plugin.init();
628    };
629
630    $.fn.maxmegamenu = function(options) {
631        return this.each(function() {
632            if (undefined === $(this).data("maxmegamenu")) {
633                var plugin = new $.maxmegamenu(this, options);
634                $(this).data("maxmegamenu", plugin);
635            }
636        });
637    };
638
639    $(function() {
640        $(".max-mega-menu").maxmegamenu();
641    });
642}( 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.