1 2$(document).ready(function() { 3 4 $('body').on('click','.menu-vertical-title',(function(e) { 5 e.preventDefault(); 6 $('.wrapper-menu-vertical').not($(this).closest('.wrapper-menu-vertical')).removeClass('active'); 7 $(this).closest('.wrapper-menu-vertical').toggleClass('active'); 8 })); 9 10 $('body').click(function(e) { 11 var target = $(e.target); 12 if(!target.is('.wrapper-menu-vertical') && !target.closest('.wrapper-menu-vertical').length) { 13 $('.wrapper-menu-vertical').removeClass('active'); 14 } 15 }); 16 17 $('body').on('click','.show-more-cat',(function(e) { 18 $(this).toggleClass('menu-show'); 19 $(this).siblings('.more-cate').slideToggle(200); 20 })); 21 22 axpsUnitActiveItem(); 23 axpsInitMobileMegamenu(); 24 25}); 26 27$(window).load(function() { 28 axpsInitHorizontalMegamenu(); 29}); 30 31function axpsInitHorizontalMegamenu() { 32 33 var $menuHorizontal = $('.menu-horizontal'); 34 var $list = $menuHorizontal.find(' > li.dropdown-is-mega'); 35 36 $list.hover(function(){ 37 setOffset($(this)); 38 }); 39 40 var setOffset = function ($li) { 41 var $dropdown = $li.find(' > .sub-menu-dropdown'); 42 43 $dropdown.css({ 'right' : '', 'left' : '', 'width' : $dropdown.data('width') }); 44 45 var dropdownWidth = $dropdown.outerWidth(); 46 var dropdownOffset = $dropdown.offset(); 47 var toRight; 48 var viewportWidth; 49 var dropdownOffsetRight; 50 var $window = $(window); 51 var $body = $('body'); 52 var screenWidth = $window.width(); 53 54 if (!dropdownWidth || !dropdownOffset) { 55 return; 56 } 57 58 if(dropdownWidth > screenWidth){ 59 dropdownWidth = screenWidth; 60 } 61 62 $dropdown.css({ 'width' : dropdownWidth }); 63 64 $dropdown.find('.container-parent').css({ 'padding-left' : '', 'padding-right' : '' }); 65 66 if(dropdownWidth <= 1200){ 67 $dropdown.find('.container-parent').css({ 68 'padding-left': 0, 69 'padding-right': 0, 70 }); 71 } 72 73 if ($li.hasClass('dropdown-is-mega') && dropdownWidth > 1200) { 74 viewportWidth = $window.width(); 75 76 if ($body.hasClass('rtl')) { 77 dropdownOffsetRight = viewportWidth - dropdownOffset.left - dropdownWidth; 78 79 if (dropdownOffsetRight + dropdownWidth >= viewportWidth) { 80 toRight = dropdownOffsetRight + dropdownWidth - viewportWidth; 81 82 $dropdown.css({ 83 right: -toRight 84 }); 85 } 86 } else { 87 if (dropdownOffset.left + dropdownWidth >= viewportWidth) { 88 toRight = dropdownOffset.left + dropdownWidth - viewportWidth; 89 90 $dropdown.css({ 91 left: -toRight 92 }); 93 } 94 } 95 96 $li.addClass('menu_initialized'); 97 } else if ($li.hasClass('dropdown-is-mega')) { 98 viewportWidth = $('#site_width').innerWidth(); 99 100 dropdownOffsetRight = viewportWidth - dropdownOffset.left - dropdownWidth; 101 102 var extraSpace = 0; 103 var containerOffset = ($window.width() - viewportWidth) / 2; 104 var dropdownOffsetLeft; 105 106 if (dropdownWidth >= viewportWidth) { 107 extraSpace = (viewportWidth - dropdownWidth)/2; 108 } 109 110 if ($body.hasClass('rtl')) { 111 dropdownOffsetLeft = containerOffset + dropdownOffsetRight; 112 113 if (dropdownOffsetLeft + dropdownWidth >= viewportWidth) { 114 toRight = dropdownOffsetLeft + dropdownWidth - viewportWidth; 115 116 $dropdown.css({ 117 right: -toRight - extraSpace 118 }); 119 } 120 } else { 121 dropdownOffsetLeft = dropdownOffset.left - containerOffset; 122 123 if (dropdownOffsetLeft + dropdownWidth >= viewportWidth) { 124 toRight = dropdownOffsetLeft + dropdownWidth - viewportWidth; 125 126 $dropdown.css({ 127 left: -toRight - extraSpace 128 }); 129 } 130 } 131 132 $li.addClass('menu_initialized'); 133 }else{ 134 $li.addClass('menu_initialized'); 135 } 136 }; 137 138 $list.each(function () { 139 setOffset($(this)); 140 }); 141} 142 143function axpsInitMobileMegamenu() { 144 $('.wrapper-menu-mobile .mo_element_ul_depth_0, .wrapper-menu-column .col_element_ul_depth_0').each(function () { 145 var $ul = $(this), 146 elementDataKey = 'accordiated', 147 activeClassName = 'active', 148 panelSelector = '.mo_sub_ul, .col_sub_ul', 149 itemSelector = 'li'; 150 151 if ($ul.data(elementDataKey)) return false; 152 153 $.each($ul.find('.mo_sub_ul, .col_sub_ul'), function () { 154 $(this).data(elementDataKey, true); 155 $(this).hide(); 156 }); 157 158 $.each($ul.find('.js-opener-menu'), function () { 159 $(this).click(function (e) { 160 activate($(this).parent()); 161 return void 0; 162 }); 163 }); 164 165 function activate($el) { 166 $el.siblings(panelSelector).slideToggle(200, function () { 167 if ($el.siblings(panelSelector).is(':visible')) { 168 $el.parents(itemSelector).not($ul.parents()).addClass(activeClassName); 169 } else { 170 $el.parent(itemSelector).removeClass(activeClassName); 171 } 172 $el.parents().show(); 173 }); 174 } 175 }); 176} 177 178function axpsUnitActiveItem() { 179 var url = window.location.pathname; 180 var urlRegExp = new RegExp(url.replace(/\/$/,'') + "$");
181 $(".wrapper-menu-horizontal .element_a_depth_0, .wrapper-menu-vertical .element_a_depth_0").each(function() { 182 if(urlRegExp.test(this.href.replace(/\/$/,''))){ 183 $(this).parent().addClass('current-menu-item'); 184 } 185 }); 186} 187
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.