PageSourceSearch

https://dalqanrealestate.com/wp-content/plugins/jet-menu/includes/…/public/js/widgets-scripts.js?ver=2.4.15

js dalqanrealestate.com collected 2026-10-05 23:15:28 UTC 14,179 bytes, 400 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				'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					subCloseBehavior: settings.subCloseBehavior,
41					mouseLeaveDelay: settings.mouseLeaveDelay,
42					subTrigger: settings.subTrigger,
43					breakpoint: settings.breakpoint,
44					megaWidthType: settings.megaWidthType,
45					megaWidthSelector: settings.megaWidthSelector,
46					megaAjaxLoad: settings.megaAjaxLoad,
47					signatures: settings.signatures,
48					classes: {
49						instance: 'jet-mega-menu',
50						menuContainer: 'jet-mega-menu-container',
51						menuList: 'jet-mega-menu-list',
52						menuItem: 'jet-mega-menu-item',
53						menuItemLink: 'jet-mega-menu-item__link',
54						subMenuContainer: 'jet-mega-menu-sub-menu',
55						subMenuList: 'jet-mega-menu-sub-menu__list',
56						megaContainer: 'jet-mega-menu-mega-container',
57					}
58				} );
59
60				requestAnimationFrame(() => {
61					window.dispatchEvent( new Event( 'resize' ) );
62				});
63
64			}
65
66			if ( $mobileMenu[0] ) {
67				let menuInstanceId = $mobileMenu.attr( 'id' ),
68				    menuId         = $mobileMenu.data( 'menu-id' ) || false,
69				    menuOptions    = $mobileMenu.data( 'menu-options' ) || {};
70
71				window.jetMenu.createMobileRenderInstance( menuInstanceId, menuId, menuOptions );
72			}
73		},
74
75		widgetCustomMenu: function( $scope ) {
76			var $target = $scope.find( '.jet-custom-nav' ),
77				instance = null,
78				trigger = $target.data( 'trigger' ),
79				targetType = trigger === 'click' ? $target.data( 'target' ) || 'item' : null,
80				menuItem = null,
81				menuItemSelector = trigger === 'click' && targetType === 'sub_icon'
82					? '.jet-dropdown-arrow'
83					: '.jet-custom-nav__item > a';
84
85			if ( ! $target.length ) {
86				return;
87			}
88
89			if ( JetMenuWidget.mobileAndTabletcheck() ) {
90				$scope.on( 'touchstart', '.jet-custom-nav__item > a, .jet-custom-nav__item > a .jet-dropdown-arrow', touchStartItem );
91				$scope.on( 'touchend', '.jet-custom-nav__item > a, .jet-custom-nav__item > a .jet-dropdown-arrow', touchEndItem );
92			} else {
93				if ( trigger === 'click' ) {
94					$scope.on( 'click', menuItemSelector, toggleSubMenu );
95					$scope.on( 'mouseleave', '.jet-custom-nav__item', mouseLeaveHandler );
96				} else {
97					$scope.on( 'mouseenter mouseover', '.jet-custom-nav__item', mouseEnterHandler );
98					$scope.on( 'mouseleave', '.jet-custom-nav__item', mouseLeaveHandler );
99				}
100			}
101
102			function toggleSubMenu( event ) {
103				const $this = $( event.currentTarget ).closest( '.jet-custom-nav__item' );
104
105				if ( ! $this.hasClass( 'menu-item-has-children' ) ) {
106					return;
107				}
108
109				event.preventDefault();
110				event.stopPropagation();
111
112				const isOpen = $this.hasClass( 'hover-state' );
113
114				if ( $this.hasClass( 'hover-state' ) ) {
115					$this.removeClass( 'hover-state' );
116				} else {
117					$this.addClass( 'hover-state' );
118					$this.siblings().removeClass( 'hover-state' );
119				}
120
121				if ( $this.is( '[aria-haspopup="true"]' ) ) {
122					$this.attr( 'aria-expanded', isOpen ? 'false' : 'true' );
123				}
124
125				$this.find('.jet-dropdown-arrow[aria-haspopup="true"]').attr('aria-expanded', isOpen ? 'false' : 'true');
126			}
127
128			function mouseEnterHandler( event ) {
129				menuItem = $( event.target ).parents( '.jet-custom-nav__item' );
130
131				if ( menuItem.is( '[aria-haspopup="true"]' ) ) {
132					menuItem.attr( 'aria-expanded', 'true' );
133				}
134
135				menuItem.addClass( 'hover-state' );
136			}
137
138			function mouseLeaveHandler( event ) {
139				const $this = $( event.currentTarget ).closest( '.jet-custom-nav__item' );
140				const relatedTarget = event.relatedTarget;
141
142				if ( $this.has( relatedTarget ).length > 0 ) {
143					return;
144				}
145
146				menuItem = $this;
147				menuItem.removeClass( 'hover-state' );
148
149				if ( $this.is( '[aria-haspopup="true"]' ) ) {
150					$this.attr( 'aria-expanded', 'false' );
151				}
152
153				$this.find( '.jet-dropdown-arrow[aria-haspopup="true"]' ).attr( 'aria-expanded', 'false' );
154			}
155
156			function touchStartItem( event ) {
157				var $this = $( event.currentTarget ).closest( '.jet-custom-nav__item' );
158
159				$this.data( 'offset', $this.offset().top );
160				$this.data( 'windowOffset', $( window ).scrollTop() );
161			}
162
163			function touchEndItem( event ) {
164				var $currentTarget,
165					$this,
166					$siblingsItems,
167					$link,
168					linkHref,
169					subMenu,
170					offset,
171					windowOffset;
172
173				event.preventDefault();
174				event.stopPropagation();
175
176				$currentTarget = $( event.currentTarget );
177				$this          = $currentTarget.closest( '.jet-custom-nav__item' );
178				$siblingsItems = $this.siblings( '.jet-custom-nav__item.menu-item-has-children' );
179				$link          = $( '> a', $this );
180				linkHref       = $link.attr( 'href' );
181				subMenu        = $( '.jet-custom-nav__sub:first, .jet-custom-nav__mega-sub:first', $this );
182				offset         = $this.data( 'offset' );
183				windowOffset   = $this.data( 'windowOffset' );
184
185				if ( offset !== $this.offset().top || windowOffset !== $( window ).scrollTop() ) {
186					return false;
187				}
188
189				if ( $currentTarget.hasClass( 'jet-dropdown-arrow' ) ) {
190
191					if ( !subMenu[0] ) {
192						return false;
193					}
194
195					const isOpen = $this.hasClass( 'hover-state' );
196
197					if ( ! $this.hasClass( 'hover-state' ) ) {
198						$this.addClass( 'hover-state' );
199
200						$siblingsItems.removeClass( 'hover-state' ).each( function() {
201							const $sibling = $( this );
202
203							if ( $sibling.is( '[aria-haspopup="true"]' ) ) {
204								$sibling.attr( 'aria-expanded', 'false' );
205							}
206
207							$sibling.find('> a > .jet-dropdown-arrow[aria-haspopup="true"]').attr( 'aria-expanded', 'false' );
208						} );
209
210						$siblingsItems.removeClass( 'hover-state' );
211						$( '.jet-custom-nav__item.menu-item-has-children', $siblingsItems ).removeClass( 'hover-state' );
212					} else {
213						$this.removeClass( 'hover-state' );
214
215						$( '.jet-custom-nav__item.menu-item-has-children', $this ).removeClass( 'hover-state' );
216					}
217
218					if ( $this.is( '[aria-haspopup="true"]' ) ) {
219						$this.attr( 'aria-expanded', isOpen ? 'false' : 'true' );
220					}
221
222					$this.find( '> a > .jet-dropdown-arrow[aria-haspopup="true"]' ).attr( 'aria-expanded', isOpen ? 'false' : 'true' );
223
224				}
225
226				if ( $currentTarget.hasClass( 'jet-custom-nav__item-link' ) ) {
227
228					if ( '#' === linkHref ) {
229						if ( ! $this.hasClass( 'hover-state' ) ) {
230							$this.addClass( 'hover-state' );
231
232							$siblingsItems.removeClass( 'hover-state' );
233							$( '.jet-custom-nav__item.menu-item-has-children', $siblingsItems ).removeClass( 'hover-state' );
234						} else {
235							$this.removeClass( 'hover-state' );
236
237							$( '.jet-custom-nav__item.menu-item-has-children', $this ).removeClass( 'hover-state' );
238						}
239					} else {
240
241						window.location = linkHref;
242
243						return false;
244					}
245
246				}
247			}
248
249			var initSubMenuPosition = false;
250
251			function setSubMenuPosition(){
252				if ( initSubMenuPosition ) {
253					$target.find( '.jet-custom-nav__sub.inverse-side' ).removeClass( 'inverse-side' );
254					initSubMenuPosition = false;
255				}
256
257				var subMenu  = $( '.jet-custom-nav__sub', $target ),
258					$body    = $( 'body' ),
259					maxWidth = $body.outerWidth( true ),
260					isMobile = 'mobile' === elementor.getCurrentDeviceMode();
261
262				if ( isMobile ) {
263					return;
264				}
265
266				if ( subMenu[0] ) {
267					subMenu.each( function() {
268						var $this = $( this ),
269							subMenuOffsetLeft = $this.offset().left,
270							subMenuOffsetRight = subMenuOffsetLeft + $this.outerWidth( true ),
271							subMenuPosition = $this.closest( '.jet-custom-nav' ).hasClass( 'jet-custom-nav--dropdown-left-side' ) ? 'left-side' : 'right-side';
272
273						if ( 'right-side' === subMenuPosition ) {
274							if ( subMenuOffsetRight >= maxWidth ) {
275								$this.addClass( 'inverse-side' );
276								$this.find( '.jet-custom-nav__sub' ).addClass( 'inverse-side' );
277
278								initSubMenuPosition = true;
279							} else if ( subMenuOffsetLeft < 0 ) {
280								$this.removeClass( 'inverse-side' );
281								$this.find( '.jet-custom-nav__sub' ).removeClass( 'inverse-side' );
282							}
283						} else {
284							if ( subMenuOffsetLeft < 0 ) {
285								$this.addClass( 'inverse-side' );
286								$this.find( '.jet-custom-nav__sub' ).addClass( 'inverse-side' );
287
288								initSubMenuPosition = true;
289							} else if ( subMenuOffsetRight >= maxWidth ) {
290								$this.removeClass( 'inverse-side' );
291								$this.find( '.jet-custom-nav__sub' ).removeClass( 'inverse-side' );
292							}
293						}
294					} );
295				}
296			}
297
298			setSubMenuPosition();
299			$( window ).on( 'resize.JetCustomMenu orientationchange.JetCustomMenu', setSubMenuPosition );
300
301			var initMaxMegaMenuWidth = false;
302
303			function setMaxMegaMenuWidth(){
304				var megaMenu = $( '.jet-custom-nav__mega-sub', $target ),
305					$body    = $( 'body' ),
306					maxWidth = $body.outerWidth( true ),
307					isMobile = 'mobile' === elementor.getCurrentDeviceMode();
308
309				if ( initMaxMegaMenuWidth ) {
310					megaMenu.css( {
311						'maxWidth': ''
312					} );
313
314					initMaxMegaMenuWidth = false;
315				}
316
317				if ( isMobile ) {
318					return;
319				}
320
321				if ( megaMenu[0] ) {
322					megaMenu.each( function() {
323						var $this = $( this ),
324							megaMenuTranslateX = $this.css( 'transform' ).replace( /,/g, "" ).split( " " )[4] || 0,
325							megaMenuOffsetLeft = $this.offset().left - megaMenuTranslateX,
326							megaMenuOffsetRight = megaMenuOffsetLeft + $this.outerWidth( true ),
327							megaMenuPosition = $this.closest( '.jet-custom-nav' ).hasClass( 'jet-custom-nav--dropdown-left-side' ) ? 'left-side' : 'right-side';
328
329						if ( 'right-side' === megaMenuPosition ) {
330							if ( megaMenuOffsetRight >= maxWidth ) {
331								$this.css({
332									'maxWidth': maxWidth - megaMenuOffsetLeft - 10
333								});
334
335								initMaxMegaMenuWidth = true;
336							}
337						} else {
338							if ( megaMenuOffsetLeft < 0 ) {
339								$this.css({
340									'maxWidth': megaMenuOffsetRight - 10
341								});
342
343								initMaxMegaMenuWidth = true;
344							}
345						}
346					} );
347				}
348			}
349
350			setMaxMegaMenuWidth();
351			$( window ).on( 'resize.JetCustomMenu orientationchange.JetCustomMenu', setMaxMegaMenuWidth );
352
353		},
354
355		widgetMobileMenu: function( $scope ) {
356			let $target        = $scope.find( '.jet-mobile-menu' ),
357				menuInstanceId = $target.attr( 'id' ),
358				menuId         = $target.data( 'menu-id' ) || false,
359				menuOptions    = $target.data( 'menu-options' ) || {};
360
361			if ( ! $target[0] ) {
362				return;
363			}
364
365			window.jetMenu.createMobileRenderInstance( menuInstanceId, menuId, menuOptions );
366		},
367
368		/**
369		 * Specific check for iPad Pro\Air in Safari with touch input,
370		 * only if the cookie has not been set yet.
371		 *
372		 * @return {boolean}
373		 */
374		shouldSetIpadProCookie: function() {
375			const isSafari  = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
376			const isMacLike = navigator.userAgent.includes( 'Macintosh' );
377			const hasTouch  = 'ontouchend' in window || navigator.maxTouchPoints > 1;
378
379			const cookieNotSet = document.cookie.indexOf( 'is_ipad_pro=true' ) === -1;
380
381			return isSafari && isMacLike && hasTouch && cookieNotSet;
382		},
383
384		/**
385		 * Mobile and tablet check funcion.
386		 *
387		 * @return {boolean} Mobile Status
388		 */
389		mobileAndTabletcheck: function() {
390			var check = false;
391
392			(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);
393
394			return check;
395		}
396	};
397
398	$( window ).on( 'elementor/frontend/init', JetMenuWidget.init );
399
400}( 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.