1( function( $, elementor ) { 2 3 "use strict"; 4 5 var JetMenuWidget = { 6 7 init: function() { 8 9 var widgets = { 10 'jet-mega-menu.default' : JetMenuWidget.widgetMegaMenu, 11 'jet-custom-menu.default' : JetMenuWidget.widgetCustomMenu, 12 'jet-mobile-menu.default' : JetMenuWidget.widgetMobileMenu, 13 }; 14 15 $.each( widgets, function( widget, callback ) { 16 elementor.hooks.addAction( 'frontend/element_ready/' + widget, callback ); 17 } ); 18 19 }, 20 21 widgetMegaMenu: function( $scope ) { 22 let $megaMenu = $scope.find( '.jet-mega-menu--location-elementor' ), 23 $mobileMenu = $scope.find( '.jet-mobile-menu' ); 24 25 if ( JetMenuWidget.shouldSetIpadProCookie() ) { 26 document.cookie = "is_ipad_pro=true; path=/"; 27 location.reload(); 28 return; 29 } 30 31 if ( $megaMenu[0] ) { 32 let settings = $megaMenu.data( 'settings' ); 33 34 $megaMenu.JetMegaMenu( { 35 menuId: settings.menuId, 36 menuUniqId: settings.menuUniqId, 37 rollUp: settings.rollUp, 38 layout: settings.layout, 39 subEvent: settings.subEvent, 40 mouseLeaveDelay: settings.mouseLeaveDelay, 41 subTrigger: settings.subTrigger, 42 breakpoint: settings.breakpoint, 43 megaWidthType: settings.megaWidthType, 44 megaWidthSelector: settings.megaWidthSelector, 45 megaAjaxLoad: settings.megaAjaxLoad, 46 signatures: settings.signatures, 47 classes: { 48 instance: 'jet-mega-menu', 49 menuContainer: 'jet-mega-menu-container', 50 menuList: 'jet-mega-menu-list', 51 menuItem: 'jet-mega-menu-item', 52 menuItemLink: 'jet-mega-menu-item__link', 53 subMenuContainer: 'jet-mega-menu-sub-menu', 54 subMenuList: 'jet-mega-menu-sub-menu__list', 55 megaContainer: 'jet-mega-menu-mega-container', 56 } 57 } ); 58 59 requestAnimationFrame(() => { 60 window.dispatchEvent( new Event( 'resize' ) ); 61 }); 62 63 } 64 65 if ( $mobileMenu[0] ) { 66 let menuInstanceId = $mobileMenu.attr( 'id' ), 67 menuId = $mobileMenu.data( 'menu-id' ) || false, 68 menuOptions = $mobileMenu.data( 'menu-options' ) || {}; 69 70 window.jetMenu.createMobileRenderInstance( menuInstanceId, menuId, menuOptions ); 71 } 72 }, 73 74 widgetCustomMenu: function( $scope ) { 75 var $target = $scope.find( '.jet-custom-nav' ), 76 instance = null, 77 trigger = $target.data( 'trigger' ), 78 targetType = trigger === 'click' ? $target.data( 'target' ) || 'item' : null, 79 menuItem = null, 80 menuItemSelector = trigger === 'click' && targetType === 'sub_icon' 81 ? '.jet-dropdown-arrow' 82 : '.jet-custom-nav__item > a'; 83 84 if ( ! $target.length ) { 85 return; 86 } 87 88 if ( JetMenuWidget.mobileAndTabletcheck() ) { 89 $scope.on( 'touchstart', '.jet-custom-nav__item > a, .jet-custom-nav__item > a .jet-dropdown-arrow', touchStartItem ); 90 $scope.on( 'touchend', '.jet-custom-nav__item > a, .jet-custom-nav__item > a .jet-dropdown-arrow', touchEndItem ); 91 } else { 92 if ( trigger === 'click' ) { 93 $scope.on( 'click', menuItemSelector, toggleSubMenu ); 94 $scope.on( 'mouseleave', '.jet-custom-nav__item', mouseLeaveHandler ); 95 } else { 96 $scope.on( 'mouseenter mouseover', '.jet-custom-nav__item', mouseEnterHandler ); 97 $scope.on( 'mouseleave', '.jet-custom-nav__item', mouseLeaveHandler ); 98 } 99 } 100 101 function toggleSubMenu( event ) { 102 const $this = $( event.currentTarget ).closest( '.jet-custom-nav__item' ); 103 104 if ( ! $this.hasClass( 'menu-item-has-children' ) ) { 105 return; 106 } 107 108 event.preventDefault(); 109 event.stopPropagation(); 110 111 const isOpen = $this.hasClass( 'hover-state' ); 112 113 if ( $this.hasClass( 'hover-state' ) ) { 114 $this.removeClass( 'hover-state' ); 115 } else { 116 $this.addClass( 'hover-state' ); 117 $this.siblings().removeClass( 'hover-state' ); 118 } 119 120 if ( $this.is( '[aria-haspopup="true"]' ) ) { 121 $this.attr( 'aria-expanded', isOpen ? 'false' : 'true' ); 122 } 123 124 $this.find('.jet-dropdown-arrow[aria-haspopup="true"]').attr('aria-expanded', isOpen ? 'false' : 'true'); 125 } 126 127 function mouseEnterHandler( event ) { 128 menuItem = $( event.target ).parents( '.jet-custom-nav__item' ); 129 130 if ( menuItem.is( '[aria-haspopup="true"]' ) ) { 131 menuItem.attr( 'aria-expanded', 'true' ); 132 } 133 134 menuItem.addClass( 'hover-state' ); 135 } 136 137 function mouseLeaveHandler( event ) { 138 const $this = $( event.currentTarget ).closest( '.jet-custom-nav__item' ); 139 const relatedTarget = event.relatedTarget; 140 141 if ( $this.has( relatedTarget ).length > 0 ) { 142 return; 143 } 144 145 menuItem = $this; 146 menuItem.removeClass( 'hover-state' ); 147 148 if ( $this.is( '[aria-haspopup="true"]' ) ) { 149 $this.attr( 'aria-expanded', 'false' ); 150 } 151 152 $this.find( '.jet-dropdown-arrow[aria-haspopup="true"]' ).attr( 'aria-expanded', 'false' ); 153 } 154 155 function touchStartItem( event ) { 156 var $this = $( event.currentTarget ).closest( '.jet-custom-nav__item' ); 157 158 $this.data( 'offset', $this.offset().top ); 159 $this.data( 'windowOffset', $( window ).scrollTop() ); 160 } 161 162 function touchEndItem( event ) { 163 var $currentTarget, 164 $this, 165 $siblingsItems, 166 $link, 167 linkHref, 168 subMenu, 169 offset, 170 windowOffset; 171 172 event.preventDefault(); 173 event.stopPropagation(); 174 175 $currentTarget = $( event.currentTarget ); 176 $this = $currentTarget.closest( '.jet-custom-nav__item' ); 177 $siblingsItems = $this.siblings( '.jet-custom-nav__item.menu-item-has-children' ); 178 $link = $( '> a', $this ); 179 linkHref = $link.attr( 'href' ); 180 subMenu = $( '.jet-custom-nav__sub:first, .jet-custom-nav__mega-sub:first', $this ); 181 offset = $this.data( 'offset' ); 182 windowOffset = $this.data( 'windowOffset' ); 183 184 if ( offset !== $this.offset().top || windowOffset !== $( window ).scrollTop() ) { 185 return false;
186 } 187 188 if ( $currentTarget.hasClass( 'jet-dropdown-arrow' ) ) { 189 190 if ( !subMenu[0] ) { 191 return false; 192 } 193 194 const isOpen = $this.hasClass( 'hover-state' ); 195 196 if ( ! $this.hasClass( 'hover-state' ) ) { 197 $this.addClass( 'hover-state' ); 198 199 $siblingsItems.removeClass( 'hover-state' ).each( function() { 200 const $sibling = $( this ); 201 202 if ( $sibling.is( '[aria-haspopup="true"]' ) ) { 203 $sibling.attr( 'aria-expanded', 'false' ); 204 } 205 206 $sibling.find('> a > .jet-dropdown-arrow[aria-haspopup="true"]').attr( 'aria-expanded', 'false' ); 207 } ); 208 209 $siblingsItems.removeClass( 'hover-state' ); 210 $( '.jet-custom-nav__item.menu-item-has-children', $siblingsItems ).removeClass( 'hover-state' ); 211 } else { 212 $this.removeClass( 'hover-state' ); 213 214 $( '.jet-custom-nav__item.menu-item-has-children', $this ).removeClass( 'hover-state' ); 215 } 216 217 if ( $this.is( '[aria-haspopup="true"]' ) ) { 218 $this.attr( 'aria-expanded', isOpen ? 'false' : 'true' ); 219 } 220 221 $this.find( '> a > .jet-dropdown-arrow[aria-haspopup="true"]' ).attr( 'aria-expanded', isOpen ? 'false' : 'true' ); 222 223 } 224 225 if ( $currentTarget.hasClass( 'jet-custom-nav__item-link' ) ) { 226 227 if ( '#' === linkHref ) { 228 if ( ! $this.hasClass( 'hover-state' ) ) { 229 $this.addClass( 'hover-state' ); 230 231 $siblingsItems.removeClass( 'hover-state' ); 232 $( '.jet-custom-nav__item.menu-item-has-children', $siblingsItems ).removeClass( 'hover-state' ); 233 } else { 234 $this.removeClass( 'hover-state' ); 235 236 $( '.jet-custom-nav__item.menu-item-has-children', $this ).removeClass( 'hover-state' ); 237 } 238 } else { 239 240 window.location = linkHref; 241 242 return false; 243 } 244 245 } 246 } 247 248 var initSubMenuPosition = false; 249 250 function setSubMenuPosition(){ 251 if ( initSubMenuPosition ) { 252 $target.find( '.jet-custom-nav__sub.inverse-side' ).removeClass( 'inverse-side' ); 253 initSubMenuPosition = false; 254 } 255 256 var subMenu = $( '.jet-custom-nav__sub', $target ), 257 $body = $( 'body' ), 258 maxWidth = $body.outerWidth( true ), 259 isMobile = 'mobile' === elementor.getCurrentDeviceMode(); 260 261 if ( isMobile ) { 262 return; 263 } 264 265 if ( subMenu[0] ) { 266 subMenu.each( function() { 267 var $this = $( this ), 268 subMenuOffsetLeft = $this.offset().left, 269 subMenuOffsetRight = subMenuOffsetLeft + $this.outerWidth( true ), 270 subMenuPosition = $this.closest( '.jet-custom-nav' ).hasClass( 'jet-custom-nav--dropdown-left-side' ) ? 'left-side' : 'right-side'; 271 272 if ( 'right-side' === subMenuPosition ) { 273 if ( subMenuOffsetRight >= maxWidth ) { 274 $this.addClass( 'inverse-side' ); 275 $this.find( '.jet-custom-nav__sub' ).addClass( 'inverse-side' ); 276 277 initSubMenuPosition = true; 278 } else if ( subMenuOffsetLeft < 0 ) { 279 $this.removeClass( 'inverse-side' ); 280 $this.find( '.jet-custom-nav__sub' ).removeClass( 'inverse-side' ); 281 } 282 } else { 283 if ( subMenuOffsetLeft < 0 ) { 284 $this.addClass( 'inverse-side' ); 285 $this.find( '.jet-custom-nav__sub' ).addClass( 'inverse-side' ); 286 287 initSubMenuPosition = true; 288 } else if ( subMenuOffsetRight >= maxWidth ) { 289 $this.removeClass( 'inverse-side' ); 290 $this.find( '.jet-custom-nav__sub' ).removeClass( 'inverse-side' ); 291 } 292 } 293 } ); 294 } 295 } 296 297 setSubMenuPosition(); 298 $( window ).on( 'resize.JetCustomMenu orientationchange.JetCustomMenu', setSubMenuPosition ); 299 300 var initMaxMegaMenuWidth = false; 301 302 function setMaxMegaMenuWidth(){ 303 var megaMenu = $( '.jet-custom-nav__mega-sub', $target ), 304 $body = $( 'body' ), 305 maxWidth = $body.outerWidth( true ), 306 isMobile = 'mobile' === elementor.getCurrentDeviceMode(); 307 308 if ( initMaxMegaMenuWidth ) { 309 megaMenu.css( { 310 'maxWidth': '' 311 } ); 312 313 initMaxMegaMenuWidth = false; 314 } 315 316 if ( isMobile ) { 317 return; 318 } 319 320 if ( megaMenu[0] ) { 321 megaMenu.each( function() { 322 var $this = $( this ), 323 megaMenuTranslateX = $this.css( 'transform' ).replace( /,/g, "" ).split( " " )[4] || 0, 324 megaMenuOffsetLeft = $this.offset().left - megaMenuTranslateX, 325 megaMenuOffsetRight = megaMenuOffsetLeft + $this.outerWidth( true ), 326 megaMenuPosition = $this.closest( '.jet-custom-nav' ).hasClass( 'jet-custom-nav--dropdown-left-side' ) ? 'left-side' : 'right-side'; 327 328 if ( 'right-side' === megaMenuPosition ) { 329 if ( megaMenuOffsetRight >= maxWidth ) { 330 $this.css({ 331 'maxWidth': maxWidth - megaMenuOffsetLeft - 10 332 }); 333 334 initMaxMegaMenuWidth = true; 335 } 336 } else { 337 if ( megaMenuOffsetLeft < 0 ) { 338 $this.css({ 339 'maxWidth': megaMenuOffsetRight - 10 340 }); 341 342 initMaxMegaMenuWidth = true; 343 } 344 } 345 } ); 346 } 347 } 348 349 setMaxMegaMenuWidth(); 350 $( window ).on( 'resize.JetCustomMenu orientationchange.JetCustomMenu', setMaxMegaMenuWidth ); 351 352 }, 353 354 widgetMobileMenu: function( $scope ) { 355 let $target = $scope.find( '.jet-mobile-menu' ), 356 menuInstanceId = $target.attr( 'id' ),
357 menuId = $target.data( 'menu-id' ) || false, 358 menuOptions = $target.data( 'menu-options' ) || {}; 359 360 if ( ! $target[0] ) { 361 return; 362 } 363 364 window.jetMenu.createMobileRenderInstance( menuInstanceId, menuId, menuOptions ); 365 }, 366 367 /** 368 * Specific check for iPad Pro\Air in Safari with touch input, 369 * only if the cookie has not been set yet. 370 * 371 * @return {boolean} 372 */ 373 shouldSetIpadProCookie: function() { 374 const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 375 const isMacLike = navigator.userAgent.includes( 'Macintosh' ); 376 const hasTouch = 'ontouchend' in window || navigator.maxTouchPoints > 1; 377 378 const cookieNotSet = document.cookie.indexOf( 'is_ipad_pro=true' ) === -1; 379 380 return isSafari && isMacLike && hasTouch && cookieNotSet; 381 }, 382 383 /** 384 * Mobile and tablet check funcion. 385 * 386 * @return {boolean} Mobile Status 387 */ 388 mobileAndTabletcheck: function() { 389 var check = false; 390 391 (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera); 392 393 return check; 394 } 395 }; 396 397 $( window ).on( 'elementor/frontend/init', JetMenuWidget.init ); 398 399}( jQuery, window.elementorFrontend ) );
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.