PageSourceSearch

https://kidskonnect.com/wp-content/plugins/megamenu-pro/assets/public.js?ver=2.4.6

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