PageSourceSearch

https://theroofcrafters.com/wp-content/plugins/header-footer-elementor/inc/js/frontend.js?ver=2.0.3

js theroofcrafters.com collected 2026-09-26 12:58:50 UTC 27,723 bytes, 715 lines download raw bytes

1( function( $ ) {
2
3	/**
4	* Search widget JS
5	*/
6
7	var WidgethfeSearchButton = function( $scope, $ ){
8
9		if ( 'undefined' == typeof $scope )
10			return;
11
12			var $input = $scope.find( "input.hfe-search-form__input" );
13			var $clear = $scope.find( "button#clear" );
14			var $clear_with_button = $scope.find( "button#clear-with-button" );
15			var $search_button = $scope.find( ".hfe-search-submit" );
16			var $toggle_search = $scope.find( ".hfe-search-icon-toggle input" );
17
18		$scope.find( '.hfe-search-icon-toggle' ).on( 'click', function( ){
19			$scope.find( ".hfe-search-form__input" ).trigger( 'focus' );						
20		});	
21		
22		$scope.find( ".hfe-search-form__input" ).on( 'focus', function(){
23			$scope.find( ".hfe-search-button-wrapper" ).addClass( "hfe-input-focus" );
24		});
25
26		$scope.find( ".hfe-search-form__input" ).blur( function() {
27			$scope.find( ".hfe-search-button-wrapper" ).removeClass( "hfe-input-focus" );
28		});
29  		   
30
31		$search_button.on( 'touchstart click', function(){
32			$input.submit();
33		});
34
35		$toggle_search.css( 'padding-right', $toggle_search.next().outerWidth() + 'px' );
36
37	
38		$input.on( 'keyup', function(){
39			$clear.style = (this.value.length) ? $clear.css('visibility','visible'): $clear.css('visibility','hidden');
40			$clear_with_button.style = (this.value.length) ? $clear_with_button.css('visibility','visible'): $clear_with_button.css('visibility','hidden');
41			$clear_with_button.css( 'right', $search_button.outerWidth() + 'px' );
42		});
43
44		$clear.on("click",function(){
45			this.style = $clear.css('visibility','hidden');
46			$input.value = "";
47		});
48		$clear_with_button.on("click",function(){
49			this.style = $clear_with_button.css('visibility','hidden');
50			$input.value = "";
51		});
52		
53	};
54		/**
55	 * Nav Menu handler Function.
56	 *
57	 */
58	var WidgethfeNavMenuHandler = function( $scope, $ ) {
59
60		if ( 'undefined' == typeof $scope )
61			return;
62		
63		var id = $scope.data( 'id' );
64		var wrapper = $scope.find('.elementor-widget-hfe-nav-menu ');		
65		var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
66		var flyout_data = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'flyout-class' );
67		var last_item = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'last-item' );
68		var last_item_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'last-item' );
69
70		var menu_items_links        = $( '.elementor-element-' + id + ' .hfe-nav-menu nav li a' );
71		var menu_items_links_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper li a' );
72		if (menu_items_links.length > 0) {
73			_handle_current_menu_item_class( menu_items_links );
74		}
75
76		if (menu_items_links_flyout.length > 0) {
77			_handle_current_menu_item_class( menu_items_links_flyout );
78		}
79
80		$( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
81
82		_toggleClick( id );
83
84		_handlePolylangSwitcher( $scope );
85
86		_handleSinglePageMenu( id, layout );
87
88		if( 'horizontal' !== layout ){
89
90			_eventClick( id );
91		}else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches ) {
92
93			_eventClick( id );
94		}else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
95
96			_eventClick( id );
97		}
98
99		$( '.elementor-element-' + id + ' .hfe-flyout-trigger .hfe-nav-menu-icon' ).off( 'click keyup' ).on( 'click keyup', function() {
100
101			_openMenu( id );
102		} );
103
104		$( '.elementor-element-' + id + ' .hfe-flyout-close' ).off( 'click keyup' ).on( 'click keyup', function() {
105
106			_closeMenu( id );
107		} );
108
109		$( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).off( 'click' ).on( 'click', function() {
110
111			_closeMenu( id );
112		} );	
113
114
115		$scope.find( '.sub-menu' ).each( function() {
116
117			var parent = $( this ).closest( '.menu-item' );
118
119			$scope.find( parent ).addClass( 'parent-has-child' );
120			$scope.find( parent ).removeClass( 'parent-has-no-child' );
121		});
122
123		if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
124			$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' );
125			$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' );			
126		}
127
128		_borderClass( id );	
129
130		$( window ).on( 'resize', function(){ 
131
132			if( 'horizontal' !== layout ) {
133
134				_eventClick( id );
135			}else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 767px )" ).matches ) {
136
137				_eventClick( id );
138			}else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
139
140				_eventClick( id );
141			}
142
143			if( 'horizontal' == layout && window.matchMedia( "( min-width: 977px )" ).matches){
144
145				$( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).next().css( 'position', 'absolute');	
146			}
147
148			if( 'expandible' == layout || 'flyout' == layout ){
149
150				_toggleClick( id );
151			}else if ( 'vertical' == layout || 'horizontal' == layout ) {
152				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'))){
153
154					_toggleClick( id );					
155				}else if ( window.matchMedia( "( max-width: 1024px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
156					
157					_toggleClick( id );
158				}
159			}
160
161			_borderClass( id );	
162
163		});
164
165        // Acessibility functions
166
167  		$scope.find( '.parent-has-child .hfe-has-submenu-container a').attr( 'aria-haspopup', 'true' );
168  		$scope.find( '.parent-has-child .hfe-has-submenu-container a').attr( 'aria-expanded', 'false' );
169
170		var hef_navmenu_toggle = $scope.find( '.hfe-nav-menu__toggle' );
171		hef_navmenu_toggle.attr( 'aria-haspopup', 'true' );
172		hef_navmenu_toggle.attr( 'aria-expanded', 'false' );
173
174		if ( window.matchMedia( "( max-width: 1024px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
175			hef_navmenu_toggle.find('i').attr('aria-hidden', 'false');
176		}
177		if ( window.matchMedia( "( max-width: 768px )" ).matches && $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') ) {
178			hef_navmenu_toggle.find('i').attr('aria-hidden', 'false');
179		}
180
181  		// End of accessibility functions
182
183		$( document ).trigger( 'hfe_nav_menu_init', id );
184
185		$( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).on( 'keyup', function(e){
186
187			var $this = $( this );
188
189		  	if( $this.parent().hasClass( 'menu-active' ) ) {
190
191		  		$this.parent().removeClass( 'menu-active' );
192
193		  		$this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
194		  		$this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
195
196		  		$this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu
196-active' );
197		  		$this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
198			}else { 
199
200				$this.parent().next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
201		  		$this.parent().prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
202
203		  		$this.parent().next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
204		  		$this.parent().prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
205
206				$this.parent().siblings().find( '.hfe-has-submenu-container a' ).attr( 'aria-expanded', 'false' );
207
208				$this.parent().next().removeClass( 'menu-active' );
209		  		$this.parent().prev().removeClass( 'menu-active' );
210
211				event.preventDefault();
212
213				$this.parent().addClass( 'menu-active' );
214
215				if( 'horizontal' !== layout ){
216					$this.addClass( 'sub-menu-active' );	
217				}
218				
219				$this.find( 'a' ).attr( 'aria-expanded', 'true' );
220
221				$this.next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } );
222
223				if ( 'horizontal' !== layout ) {
224						
225		  			$this.next().css( 'position', 'relative');			
226				} 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'))) {
227										
228  					$this.next().css( 'position', 'relative');		  					
229				} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
230					
231  					if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
232
233  						$this.next().css( 'position', 'relative');	
234  					} else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) {
235  						
236  						$this.next().css( 'position', 'absolute');	
237  					}
238  				}		
239			}
240		});
241
242		$( '.elementor-element-' + id + ' li.menu-item' ).on( 'keyup', function(e){
243			var $this = $( this );
244
245	 		$this.next().find( 'a' ).attr( 'aria-expanded', 'false' );
246	 		$this.prev().find( 'a' ).attr( 'aria-expanded', 'false' );
247	  		
248	  		$this.next().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
249	  		$this.prev().find('ul').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
250	  		
251	  		$this.siblings().removeClass( 'menu-active' );
252	  		$this.next().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
253		  	$this.prev().find( 'div.hfe-has-submenu-container' ).removeClass( 'sub-menu-active' );
254		  		
255		});
256	};
257
258	function _handle_current_menu_item_class( layout_links ) {
259		layout_links.each(
260			function () {
261				var $this = $( this );
262				if ($this.is( '[href*="#"]' )) {
263					var menu_item_parent = $this.parent();
264					menu_item_parent.removeClass( 'current-menu-item current-menu-ancestor' );
265					$this.click(
266						function () {
267							var current_index  = menu_item_parent.index(),
268								parent_element = $this.closest( 'ul' );
269							parent_element.find( 'li' ).not( ':eq(' + current_index + ')' ).removeClass( 'current-menu-item current-menu-ancestor' );
270							menu_item_parent.addClass( 'current-menu-item current-menu-ancestor' );
271						}
272					)
273				}
274			}
275		);
276	}
277
278	function _openMenu( id ) {
279
280		var flyout_content = $( '#hfe-flyout-content-id-' + id );
281		var layout = $( '#hfe-flyout-content-id-' + id ).data( 'layout' );
282		var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' );
283		var wrap_width = flyout_content.width() + 'px';
284		var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout );
285
286		$( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeIn( 100 );
287
288		if( 'left' == layout ) {
289
290			$( 'body' ).css( 'margin-left' , '0' );
291			container.css( 'left', '0' );
292
293			if( 'push' == layout_type ) {
294
295				$( 'body' ).addClass( 'hfe-flyout-animating' ).css({ 
296					position: 'absolute',
297					width: '100%',
298					'margin-left' : wrap_width,
299					'margin-right' : 'auto'
300				});
301			}	
302
303			container.addClass( 'hfe-flyout-show' );	
304		} else {
305
306			$( 'body' ).css( 'margin-right', '0' );
307			container.css( 'right', '0' );
308
309			if( 'push' == layout_type ) {
310
311				$( 'body' ).addClass( 'hfe-flyout-animating' ).css({ 
312					position: 'absolute',
313					width: '100%',
314					'margin-left' : '-' + wrap_width,
315					'margin-right' : 'auto',
316				});
317			}
318
319			container.addClass( 'hfe-flyout-show' );
320		}		
321	}
322
323	function _closeMenu( id ) {
324
325		var flyout_content = $( '#hfe-flyout-content-id-' + id );
326		var layout    = $( '#hfe-flyout-content-id-' + id ).data( 'layout' );
327		var wrap_width = flyout_content.width() + 'px';
328		var layout_type = $( '#hfe-flyout-content-id-' + id ).data( 'flyout-type' );
329		var container = $( '.elementor-element-' + id + ' .hfe-flyout-container .hfe-side.hfe-flyout-' + layout );
330
331		$( '.elementor-element-' + id + ' .hfe-flyout-overlay' ).fadeOut( 100 );	
332
333		if( 'left' == layout ) {
334
335			container.css( 'left', '-' + wrap_width );
336
337			if( 'push' == layout_type ) {
338
339				$( 'body' ).css({ 
340					position: '',
341					'margin-left' : '',
342					'margin-right' : '',
343				});
344
345				setTimeout( function() {
346					$( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ 
347						width: '',
348					});
349				});
350			}	
351
352			container.removeClass( 'hfe-flyout-show' );					
353		} else {
354			container.css( 'right', '-' + wrap_width );
355			
356			if( 'push' == layout_type ) {
357
358				$( 'body' ).css({
359					position: '',
360					'margin-right' : '',
361					'margin-left' : '',
362				});
363
364				setTimeout( function() {
365					$( 'body' ).removeClass( 'hfe-flyout-animating' ).css({ 
366						width: '',
367					});
368				});
369			}
370			container.removeClass( 'hfe-flyout-show' );
371		}	
372	}
373
374	function _eventClick( id ){
375
376		var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
377
378		$( '.elementor-element-' + id + ' div.hfe-has-submenu-container' ).off( 'click' ).on( 'click', function( event ) {
379
380			var $this = $( this );
381
382			if( $( '.elementor-element-' + id ).hasClass( 'hfe-link-redirect-child' ) ) {
383
384				if( $this.hasClass( 'sub-menu-active' ) ) {
385
386					if( ! $this.next().hasClass( 'sub-menu-open' ) ) {
387
388						$this.find( 'a' ).attr( 'aria-expanded', 'false' );
389
390						if( 'horizontal' !== layout ){
391
392							event.preventDefault();
393
394							$this.next().css( 'position', 'relative' );	
395						} 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'))) {
396							
397							event.preventDefault();
398
399							$this.next().css( 'position', 'relative' );	
400						} 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'))) {
401							
402							event.preventDefault();	
403
404							$this.next().css( 'position', 'relative' );	
405						}	
406					
407						$this.removeClass( 'sub-menu-active' );
408						$this.nextAll('.sub-menu').removeClass( 'sub-menu-open' );
409						$this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
410						$this.nextAll('.sub-menu').css( { 'transition': 'none'} );
411					} else{
412
413						$this.find( 'a' ).attr( 'aria-expanded', 'false' );
414						
415						$this.removeClass( 'sub-menu-active' );
416						$this.nextAll('.sub-menu').removeClass( 'sub-menu-open' );
417						$this.nextAll('.sub-menu').css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
418						$this.nextAll('.sub-menu').css( { 'transition': 'none'} );
419
420						if ( 'horizontal' !== layout ){
421
422							$this.next().css( 'position', 'relative' );
423						} 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'))) {
424							
425							$this.next().css( 'position', 'relative' );	
426							
427						} 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'))) {
428							
429							$this.next().css( 'position', 'absolute' );				
430						}	  								
431					}		  											
432				} else {
433
434					$this.find( 'a' ).attr( 'aria-expanded', 'true' );
435					if ( 'horizontal' !== layout ) {
436						
437						event.preventDefault();
438						$this.next().css( 'position', 'relative');			
439					} 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'))) {
440						
441						event.preventDefault();
442						$this.next().css( 'position', 'relative');		  					
443					} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
444						event.preventDefault();
445
446						if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
447
448							$this.next().css( 'position', 'relative');	
449						} else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) {
450							
451							$this.next().css( 'position', 'absolute');	
452						}
453					}	
454							
455					$this.addClass( 'sub-menu-active' );
456					$this.nextAll('.sub-menu').addClass( 'sub-menu-open' );
457					$this.nextAll('.sub-menu').css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } );
458					$this.nextAll('.sub-menu').css( { 'transition': '0.3s ease'} );
459				}
460			}
461		});
462
463		$( '.elementor-element-' + id + ' .hfe-menu-toggle' ).off( 'click keyup' ).on( 'click keyup',function( event ) {
464
465			var $this = $( this );
466
467		  	if( $this.parent().parent().hasClass( 'menu-active' ) ) {
468
469	  			event.preventDefault();
470
471				$this.parent().parent().removeClass( 'menu-active' );
472				$this.parent().parent().next().css( { 'visibility': 'hidden', 'opacity': '0', 'height': '0' } );
473
474				if ( 'horizontal' !== layout ) {
475						
476		  			$this.parent().parent().next().css( 'position', 'relative');			
477				} 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'))) {
478										
479  					$this.parent().parent().next().css( 'position', 'relative');		  					
480				} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
481					
482  					if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
483
484  						$this.parent().parent().next().css( 'position', 'relative');	
485  					} else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) {
486  						
487  						$this.parent().parent().next().css( 'position', 'absolute');	
488  					}
489  				}
490			}else { 
491
492				event.preventDefault();
493
494				$this.parent().parent().addClass( 'menu-active' );
495
496				$this.parent().parent().next().css( { 'visibility': 'visible', 'opacity': '1', 'height': 'auto' } );
497
498				if ( 'horizontal' !== layout ) {
499						
500		  			$this.parent().parent().next().css( 'position', 'relative');			
501				} 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'))) {
502										
503  					$this.parent().parent().next().css( 'position', 'relative');		  					
504				} else if ( 'horizontal' === layout && window.matchMedia( "( max-width: 1024px )" ).matches ) {
505					
506  					if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
507
508  						$this.parent().parent().next().css( 'position', 'relative');	
509  					} else if ( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-none') ) {
510  						
511  						$this.parent().parent().next().css( 'position', 'absolute');	
512  					}
513  				}		
514			}
515		});
516	}
517
518	function _borderClass( id ){
519
520		var last_item = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'last-item' );
521		var last_item_flyout = $( '.elementor-element-' + id + ' .hfe-flyout-wrapper' ).data( 'last-item' );
522		var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
523
524		$( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown');
525
526		if ( window.matchMedia( "( max-width: 767px )" ).matches ) {
527
528			if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-mobile') || $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet')){
529				
530				$( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown');
531				if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
532					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'elementor-button-wrapper' );
533					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' );	
534				}	
535			}else{
536				
537				$( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown');
538				if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
539					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' );
540					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' );	
541				}
542			}
543		}else if ( window.matchMedia( "( max-width: 1024px )" ).matches ) {
544
545			if( $( '.elementor-element-' + id ).hasClass('hfe-nav-menu__breakpoint-tablet') ) {
546				
547				$( '.elementor-element-' + id + ' nav').addClass('hfe-dropdown');
548				if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
549					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'elementor-button-wrapper' );
550					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' );	
551				}
552			}else{
553				
554				$( '.elementor-element-' + id + ' nav').removeClass('hfe-dropdown');
555				if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
556					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' );
557					$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' );
558				}
559			}
560		}else {
561			var $parent_element = $( '.elementor-element-' + id );
562			$parent_element.find( 'nav').removeClass( 'hfe-dropdown' );
563			if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
564				$parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).parent().addClass( 'elementor-button-wrapper' );
565				$parent_element.find( 'li.menu-item:last-child a.hfe-menu-item' ).addClass( 'elementor-button' );
566			}
567		}
568
569		var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
570		if( 'expandible' == layout ){
571			if( ( 'cta' == last_item || 'cta' == last_item_flyout ) && 'expandible' != layout ){
572				$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).parent().removeClass( 'elementor-button-wrapper' );
573				$( '.elementor-element-' + id + ' li.menu-item:last-child a.hfe-menu-item' ).removeClass( 'elementor-button' );			
574			}			
575		}
576	}
577
578	function _toggleClick( id ){
579
580		if ( $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).hasClass( 'hfe-active-menu-full-width' ) ){
581
582			var $toggle = $( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' );
583			var $nextElement= $toggle.next();
584
585			if( $nextElement.length ){
586				$nextElement.css( 'left', '0' );
587				
588				var $section = $( '.elementor-element-' + id ).closest('.elementor-section');
589				if ( $section.length ) {
590					var width = $section.outerWidth();
591					var sec_pos = $section.offset().left - $toggle.next().offset().left;
592					$nextElement.css( 'width', width + 'px' );
593					$nextElement.css( 'left', sec_pos + 'px' );
594				}
595			}
596		}
597
598		$( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).off( 'click keyup' ).on( 'click keyup', function( event ) {
599
600			var $this = $( this );
601			var $selector = $this.next();
602
603			if ( $this.hasClass( 'hfe-active-menu' ) ) {
604
605				var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
606				var full_width = $selector.data( 'full-width' );
607				var toggle_icon = $( '.elementor-element-' + id + ' nav' ).data( 'toggle-icon' );
608
609				$( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( toggle_icon );
610
611				$this.removeClass( 'hfe-active-menu' );
612				$this.attr( 'aria-expanded', 'false' );
613				
614				if ( 'yes' == full_width ){
615
616					$this.removeClass( 'hfe-active-menu-full-width' );
617				
618					$selector.css( 'width', 'auto' );
619					$selector.css( 'left', '0' );
620					$selector.css( 'z-index', '0' );
621				}				
622			} else {
623
624				var layout = $( '.elementor-element-' + id + ' .hfe-nav-menu' ).data( 'layout' );
625				var full_width = $selector.data( 'full-width' );
626				var close_icon = $( '.elementor-element-' + id + ' nav' ).data( 'close-icon' );
627
628				$( '.elementor-element-' + id).find( '.hfe-nav-menu-icon' ).html( close_icon );
629				
630				$this.addClass( 'hfe-active-menu' );
631				$this.attr( 'aria-expanded', 'true' );
632
633				if ( 'yes' == full_width ){
634
635					$this.addClass( 'hfe-active-menu-full-width' );
636
637					var closestElement = $( '.elementor-element-' + id ).closest('.elementor-section, .e-con-boxed');
638					var width = closestElement.outerWidth();
639					var sec_pos = closestElement.offset().left - $selector.offset().left;
640				
641					$selector.css( 'width', width + 'px' );
642					$selector.css( 'left', sec_pos + 'px' );
643					$selector.css( 'z-index', '9999' );
644				}
645			}
646
647			if( $( '.elementor-element-' + id + ' nav' ).hasClass( 'menu-is-active' ) ) {
648
649				$( '.elementor-element-' + id + ' nav' ).removeClass( 'menu-is-active' );
650			}else {
651
652				$( '.elementor-element-' + id + ' nav' ).addClass( 'menu-is-active' );
653			}				
654		} );
655	}
656
657	function _handleSinglePageMenu( id, layout ) {
658		$( '.elementor-element-' + id + ' ul.hfe-nav-menu li a' ).on(
659			'click',
660			function () {
661				var $this = $( this );
662				var link  = $this.attr( 'href' );
663				var linkValue = '';
664				if ( link.includes( '#' ) ) {
665					var index     = link.indexOf( '#' );
666					linkValue = link.slice( index + 1 );
667				}
668				if ( linkValue.length > 0 ) {
669					if ( 'expandible' == layout ) {
670						$( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( "click" );
671						if ($this.hasClass( 'hfe-sub-menu-item' )) {
672							$( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" );
673						}
674					} else {
675						if ( window.matchMedia( '(max-width: 1024px)' ).matches && ( 'horizontal' == layout || 'vertical' == layout ) ) {
676							$( '.elementor-element-' + id + ' .hfe-nav-menu__toggle' ).trigger( "click" );
677							if ($this.hasClass( 'hfe-sub-menu-item' )) {
678								$( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" );
679							}
680						} else {
681							if ($this.hasClass( 'hfe-sub-menu-item' )) {
682								_closeMenu( id );
683								$( '.elementor-element-' + id + ' .hfe-menu-toggle' ).trigger( "click" );
684							}
685							_closeMenu( id );
686						}
687					}
688				}
689			}
690		);
691	}
692
693	/**
694	 * This function handles polylang plugin's lang switcher if present in the menu.
695	 *
696	 * @param {Object}
696 $scope The current element(hfe nav menu) wrapped with jQuery.
697	 */
698	function _handlePolylangSwitcher( $scope ) {
699		var polylangSwitcher = $scope.find( '.hfe-nav-menu nav .pll-parent-menu-item a.hfe-menu-item' );
700		var hrefProperty     = polylangSwitcher.prop( 'href' );
701		if ( undefined !== hrefProperty && hrefProperty.includes( '#' ) ) {
702			var index = hrefProperty.indexOf( '#' );
703			var value = hrefProperty.slice( index );
704			if ( value === '#pll_switcher' ) {
705				polylangSwitcher.prop( 'href', '#' );
706			}
707		}
708	}
709
710	$( window ).on( 'elementor/frontend/init', function () {
711
712		elementorFrontend.hooks.addAction( 'frontend/element_ready/navigation-menu.default', WidgethfeNavMenuHandler );
713		elementorFrontend.hooks.addAction( 'frontend/element_ready/hfe-search-button.default', WidgethfeSearchButton );
714	});
715} )( 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.