PageSourceSearch

https://ledtecasia.com/wp-content/plugins/jet-menu/assets/public/js/jet-menu-widgets-scripts.js?ver=1.5.14

js ledtecasia.com collected 2026-10-08 05:00:27 UTC 10,458 bytes, 271 lines download raw bytes

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			};
13
14			$.each( widgets, function( widget, callback ) {
15				elementor.hooks.addAction( 'frontend/element_ready/' + widget, callback );
16			});
17
18		},
19
20		widgetMegaMenu: function( $scope ) {
21			var $target                  = $scope.find( '.jet-menu-container' ),
22				rollUp                   = false,
23				jetMenuMouseleaveDelay   = 500,
24				jetMenuMegaWidthType     = 'container',
25				jetMenuMegaWidthSelector = '',
26				jetMenuMegaOpenSubType   = 'hover',
27				jetMenuMobileBreakpoint  = 768;
28
29			if ( window.jetMenuPublicSettings && window.jetMenuPublicSettings.menuSettings ) {
30				rollUp                   = ( 'true' === jetMenuPublicSettings.menuSettings.jetMenuRollUp ) ? true : false;
31				jetMenuMouseleaveDelay   = jetMenuPublicSettings.menuSettings.jetMenuMouseleaveDelay || 500;
32				jetMenuMegaWidthType     = jetMenuPublicSettings.menuSettings.jetMenuMegaWidthType || 'container';
33				jetMenuMegaWidthSelector = jetMenuPublicSettings.menuSettings.jetMenuMegaWidthSelector || '';
34				jetMenuMegaOpenSubType   = jetMenuPublicSettings.menuSettings.jetMenuMegaOpenSubType || 'hover';
35				jetMenuMobileBreakpoint  = jetMenuPublicSettings.menuSettings.jetMenuMobileBreakpoint || 768;
36			}
37
38			$target.JetMenu( {
39				enabled: rollUp,
40				mouseLeaveDelay: +jetMenuMouseleaveDelay,
41				megaWidthType: jetMenuMegaWidthType,
42				megaWidthSelector: jetMenuMegaWidthSelector,
43				openSubType: jetMenuMegaOpenSubType,
44				threshold: +jetMenuMobileBreakpoint
45			} );
46		},
47
48		widgetCustomMenu: function( $scope ) {
49			var $target = $scope.find( '.jet-custom-nav' ),
50				instance = null,
51				menuItem = null;
52
53			if ( ! $target.length ) {
54				return;
55			}
56
57			if ( JetMenuWidget.mobileAndTabletcheck() ) {
58				$scope.on( 'touchstart', '.jet-custom-nav__item > a, .jet-custom-nav__item > a .jet-dropdown-arrow', touchStartItem );
59				$scope.on( 'touchend', '.jet-custom-nav__item > a, .jet-custom-nav__item > a .jet-dropdown-arrow', touchEndItem );
60			} else {
61				$scope.on( 'mouseenter mouseover', '.jet-custom-nav__item', mouseEnterHandler );
62				$scope.on( 'mouseleave', '.jet-custom-nav__item', mouseLeaveHandler );
63			}
64
65			function mouseEnterHandler( event ) {
66				menuItem = $( event.target ).parents( '.jet-custom-nav__item' );
67				menuItem.addClass( 'hover-state' );
68			}
69
70			function mouseLeaveHandler( event ) {
71				menuItem = $( event.target ).parents( '.jet-custom-nav__item' );
72				menuItem.removeClass( 'hover-state' );
73			}
74
75			function touchStartItem( event ) {
76				var $this = $( event.currentTarget ).closest( '.jet-custom-nav__item' );
77
78				$this.data( 'offset', $this.offset().top );
79				$this.data( 'windowOffset', $( window ).scrollTop() );
80			}
81
82			function touchEndItem( event ) {
83				var $currentTarget,
84					$this,
85					$siblingsItems,
86					$link,
87					linkHref,
88					subMenu,
89					offset,
90					windowOffset;
91
92				event.preventDefault();
93				event.stopPropagation();
94
95				$currentTarget = $( event.currentTarget );
96				$this          = $currentTarget.closest( '.jet-custom-nav__item' );
97				$siblingsItems = $this.siblings( '.jet-custom-nav__item.menu-item-has-children' );
98				$link          = $( '> a', $this );
99				linkHref       = $link.attr( 'href' );
100				subMenu        = $( '.jet-custom-nav__sub:first, .jet-custom-nav__mega-sub:first', $this );
101				offset         = $this.data( 'offset' );
102				windowOffset   = $this.data( 'windowOffset' );
103
104				if ( offset !== $this.offset().top || windowOffset !== $( window ).scrollTop() ) {
105					return false;
106				}
107
108				if ( $currentTarget.hasClass( 'jet-dropdown-arrow' ) ) {
109
110					if ( !subMenu[0] ) {
111						return false;
112					}
113
114					if ( ! $this.hasClass( 'hover-state' ) ) {
115						$this.addClass( 'hover-state' );
116
117						$siblingsItems.removeClass( 'hover-state' );
118						$( '.jet-custom-nav__item.menu-item-has-children', $siblingsItems ).removeClass( 'hover-state' );
119					} else {
120						$this.removeClass( 'hover-state' );
121
122						$( '.jet-custom-nav__item.menu-item-has-children', $this ).removeClass( 'hover-state' );
123					}
124				}
125
126				if ( $currentTarget.hasClass( 'jet-custom-nav__item-link' ) ) {
127
128					if ( '#' === linkHref ) {
129						if ( ! $this.hasClass( 'hover-state' ) ) {
130							$this.addClass( 'hover-state' );
131
132							$siblingsItems.removeClass( 'hover-state' );
133							$( '.jet-custom-nav__item.menu-item-has-children', $siblingsItems ).removeClass( 'hover-state' );
134						} else {
135							$this.removeClass( 'hover-state' );
136
137							$( '.jet-custom-nav__item.menu-item-has-children', $this ).removeClass( 'hover-state' );
138						}
139					} else {
140
141						window.location = linkHref;
142
143						return false;
144					}
145
146				}
147			}
148
149			var initSubMenuPosition = false;
150
151			function setSubMenuPosition(){
152				if ( initSubMenuPosition ) {
153					$target.find( '.jet-custom-nav__sub.inverse-side' ).removeClass( 'inverse-side' );
154					initSubMenuPosition = false;
155				}
156
157				var subMenu  = $( '.jet-custom-nav__sub', $target ),
158					$body    = $( 'body' ),
159					maxWidth = $body.outerWidth( true ),
160					isMobile = 'mobile' === elementor.getCurrentDeviceMode();
161
162				if ( isMobile ) {
163					return;
164				}
165
166				if ( subMenu[0] ) {
167					subMenu.each( function() {
168						var $this = $( this ),
169							subMenuOffsetLeft = $this.offset().left,
170							subMenuOffsetRight = subMenuOffsetLeft + $this.outerWidth( true ),
171							subMenuPosition = $this.closest( '.jet-custom-nav' ).hasClass( 'jet-custom-nav--dropdown-left-side' ) ? 'left-side' : 'right-side';
172
173						if ( 'right-side' === subMenuPosition ) {
174							if ( subMenuOffsetRight >= maxWidth ) {
175								$this.addClass( 'inverse-side' );
176								$this.find( '.jet-custom-nav__sub' ).addClass( 'inverse-side' );
177
178								initSubMenuPosition = true;
179							} else if ( subMenuOffsetLeft < 0 ) {
180								$this.removeClass( 'inverse-side' );
181								$this.find( '.jet-custom-nav__sub' ).removeClass( 'inverse-side' );
182							}
183						} else {
184							if ( subMenuOffsetLeft < 0 ) {
185								$this.addClass( 'inverse-side' );
186								$this.find( '.jet-custom-nav__sub' ).addClass( 'inverse-side' );
187
188								initSubMenuPosition = true;
189							} else if ( subMenuOffsetRight >= maxWidth ) {
190								$this.removeClass( 'inverse-side' );
191								$this.find( '.jet-custom-nav__sub' ).removeClass( 'inverse-side' );
192							}
193						}
194					} );
195				}
196			}
197
198			setSubMenuPosition();
199			$( window ).on( 'resize.JetCustomMenu orientationchange.JetCustomMenu', setSubMenuPosition );
200
201			var initMaxMegaMenuWidth = false;
202
203			function setMaxMegaMenuWidth(){
204				var megaMenu = $( '.jet-custom-nav__mega-sub', $target ),
205					$body    = $( 'body' ),
206					maxWidth = $body.outerWidth( true ),
207					isMobile = 'mobile' === elementor.getCurrentDeviceMode();
208
209				if ( initMaxMegaMenuWidth ) {
210					megaMenu.css( {
211						'maxWidth': ''
212					} );
213
214					initMaxMegaMenuWidth = false;
215				}
216
217				if ( isMobile ) {
218					return;
219				}
220
221				if ( megaMenu[0] ) {
222					megaMenu.each( function() {
223						var $this = $( this ),
224							megaMenuTranslateX = $this.css( 'transform' ).replace( /,/g, "" ).split( " " )[4] || 0,
225							megaMenuOffsetLeft = $this.offset().left - megaMenuTranslateX,
226							megaMenuOffsetRight = megaMenuOffsetLeft + $this.outerWidth( true ),
227							megaMenuPosition = $this.closest( '.jet-custom-nav' ).hasClass( 'jet-custom-nav--dropdown-left-side' ) ? 'left-side' : 'right-side';
228
229						if ( 'right-side' === megaMenuPosition ) {
230							if ( megaMenuOffsetRight >= maxWidth ) {
231								$this.css({
232									'maxWidth': maxWidth - megaMenuOffsetLeft - 10
233								});
234
235								initMaxMegaMenuWidth = true;
236							}
237						} else {
238							if ( megaMenuOffsetLeft < 0 ) {
239								$this.css({
240									'maxWidth': megaMenuOffsetRight - 10
241								});
242
243								initMaxMegaMenuWidth = true;
244							}
245						}
246					} );
247				}
248			}
249
250			setMaxMegaMenuWidth();
251			$( window ).on( 'resize.JetCustomMenu orientationchange.JetCustomMenu', setMaxMegaMenuWidth );
252
253		},
254
255		/**
256		 * Mobile and tablet check funcion.
257		 *
258		 * @return {boolean} Mobile Status
259		 */
260		mobileAndTabletcheck: function() {
261			var check = false;
262
263			(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 )|
263sy(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);
264
265			return check;
266		}
267	};
268
269	$( window ).on( 'elementor/frontend/init', JetMenuWidget.init );
270
271}( 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.