PageSourceSearch

https://medi-gyn.com/wp-content/plugins/header-footer-elementor/inc/js/frontend.js

js medi-gyn.com collected 2026-09-24 12:59:04 UTC 33,934 bytes, 884 lines download raw bytes

1( function( $ ) {
2
3	/**
4	 * Sanitize icon markup before injecting it into the DOM.
5	 *
6	 * The nav-menu toggle/close icons are read from data-* attributes and
7	 * rendered as HTML. Only Font Awesome <i> and inline SVG icons are
8	 * legitimate here, so every other element — and every event handler or
9	 * URL-bearing attribute — is stripped to prevent DOM-based XSS.
10	 *
11	 * Parsing happens inside a <template>, whose content is inert: images do
12	 * not load and scripts do not run, so no payload fires during sanitization.
13	 *
14	 * @since 2.9.2
15	 * @param {string} markup Raw icon markup from a data attribute.
16	 * @return {string} Sanitized markup safe to pass to jQuery .html().
17	 */
18	function hfe_sanitize_icon_html( markup ) {
19		if ( 'string' !== typeof markup || '' === markup ) {
20			return '';
21		}
22
23		// Icon-only elements: basic shapes plus the paint/structural elements
24		// (gradients, clip paths, masks, patterns, markers) that multi-colour
25		// SVG icons rely on. All of these are non-scriptable and hold no text
26		// content. Deliberately excludes elements with special parsing
27		// (RCDATA/RAWTEXT such as <title>, <desc>, <text>, <style>, <textarea>)
28		// to avoid mutation-XSS on the re-parse done by jQuery .html().
29		var allowed_tags = [
30			'I', 'SPAN', 'SVG', 'PATH', 'G', 'DEFS', 'SYMBOL',
31			'CIRCLE', 'ELLIPSE', 'LINE', 'POLYLINE', 'POLYGON', 'RECT',
32			'LINEARGRADIENT', 'RADIALGRADIENT', 'STOP', 'CLIPPATH', 'MASK', 'PATTERN', 'MARKER'
33		];
34
35		var template = document.createElement( 'template' );
36		template.innerHTML = markup;
37
38		Array.prototype.slice.call( template.content.querySelectorAll( '*' ) ).forEach( function( node ) {
39			// Drop anything that is not an allowed icon element.
40			if ( -1 === allowed_tags.indexOf( node.tagName.toUpperCase() ) ) {
41				if ( node.parentNode ) {
42					node.parentNode.removeChild( node );
43				}
44				return;
45			}
46
47			// Strip event handlers and URL/style attributes on the kept elements.
48			Array.prototype.slice.call( node.attributes ).forEach( function( attr ) {
49				var name = attr.name.toLowerCase();
50				if (
51					0 === name.indexOf( 'on' ) ||
52					'src' === name ||
53					'href' === name ||
54					'xlink:href' === name ||
55					'style' === name ||
56					'formaction' === name
57				) {
58					node.removeAttribute( attr.name );
59				}
60			} );
61		} );
62
63		return template.innerHTML;
64	}
65
66	/**
67	* Search widget JS
68	*/
69
70	var WidgethfeSearchButton = function( $scope, $ ){
71
72		if ( 'undefined' == typeof $scope )
73			return;
74
75			var $input = $scope.find( "input.hfe-search-form__input" );
76			var $clear = $scope.find( "button#clear" );
77			var $clear_with_button = $scope.find( "button#clear-with-button" );
78			var $search_button = $scope.find( ".hfe-search-submit" );
79			var $toggle_search = $scope.find( ".hfe-search-icon-toggle input" );
80
81		$scope.find( '.hfe-search-icon-toggle' ).on( 'click', function( ){
82			$scope.find( ".hfe-search-form__input" ).trigger( 'focus' );						
83		});	
84		
85		$scope.find( ".hfe-search-form__input" ).on( 'focus', function(){
86			$scope.find( ".hfe-search-button-wrapper" ).addClass( "hfe-input-focus" );
87		});
88
89		$scope.find( ".hfe-search-form__input" ).blur( function() {
90			$scope.find( ".hfe-search-button-wrapper" ).removeClass( "hfe-input-focus" );
91		});
92  		   
93
94		$search_button.on( 'touchstart click', function(){
95			$input.submit();
96		});
97
98		$toggle_search.css( 'padding-right', $toggle_search.next().outerWidth() + 'px' );
99
100	
101		$input.on( 'keyup', function(){
102			$clear.style = (this.value.length) ? $clear.css('visibility','visible'): $clear.css('visibility','hidden');
103			$clear_with_button.style = (this.value.length) ? $clear_with_button.css('visibility','visible'): $clear_with_button.css('visibility','hidden');
104			$clear_with_button.css( 'right', $search_button.outerWidth() + 'px' );
105		});
106
107		$clear.on("click",function(){
108			this.style = $clear.css('visibility','hidden');
109			$input.value = "";
110		});
111		$clear_with_button.on("click",function(){
112			this.style = $clear_with_button.css('visibility','hidden');
113			$input.value = "";
114		});
115		
116	};
117		/**
118	 * Nav Menu handler Function.
119	 *
120	 */
121	var WidgethfeNavMenuHandler = function( $scope, $ ) {
122
123		if ( 'undefined' == typeof $scope )
124			return;
125		
126		var id = $scope.data( 'id' );
127		var wrapper = $scope.find('.elementor-widget-hfe-nav-menu ');		
128		var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
129		var flyout_data = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'flyout-class' );
130		var last_item = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'last-item' );
131		var last_item_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'last-item' );
132
133		var menu_items_links        = $( '.elementor-element-' + id + ' .hfe-nav-menu nav li a' );
134		var menu_items_links_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper li a' );
135		if (menu_items_links.length > 0) {
136			_handle_current_menu_item_class( menu_items_links );
137		}
138
139		if (menu_items_links_flyout.length > 0) {
140			_handle_current_menu_item_class( menu_items_links_flyout );
141		}
142
143		$( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
144
145		_toggleClick( id );
146
147		_handlePolylangSwitcher( $scope );
148
149		_handleSinglePageMenu( id, layout );
150
151		if( 'horizontal' !== layout ){
152
153			_eventClick( id );
154		}else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches ) {
155
156			_eventClick( id );
157		}else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
158
159			_eventClick( id );
160		}
161
162		$( '.elementor-element-' + id + ' .hfe-flyout-trigger .hfe-nav-menu-icon' ).off( 'click keyup' ).on( 'click keyup', function() {
163
164			_openMenu( id );
165		} );
166
167		$( '.elementor-element-' + id + ' .hfe-flyout-close' ).off( 'click keyup' ).on( 'click keyup', function() {
168
169			_closeMenu( id );
170		} );
171
172		$( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).off( 'click' ).on( 'click', function() {
173
174			_closeMenu( id );
175		} );	
176
177
178		$scope.find( '.sub-menu' ).each( function() {
179
180			var parent = $( this ).closest( '.menu-item' );
181
182			$scope.find( parent ).addClass( 'parent-has-child' );
183			$scope.find( parent ).removeClass( 'parent-has-no-child' );
184		});
185
186		if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
187			$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'hfe-button-wrapper elementor-widget-button' );
188			$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' );			
189		}
190
191		_borderClass( id );	
192
193		$( window ).on( 'resize', function(){ 
194
195			if( 'horizontal' !== layout ) {
196
197				_eventClick( id );
198			}else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches ) {
199
200				_eventClick( id );
201			}else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
202
203				_eventClick( id );
204			}
205
206			if( 'horizontal' == layout && window.matchMedia( "( min-width: 977px )" ).matches){
207
208				$( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).next().css( 'position', 'absolute');	
209			}
210
211			if( 'expandible' == layout || 'flyout' == layout ){
212
213				_toggleClick( id );
214			}else if ( 'vertical' == layout || 'horizontal' == layout ) {
215				if( window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))){
216
217					_toggleClick( id );					
218				}else if ( window.matchMedia( "( max-width: 1024px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
219					
220					_toggleClick( id );
221				}else{
222					var $toggle = $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' );
223                    var $nextElement= $toggle.next();
224                    var width = $nextElement.parent().width();
225                    if( $nextElement.length ){
226						$nextElement.css( 'width', width + 'px' );
227						$nextElement.css( 'left', '0' );
228					}
229				}
230			}
231
232			_borderClass( id );	
233
234		});
235
236        // Acessibility functions
237
238  		$scope.find( '.parent-has-child .hfe-has-submenu-container a').attr( 'aria-haspopup', 'true' );
239  		$scope.find( '.parent-has-child .hfe-has-submenu-container a').attr( 'aria-expanded', 'false' );
240
241		var hef_navmenu_toggle = $scope.find( '.hfe-nav-menu__toggle' );
242		hef_navmenu_toggle.attr( 'aria-haspopup', 'true' );
243		hef_navmenu_toggle.attr( 'aria-expanded', 'false' );
244
245		if ( window.matchMedia( "( max-width: 1024px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
246			hef_navmenu_toggle.find('i').attr('aria-hidden', 'false');
247		}
248		if ( window.matchMedia( "( max-width: 768px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') ) {
249			hef_navmenu_toggle.find('i').attr('aria-hidden', 'false');
250		}
251
252  		// End of accessibility functions
253
254		$( document ).trigger( 'hfe_nav_menu_init', id );
255
256		// Add keyboard navigation for expandable menu
257		if ( 'expandible' === layout ) {
258			$( '.elementor-element-' + id + ' nav' ).on( 'keydown', function(e) {
259				var $currentElement = $( document.activeElement );
260				var $menuItems = $( this ).find( 'li > a:visible' );
261				var currentIndex = $menuItems.index( $currentElement );
262
263				switch( e.key ) {
264					case 'Escape': // Escape key - close menu
265						$( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( 'click' );
266						$( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).focus();
267						e.preventDefault();
268						break;
269					case 'ArrowDown': // Down arrow
270						if ( currentIndex < $menuItems.length - 1 ) {
271							$menuItems.eq( currentIndex + 1 ).focus();
272						}
273						e.preventDefault();
274						break;
275					case 'ArrowUp': // Up arrow
276						if ( currentIndex > 0 ) {
277							$menuItems.eq( currentIndex - 1 ).focus();
278						}
279						e.preventDefault();
280						break;
281					case 'Tab': // Tab key
282						// Let default tab behavior work but close menu when tabbing out
283						if ( e.shiftKey && currentIndex === 0 ) {
284							// Shift+Tab on first item - close menu
285							setTimeout(function() {
286								if ( !$( '.elementor-element-' + id + ' nav' ).find( ':focus' ).length ) {
287									$( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( 'click' );
288								}
289							}, 10);
290						} else if ( !e.shiftKey && currentIndex === $menuItems.length - 1 ) {
291							// Tab on last item - close menu
292							setTimeout(function() {
293								if ( !$( '.elementor-element-' + id + ' nav' ).find( ':focus' ).length ) {
294									$( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( 'click' );
295								}
296							}, 10);
297						}
298						break;
299				}
300			});
301		}
302
303		$( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).on( 'keyup', function(e){
304
305			var $this = $( this );
306
307			// Handle Enter and Space keys for submenu toggle
308			if ( e.key === 'Enter' || e.key === 'Space' ) {
309				e.preventDefault();
310				e.stopPropagation();
311			} else {
312				return; // Only handle Enter and Space keys
313			}
314
315		  	if( $this.parent().hasClass( 'menu-active' ) ) {
316
317		  		$this.parent().removeClass( 'menu-active' );
318		  		$this.attr( 'aria-expanded', 'false' );
319
320		  		$this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
321		  		$this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
322
323		  		$this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu
323-active' );
324		  		$this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
325			}else { 
326
327				$this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
328		  		$this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
329
330		  		$this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
331		  		$this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
332
333				$this.parent().siblings().find( '.hfe-has-submenu-container a' ).attr( 'aria-expanded', 'false' );
334
335				$this.parent().next().removeClass( 'menu-active' );
336		  		$this.parent().prev().removeClass( 'menu-active' );
337
338				event.preventDefault();
339
340				$this.parent().addClass( 'menu-active' );
341
342				if( 'horizontal' !== layout ){
343					$this.addClass( 'sub-menu-active' );	
344				}
345				
346				$this.find( 'a' ).attr( 'aria-expanded', 'true' );
347				$this.attr( 'aria-expanded', 'true' );
348
349				$this.next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } );
350
351				if ( 'horizontal' !== layout ) {
352						
353		  			$this.next().css( 'position', 'relative');			
354				} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) {
355										
356  					$this.next().css( 'position', 'relative');		  					
357				} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
358					
359  					if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
360
361  						$this.next().css( 'position', 'relative');	
362  					} else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) {
363  						
364  						$this.next().css( 'position', 'absolute');	
365  					}
366  				}		
367			}
368		});
369
370		$( '.elementor-element-' + id + ' li.menu-item' ).on( 'keyup', function(e){
371			var $this = $( this );
372
373	 		$this.next().find( 'a' ).attr( 'aria-expanded', 'false' );
374	 		$this.prev().find( 'a' ).attr( 'aria-expanded', 'false' );
375	  		
376	  		$this.next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
377	  		$this.prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
378	  		
379	  		$this.siblings().removeClass( 'menu-active' );
380	  		$this.next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
381		  	$this.prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
382		  		
383		});
384	};
385
386	function _handle_current_menu_item_class( layout_links ) {
387		layout_links.each(
388			function () {
389				var $this = $( this );
390				if ($this.is( '[href*="#"]' )) {
391					var menu_item_parent = $this.parent();
392					menu_item_parent.removeClass( 'current-menu-item current-menu-ancestor' );
393					$this.click(
394						function () {
395							var current_index  = menu_item_parent.index(),
396								parent_element = $this.closest( 'ul' );
397							parent_element.find( 'li' ).not( ':eq(' + current_index + ')' ).removeClass( 'current-menu-item current-menu-ancestor' );
398							menu_item_parent.addClass( 'current-menu-item current-menu-ancestor' );
399						}
400					)
401				}
402			}
403		);
404	}
405
406	function _openMenu( id ) {
407
408		var flyout_content = $( '#hfe-flyout-content-id-' + id );
409		var layout = $( '#hfe-flyout-content-id-' + id ).data( 'layout' );
410		var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' );
411		var wrap_width = flyout_content.width() + 'px';
412		var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout );
413
414		$( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeIn( 100 );
415
416		if( 'left' == layout ) {
417
418			$( 'body' ).css( 'margin-left' , '0' );
419			container.css( 'left', '0' );
420
421			if( 'push' == layout_type ) {
422
423				$( 'body' ).addClass( 'hfe-flyout-animating' ).css({ 
424					position: 'absolute',
425					width: '100%',
426					'margin-left' : wrap_width,
427					'margin-right' : 'auto'
428				});
429			}	
430
431			container.addClass( 'hfe-flyout-show' );	
432		} else {
433
434			$( 'body' ).css( 'margin-right', '0' );
435			container.css( 'right', '0' );
436
437			if( 'push' == layout_type ) {
438
439				$( 'body' ).addClass( 'hfe-flyout-animating' ).css({ 
440					position: 'absolute',
441					width: '100%',
442					'margin-left' : '-' + wrap_width,
443					'margin-right' : 'auto',
444				});
445			}
446
447			container.addClass( 'hfe-flyout-show' );
448		}		
449	}
450
451	function _closeMenu( id ) {
452
453		var flyout_content = $( '#hfe-flyout-content-id-' + id );
454		var layout    = $( '#hfe-flyout-content-id-' + id ).data( 'layout' );
455		var wrap_width = flyout_content.width() + 'px';
456		var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' );
457		var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout );
458
459		$( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeOut( 100 );	
460
461		if( 'left' == layout ) {
462
463			container.css( 'left', '-' + wrap_width );
464
465			if( 'push' == layout_type ) {
466
467				$( 'body' ).css({ 
468					position: '',
469					'margin-left' : '',
470					'margin-right' : '',
471				});
472
473				setTimeout( function() {
474					$( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ 
475						width: '',
476					});
477				});
478			}	
479
480			container.removeClass( 'hfe-flyout-show' );					
481		} else {
482			container.css( 'right', '-' + wrap_width );
483			
484			if( 'push' == layout_type ) {
485
486				$( 'body' ).css({
487					position: '',
488					'margin-right' : '',
489					'margin-left' : '',
490				});
491
492				setTimeout( function() {
493					$( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ 
494						width: '',
495					});
496				});
497			}
498			container.removeClass( 'hfe-flyout-show' );
499		}	
500	}
501
502	function _eventClick( id ){
503
504		var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
505
506		$( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).off( 'click' ).on( 'click', function( event ) {
507
508			var $this = $( this );
509
510			if( $( '.elementor-element-' + id ).hasClass( 'hfe-link-redirect-child' ) ) {
511
512				if( $this.hasClass( 'sub-menu-active' ) ) {
513
514					if( ! $this.next().hasClass( 'sub-menu-open' ) ) {
515
516						$this.find( 'a' ).attr( 'aria-expanded', 'false' );
517
518						if( 'horizontal' !== layout ){
519
520							event.preventDefault();
521
522							$this.next().css( 'position', 'relative' );	
523						} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) {
524							
525							event.preventDefault();
526
527							$this.next().css( 'position', 'relative' );	
528						} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches && ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) {
529							
530							event.preventDefault();	
531
532							$this.next().css( 'position', 'relative' );	
533						}	
534					
535						$this.removeClass( 'sub-menu-active' );
536						$this.nextAll('.sub-menu').removeClass( 'sub-menu-open' );
537						$this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
538						$this.nextAll('.sub-menu').css( { 'transition': 'none'} );
539					} else{
540
541						$this.find( 'a' ).attr( 'aria-expanded', 'false' );
542						
543						$this.removeClass( 'sub-menu-active' );
544						$this.nextAll('.sub-menu').removeClass( 'sub-menu-open' );
545						$this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
546						$this.nextAll('.sub-menu').css( { 'transition': 'none'} );
547
548						if ( 'horizontal' !== layout ){
549
550							$this.next().css( 'position', 'relative' );
551						} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) {
552							
553							$this.next().css( 'position', 'relative' );	
554							
555						} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches && ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) {
556							
557							$this.next().css( 'position', 'absolute' );				
558						}	  								
559					}		  											
560				} else {
561
562					$this.find( 'a' ).attr( 'aria-expanded', 'true' );
563					if ( 'horizontal' !== layout ) {
564						
565						event.preventDefault();
566						$this.next().css( 'position', 'relative');			
567					} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) {
568						
569						event.preventDefault();
570						$this.next().css( 'position', 'relative');		  					
571					} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
572						event.preventDefault();
573
574						if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
575
576							$this.next().css( 'position', 'relative');	
577						} else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) {
578							
579							$this.next().css( 'position', 'absolute');	
580						}
581					}	
582							
583					$this.addClass( 'sub-menu-active' );
584					$this.nextAll('.sub-menu').addClass( 'sub-menu-open' );
585					$this.nextAll('.sub-menu').css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } );
586					$this.nextAll('.sub-menu').css( { 'transition': '0.3s ease'} );
587				}
588			}
589		});
590
591		$( '.elementor-element-' + id + ' .hfe-menu-toggle' ).off( 'click keyup' ).on( 'click keyup',function( event ) {
592
593			var $this = $( this );
594
595		  	if( $this.parent().parent().hasClass( 'menu-active' ) ) {
596
597	  			event.preventDefault();
598
599				$this.parent().parent().removeClass( 'menu-active' );
600				$this.parent().parent().next().css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
601
602				if ( 'horizontal' !== layout ) {
603						
604		  			$this.parent().parent().next().css( 'position', 'relative');			
605				} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) {
606										
607  					$this.parent().parent().next().css( 'position', 'relative');		  					
608				} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
609					
610  					if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
611
612  						$this.parent().parent().next().css( 'position', 'relative');	
613  					} else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) {
614  						
615  						$this.parent().parent().next().css( 'position', 'absolute');	
616  					}
617  				}
618			}else { 
619
620				event.preventDefault();
621
622				$this.parent().parent().addClass( 'menu-active' );
623
624				$this.parent().parent().next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } );
625
626				if ( 'horizontal' !== layout ) {
627						
628		  			$this.parent().parent().next().css( 'position', 'relative');			
629				} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches && ($( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile'))) {
630										
631  					$this.parent().parent().next().css( 'position', 'relative');		  					
632				} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
633					
634  					if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
635
636  						$this.parent().parent().next().css( 'position', 'relative');	
637  					} else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) {
638  						
639  						$this.parent().parent().next().css( 'position', 'absolute');	
640  					}
641  				}		
642			}
643		});
644	}
645
646	function _borderClass( id ){
647
648		var last_item = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'last-item' );
649		var last_item_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'last-item' );
650		var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
651
652		$( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown');
653
654		if ( window.matchMedia( "( max-width: 767px )" ).matches ) {
655
656			if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet')){
657				
658				$( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown');
659				if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
660					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'hfe-button-wrapper elementor-widget-button' );
661					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' );	
662				}	
663			}else{
664				
665				$( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown');
666				if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
667					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'hfe-button-wrapper elementor-widget-button' );
668					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' );	
669				}
670			}
671		}else if ( window.matchMedia( "( max-width: 1024px )" ).matches ) {
672
673			if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
674				
675				$( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown');
676				if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
677					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'hfe-button-wrapper elementor-widget-button' );
678					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' );	
679				}
680			}else{
681				
682				$( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown');
683				if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
684					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'hfe-button-wrapper elementor-widget-button' );
685					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' );
686				}
687			}
688		}else {
689			var $parent_element = $( '.elementor-element-' + id );
690			$parent_element.find( 'nav').removeClass( 'hfe-dropdown' );
691			if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
692				$parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'hfe-button-wrapper elementor-widget-button' );
693				$parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' );
694			}
695		}
696
697		var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
698		if( 'expandible' == layout ){
699			if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
700				$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'hfe-button-wrapper elementor-widget-button' );
701				$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' );			
702			}			
703		}
704	}
705
706	function _toggleClick( id ){
707
708		if ( $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).hasClass( 'hfe-active-menu-full-width' ) ){
709
710			var $toggle = $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' );
711			var $nextElement= $toggle.next();
712
713			if( $nextElement.length ){
714				$nextElement.css( 'left', '0' );
715				
716				var $section = $( '.elementor-element-' + id ).closest('.elementor-section, .e-con-boxed.e-parent, .e-con-full.e-parent');
717				if ( $section.length ) {
718					var width = $section.outerWidth();
719					var sec_pos = $section.offset().left - $toggle.next().offset().left;
720					$nextElement.css( 'width', width + 'px' );
721					$nextElement.css( 'left', sec_pos + 'px' );
722				}
723			}
724		}
725
726		$( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).off( 'click keyup' ).on( 'click keyup', function( event ) {
727
728			// Handle keyboard events properly
729			if ( event.type === 'keyup' && event.key !== 'Enter' && event.key !== 'Space' ) {
730				return; // Only handle Enter and Space keys
731			}
732
733			// Prevent default for keyboard events to avoid scrolling
734			if ( event.type === 'keyup' ) {
735				event.preventDefault();
736			}
737
738			var $this = $( this );
739			var $selector = $this.next();
740
741			if ( $this.hasClass( 'hfe-active-menu' ) ) {
742
743				var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
744				var full_width = $selector.data( 'full-width' );
745				var toggle_icon = $( '.elementor-element-' + id + ' nav' ).data( 'toggle-icon' );
746
747				$( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( hfe_sanitize_icon_html( toggle_icon ) );
748
749				$this.removeClass( 'hfe-active-menu' );
750				$this.attr( 'aria-expanded', 'false' );
751				
752				if ( 'yes' == full_width ){
753
754					$this.removeClass( 'hfe-active-menu-full-width' );
755				
756					$selector.css( 'width', 'auto' );
757					$selector.css( 'left', '0' );
758					$selector.css( 'z-index', '0' );
759				}				
760			} else {
761
762				var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
763				var full_width = $selector.data( 'full-width' );
764				var close_icon = $( '.elementor-element-' + id + ' nav' ).data( 'close-icon' );
765
766				$( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( hfe_sanitize_icon_html( close_icon ) );
767				
768				$this.addClass( 'hfe-active-menu' );
769				$this.attr( 'aria-expanded', 'true' );
770
771				if ( 'yes' == full_width ){
772
773					$this.addClass( 'hfe-active-menu-full-width' );
774
775					var closestElement = $( '.elementor-element-' + id ).closest('.elementor-section, .e-con-boxed.e-parent, .e-con-full.e-parent');
776					var width = closestElement.outerWidth();
777					var sec_pos = closestElement.offset().left - $selector.offset().left;
778				
779					$selector.css( 'width', width + 'px' );
780					$selector.css( 'left', sec_pos + 'px' );
781					$selector.css( 'z-index', '9999' );
782				}
783			}
784
785			if( $( '.elementor-element-' + id + ' nav' ).hasClass( 'menu-is-active' ) ) {
786
787				$( '.elementor-element-' + id + ' nav' ).removeClass( 'menu-is-active' );
788			}else {
789
790				$( '.elementor-element-' + id + ' nav' ).addClass( 'menu-is-active' );
791				
792				// Focus on first menu item when menu opens
793				if ( event.type === 'keyup' ) {
794					setTimeout(function() {
795						$selector.find('li:first-child > a').focus();
796					}, 100);
797				}
798			}				
799		} );
800	}
801
802	function _handleSinglePageMenu( id, layout ) {
803		$( '.elementor-element-' + id + ' ul.hfe-nav-menu li a' ).on(
804			'click',
805			function ( event ) {
806				var $this = $( this );
807				var link  = $this.attr( 'href' );
808				var linkValue = '';
809				
810				// Check if this is an anchor link
811				if ( link && link.includes( '#' ) ) {
812					// Get the hash value
813					if ( link.charAt(0) === '#' ) {
814						event.preventDefault();
815						linkValue = link.slice( 1 );
816					} else {
817						var index = link.indexOf( '#' );
818						if ( index !== -1 ) {
819							linkValue = link.slice( index + 1 );
820						}
821					}
822				}
823				
824				if ( linkValue.length > 0 ) {
825					var targetSection = $( '#' + linkValue );
826
827					if ( targetSection.length ) {	// Check if the target section exists.
828						$('html, body').animate({
829							scrollTop: targetSection.offset().top
830						}, 800); 
831					}
832
833					// Close the menu after clicking anchor link
834					setTimeout(function() {
835						if ( 'expandible' == layout ) {
836							// For expandible layout, trigger click on toggle if menu is open
837							var $toggle = $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' );
838							if ( $toggle.hasClass( 'hfe-active-menu' ) ) {
839								$toggle.trigger( 'click' );
840							}
841						} else if ( 'flyout' == layout ) {
842							// For flyout layout, use the close menu function
843							_closeMenu( id );
844						} else {
845							// For horizontal and vertical layouts on mobile/tablet
846							if ( window.matchMedia( '(max-width: 1024px)' ).matches ) {
847								if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') || 
848									 $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') ) {
849									var $toggle = $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' );
850									if ( $toggle.hasClass( 'hfe-active-menu' ) ) {
851										$toggle.trigger( 'click' );
852									}
853								}
854							}
855						}
856					}, 100); // Small delay to ensure smooth scrolling starts first
857				}
858			}
859		);
860	}
861
862	/**
863	 * This function handles polylang plugin's lang switcher if present in the menu.
864	 *
865	 * @param {Object}
865 $scope The current element(hfe nav menu) wrapped with jQuery.
866	 */
867	function _handlePolylangSwitcher( $scope ) {
868		var polylangSwitcher = $scope.find( '.hfe-nav-menu nav .pll-parent-menu-item a.hfe-menu-item' );
869		var hrefProperty     = polylangSwitcher.prop( 'href' );
870		if ( undefined !== hrefProperty && hrefProperty.includes( '#' ) ) {
871			var index = hrefProperty.indexOf( '#' );
872			var value = hrefProperty.slice( index );
873			if ( value === '#pll_switcher' ) {
874				polylangSwitcher.prop( 'href', '#' );
875			}
876		}
877	}
878
879	$( window ).on( 'elementor/frontend/init', function () {
880
881		elementorFrontend.hooks.addAction( 'frontend/element_ready/navigation-menu.default', WidgethfeNavMenuHandler );
882		elementorFrontend.hooks.addAction( 'frontend/element_ready/hfe-search-button.default', WidgethfeSearchButton );
883	});
884} )( 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.