PageSourceSearch

https://www.oudalbarari.com/wp-content/themes/xtra/assets/js/custom.js?ver=4.9.9

js oudalbarari.com collected 2026-10-02 01:39:20 UTC 30,419 bytes, 1,151 lines download raw bytes

1/* Custom theme scripts */
2var Codevz = ( function( $ ) {
3	"use strict";
4
5	var wind = $( window ),
6		body = $( document.body ),
7		page = $( 'html, body' ),
8		inla = $( '.inner_layout' ).length ? $( '.inner_layout' ) : body,
9		timeouts = [];
10
11	// Custom easing.
12	$.extend( $.easing, {
13		def: 'easeInOutCodevz',
14		easeInOutCodevz: function(x) {
15			return x === 0 ? 0 : x === 1 ? 1 : x < 0.5 ? Math.pow( 2, 20 * x - 10 ) / 2 : ( 2 - Math.pow( 2, -20 * x + 10 ) ) / 2;
16		}
17	});
18
19	// Codevz callback.
20	if ( ! $.fn.codevz ) {
21
22		$.fn.codevz = function( data, callback ) {
23
24			if ( $( this ).length ) {
25
26				var $this = $( this ),
27					run = function( e ) {
28
29						var l = e.length, i = 0;
30
31						for( i; i < l; i++ ) {
32
33							var x = $( e[i] );
34
35							if ( x.data( 'codevz' ) !== data ) {
36								callback.apply( x.data( 'codevz', data ), [ x, i ] );
37							}
38
39						}
40
41					};
42
43				if ( Codevz.inview( $this, 100 ) ) {
44
45					run( $this );
46
47				} else {
48
49					$( window ).on( 'scroll.codevz', function() {
50
51						run( $this );
52
53						$( this ).off( 'scroll.codevz' );
54
55					} );
56
57				}
58
59			}
60
61		}
62
63	}
64
65	return {
66
67		inview: function( e, offset ) {
68
69			var offset 			= offset || 0,
70				docViewTop 		= wind.scrollTop(),
71				docViewBottom 	= docViewTop + wind.height(),
72				elemTop 		= e.offset().top,
73				elemBottom 		= elemTop + e.height();
74
75			return ( ( elemTop <= docViewBottom + offset ) && ( elemBottom >= docViewTop - offset ) );
76
77		},
78
79		showOneByOne: function( elements, d ) {
80
81			// Determine direction and set initial styles
82			var initialStyles = body.hasClass( 'rtl' ) ? { right: 10 } : { right: -10 };
83
84			initialStyles.opacity 	 = 0;
85			initialStyles.transition = 'all .2s ease-in-out';
86
87			// Apply initial CSS & Animate each element delay.
88			elements.css( initialStyles ).each( function( i ) {
89
90				var $el = $( this );
91
92				timeouts.push( setTimeout( function() {
93
94					$el.animate({ opacity: 1, right: 0 }, {
95						duration: 100,
96						easing: 'easeInOutCodevz',
97						complete: function() {
98							$el.css({ opacity: '' });
99						}
100					});
101
102				}, 50 * i ) );
103
104			});
105
106		},
107
108		init: function() {
109
110			// First load fade.
111			if ( body.hasClass( 'codevz-first-load-fade' ) ) {
112				setTimeout( function() {
113					body.animate( { opacity: 1 }, 500 );
114				}, 400 );
115			}
116
117			// Header custom shape size.
118			$( 'div[class*="cz_row_shape_"]' ).codevz( 'row_shape', function( x ) {
119
120				Codevz.heightChanged( x, function() {
121
122					var cls = '.' + ( x.attr( 'class' ) || '' ).replace( /  | /g, '.' ),
123						hei = x.height() + 37;
124
125					!x.find( '> style' ).length && x.append( '<style></style>' );
126
127					x.find( '> style' ).html( cls + ' .row:before,' + cls + ' .row:after{width:' + hei + 'px}.elms_row ' + cls + ':before, .elms_row ' + cls + ':after{width:' + hei + 'px}' );
128
129				});
130
131			});
132
133			// Social Dorpdown.
134			body.on( 'click', '.xtra-social-icon-trigger', function() {
135
136				var x 	= $( this ),
137					box = x.next( '.xtra-social-dropdown' );
138
139				if ( box.length ) {
140
141					if ( box.is( ':visible' ) ) {
142						box.fadeOut( 'fast' );
143					} else {
144						box.fadeIn( 'fast' );
145					}
146
147				}
148
149			}).on( 'click', function( e ) {
150
151				if ( $( e.target ).closest( '.cz_elm' ).length ) {
152					return;
153				}
154
155				$( '.xtra-social-dropdown' ).fadeOut( 'fast' );
156
157			});
158
159			// On resize.
160			var alignFull 	= $( '.alignfull' ),
161				headerLine 	= $( '.header_line_1' ),
162				fixedFooter = $( '.cz_fixed_footer' ),
163				videos 		= $( '.cz_iframe, .content iframe, object, embed' ).not( '.wp-embedded-content' ),
164				timeout;
165
166			// Functions on window resize.
167			wind.on( 'resize.xtra', function() {
168
169				clearTimeout( timeout );
170
171				timeout = setTimeout( function() {
172
173					// Current window width.
174					var wind_width = wind.width();
175
176					// WP 5.x gutenberg ready.
177					alignFull.length && alignFull.each( function( i, x ) {
178
179						var x = $( x ), 
180							inla_width = x.parent().width(),
181							from_left  = ( ( wind_width - inla_width ) / 2 );
182
183						x.css( { width: wind_width, left: -from_left } );
184
185					});
186
187					// Footer fixed.
188					if ( fixedFooter.length ) {
189
190						var footerHeight = parseInt( fixedFooter.outerHeight() );
191
192						if ( $( '.cz-sticky-add-to-cart' ).length ) {
193
194							footerHeight += parseInt( $( '.cz-sticky-add-to-cart' ).outerHeight() );
195
196						}
197
198						body.css( 'margin-bottom', footerHeight );
199
200					}
201
202					// Videos iframe auto size.
203					videos.length && videos.each( function( i, x, w ) {
204
205						x = $( x );
206
207						x.attr( 'data-aspectRatio', x.height() / x.width() ).removeAttr( 'height width' );
208
209						w = x.parent().width();
210						x.width( w ).height( w * x.attr( 'data-aspectRatio' ) );
211
212					});
213
214				}, 1000 );
215
216			}).trigger( 'resize.xtra' );
217
218			// Element: line auto height.
219			setTimeout( function() {
220
221				headerLine.codevz( 'full_line', function( x ) {
222
223					Codevz.heightChanged( x.closest( '.row' ), function() {
224
225						x.css( 'height', '0px' );
226
227						setTimeout( function() {
228
229							x.css( 'height', x.closest( '.row' ).height() );
230
231						}, 10 );
232
233					});
234
235				});
236
237			}, body.hasClass( 'elementor-editor-active' ) ? 3000 : 1500 );
238
239			// Posts equality.
240			$( '.cz_default_loop_grid' ).closest( '.cz_posts_container' ).codevz( 'dlg_equal', function( x ) {
241				x.addClass( 'cz_posts_equal' );
242			});
243
244			// Widget nav menu dropdown.
245			$( '.widget_nav_menu .menu-item-has-children > a' ).codevz( 'wnmi', function( x ) {
246
247				if ( ! x.find( '.fa-angle-down' ).length ) {
248					x.append( '<i class="fa fa-angle-down" aria-hidden="true"></i>' );
249				}
250
251			});
252
253			// Widget nav menu dropdown arrow.
254			body.on( 'click', '.widget_nav_menu .menu-item-has-children > a > i', function( e ) {
255
256				$( this ).toggleClass( 'fa-angle-down fa-angle-up' ).closest( 'li' ).find( '> ul' ).slideToggle();
257
258				e.preventDefault();
259
260			// Dropdown menu off screen.
261			}).on( 'mouseenter', '.sf-menu .menu-item-has-children', function() {
262
263				var dropdown = $( this ).find( '> ul' ).removeClass( 'cz_open_menu_reverse' ),
264					isVisible = dropdown.offset().left + dropdown.width() <= inla.width();
265
266				dropdown[ isVisible ? 'removeClass' : 'addClass' ]( 'cz_open_menu_reverse' );
267
268			});
269
270			// Menus
271			$( '.sf-menu' ).each( function( i ) {
272
273				var x 			= $( this ),
274					indicator 	= x.data( 'indicator' ) || ( x.hasClass( 'offcanvas_menu' ) ? 'fa fa-angle-down' : '' ),
275					indicator2 	= x.data( 'indicator2' ) || ( x.hasClass( 'offcanvas_menu' ) ? 'fa fa-angle-down' : '' );
276
277				// Superfish.
278				x.codevzMenu({
279
280					onInit: function() {
281
282						// Menu indicators.
283						$( '.sub-menu', this ).parent().each( function() {
284
285							var en = $( this ),
286								a = en.find( '> a, > h6' );
287
288							if ( ! a.find( '.cz_indicator' ).length ) {
289
290								if ( $( '.cz_menu_subtitle', a ).length ) {
291									$( '.cz_menu_subtitle', a ).before( '<i class="cz_indicator" aria-hidden="true"></i>' );
292								} else {
293									a.append( '<i class="cz_indicator" aria-hidden="true"></i>' );
294								}
295
296							}
297
298							if ( indicator || indicator2 ) {
299								$( '.cz_indicator', a ).addClass( a.closest( '.sub-menu' ).length ? indicator2 : indicator );
300							}
301
302							if ( ! en.find( 'li, div' ).length ) {
303								en.find( '.cz_indicator' ).remove();
304								en.next( 'ul' ).remove();
305							}
306
307							// Empty href.
308							!en.attr( 'href' ) && en.removeClass( 'current_menu' );
309
310							// Fix: Current active menu in dropdown.
311							en.find( '.current_menu' ).length && setTimeout(function() {
312								en.addClass( 'current_menu' );
313							}, 250 );
314
315						});
316
317						// Fix: Keep original current menu in dropdown menu.
318						if ( x.find( '.current_menu ul > .current-menu-item' ).length ) {
319
320							x.find( '.current_menu ul > .current-menu-item' ).siblings().removeClass( 'current_menu' );
321
322						// If there is no current menu but ancestor exists.
323						} else if ( ! x.find( '.current_menu' ).length && x.find( '.current-page-ancestor, .current-post-ancestor, .current-menu-item' ).length ) {
324
325							$( x.find( '.current-page-ancestor, .current-post-ancestor, .current-menu-item' )[0] ).addClass( 'current_menu' );
326
327						}
328
329						// Auto responsive menu items according to window width.
330						if ( x.not( '#menu_header_4, #menu_fixed_side_1, .cz-not-three-dots' ).length ) {
331
332							// Fix single menu in column issue.
333							if ( x.parent().parent().find( '.cz_elm' ).length == 1 ) {
334								x.parent().parent().append( '<div class="cz_elm">&nbsp;</div>' );
335							}
336
337							wind.on( 'resize.responsive', function() {
338
339								var en = x,
340									parent = en.parent(),
341									elementor = en.closest( '.elementor-container' ),
342									menu_margin = parseFloat( parent.css( 'margin-left' ) ) + parseFloat( parent.css( 'margin-right' ) ),
343									elements = 0,
344									container,
345									three_dots = ( body.attr( 'class' ).indexOf( 'codevz-plus' ) >= 0 ) ? '<i class="fa czico-055-three cz-extra-menus" style="margin:0" aria-hidden="true"></i>' : '...';
346
347								setTimeout( function() {
348
349									// Reset
350									en.append( en.find( '.cz-extra-menus > .sub-menu > li' ) ).find( '.cz-extra-menus' ).remove();
351
352									// Add icon dots
353									if ( ! en.find( '.cz-extra-menus' ).length ) {
354										var submenu_title = $( '.cz_menu_subtitle' ).text() ? '<span class="cz_menu_subtitle">&nbsp;</span>' : '';
355										en.append( '<li class="cz-extra-menus cz"><a href="#" class="sf-with-ul" aria-label="More links" aria-hidden="true"><span>&nbsp;' + three_dots + '&nbsp;</span>' + submenu_title + '</a><ul class="sub-menu" aria-hidden="true"></ul></li>');
356									}
357
358									var nw = en.find( '.cz-extra-menus' ), 
359										nw_ul = nw.find( '> ul' );
360
361									nw.hide().prev().addClass( 'cz-last-child' );
362
363									// Get elements width
364									en.parent().parent().find( '.cz_elm' ).not( parent ).each(function() {
365
366										elements += $( this ).outerWidth() + parseFloat( $( this ).css( 'margin-left' ) ) + parseFloat( $( this ).css( 'margin-right' ) );
367
368									});
369
370									// Move back to parent
371									nw_ul.find( '> li' ).appendTo( en );
372
373									// Move to hidden menu
374									$( en.find( '> li' ).not( '.cz-extra-menus' ).get().reverse() ).each( function() {
375
376										if ( elementor.length ) {
377											container = elementor.outerWidth();
378										} else {
379											container = en.closest( '.have_center' ).length ? parent.parent().parent().outerWidth() : parent.parent().outerWidth();
380										}
381
382										if ( ( parent.outerWidth() + menu_margin ) + elements + ( elementor ? 0 : 25 ) > container ) {
383											$( this ).prependTo( nw_ul );
384											nw.show();
385										}
386
387									});
388
389								}, 1000 );
390
391							}).trigger( 'resize.responsive' );
392
393						}
394
395					},
396					onBeforeHide: function( a, b, c, d ) {
397
398						// Fix showOneByOne.
399						for (var i = 0; i < timeouts.length; i++) {
400							clearTimeout( timeouts[i] );
401						}
402
403						timeouts = [];
404
405						// Fix hover execution.
406						$( '.cz' ).css( { opacity: '', right: '' } );
407
408					},
409					onBeforeShow: function() {
410
411						var x = $( this );
412
413						// Submenu items.
414						if ( ! x.is(':visible') ) {
415
416							Codevz.showOneByOne( $( '> .cz', this ) );
417							Codevz.showOneByOne( $( '> .cz .cz', this ) );
418
419							// Submenu Stylish list in megamenu.
420							if ( x.find( '.cz_stylish_list' ).length ) {
421								$( '.cz_stylish_list' ).each( function() {
422									Codevz.showOneByOne( $( '> li', this ) );
423								});
424							}
425
426						}
427
428						// Sub menu.
429						if ( x.hasClass('sub-menu') ) {
430
431							// Check if mega menu is fullwide
432							if ( x.parent().hasClass( 'cz_megamenu_width_fullwide' ) ) {
433
434								var megamenu_row = body,
435									megamenu_row_offset = megamenu_row.offset().left,
436									megamenu_row_width = megamenu_row.width();
437
438								x.attr( 'style', x.attr( 'style' ) + 'width: ' + wind.width() + 'px;left:' + ( megamenu_row_offset - x.parent().offset().left ) + 'px;margin-right:0;margin-left:0;right:auto !important;' );
439
440							}
441
442							// Sub-menu styling
443							if ( x.parent().data( 'sub-menu' ) ) {
444								setTimeout(function() {
445									x.attr( 'style', x.attr( 'style' ) + x.parent().data( 'sub-menu' ) );
446								}, 50 );
447							}
448
449							// Megamenu
450							if ( x.parent().hasClass( 'cz_parent_megamenu' ) ) {
451								x.addClass( 'cz_megamenu_' + $( '> .cz', x ).length ).find( 'ul' ).addClass( 'cz_megamenu_inner_ul clr' );
452							}
453
454							// Megamenu full row
455							if ( x.parent().hasClass( 'cz_megamenu_width_full_row' ) ) {
456
457								var megamenu_row = $( '.row' ),
458									megamenu_row_offset = megamenu_row.offset().left,
459									megamenu_row_width = megamenu_row.width();
460
461								if ( x.closest( '.cz-extra-menus' ).length ) {
462
463									megamenu_row_width = megamenu_row_width - ( megamenu_row.width() - x.parent().offset().left + 10 );
464
465								}
466
467								x.attr( 'style', x.attr( 'style' ) + 'width: ' + megamenu_row_width + 'px;left:' + ( megamenu_row_offset - x.parent().offset().left ) + 'px;' );
468
469							}
470
471						}
472
473						if ( x.closest('.fixed_side').length ) {
474							var pwidth = x.parent().closest( '.sub-menu' ).length ? '.sub-menu' : '.sf-menu',
475								ff_pos = $( '.fixed_side' ).hasClass( 'fixed_side_left' ) ? 'left' : 'right';
476							x.css( ff_pos, x.closest( pwidth ).width() );
477						}
478
479						setTimeout( function() {
480
481							// Lazyload image in dropdown menus.
482							wind.trigger( 'scroll.lazyload' );
483
484							// Fix carousel.
485							if ( x.find( '.slick' ).length ) {
486								wind.trigger( 'resize.slick' );
487							}
488
489						}, 200 );
490
491					}
492
493				});
494
495			});
496
497			// Fix mobile menu icon.
498			$( 'i.icon_mobile_offcanvas_menu' ).removeClass( 'hide' );
499
500			// Dropdown Menu
501			body.on( 'click', '.icon_dropdown_menu', function( e ) {
502
503				var x = $( this ),
504					pos = x.position(),
505					nav = x.parent().find('.sf-menu'),
506					row = $( this ).closest('.row').height(),
507					offset = ( ( inla.outerWidth() + inla.offset().left ) - x.offset().left );
508
509				$( '> .cz', nav ).css( 'opacity', 0 );
510
511				nav.fadeToggle( 'fast' );
512
513				Codevz.showOneByOne( $( '> .cz', nav ) );
514
515				body.on( 'click.cz_idm', function(e) {
516					nav.fadeOut( 'fast' );
517					body.off( 'click.cz_idm' );
518				});
519
520				$( '.cz', nav ).on( 'mouseenter mouseleave', function(e) {
521					e.stopPropagation();
522				}).off( 'click' ).on( 'click', function(e) {
523					if ( $( e.target ).hasClass( 'cz_indicator' ) ) {
524						$( this ).closest( 'li' ).find('> ul').fadeToggle( 'fast' );
525						e.preventDefault();
526						e.stopPropagation();
527					}
528				});
529
530				e.stopPropagation();
531
532			// Open Menu Horizontal
533			}).on( 'click', '.icon_open_horizontal', function( e ) {
534
535				var x = $( this ),
536					pos = x.position(),
537					nav = x.parent().find('.sf-menu'),
538					row = $( this ).closest('.row').height(),
539					offset = ( ( inla.outerWidth() + inla.offset().left ) - x.offset().left );
540
541				nav.fadeToggle( 'fast' );
542
543				Codevz.showOneByOne( $( '> .cz', nav ) );
544
545				body.on( 'click.cz_ioh', function(e) {
546					nav.fadeOut( 'fast' );
547					body.off( 'click.cz_ioh' );
548				});
549
550				e.stopPropagation();
551
552			// Mobile Menu
553			}).on( 'click', 'i.icon_mobile_offcanvas_menu', function() {
554
555				var x = $( this );
556
557				if ( ! x.hasClass( 'done' ) ) {
558
559					Codevz.offCanvas( x.addClass( 'done' ), 1 );
560
561					var ul_offcanvas = $( 'ul.offcanvas_area' ),
562						indicator 	= ul_offcanvas.data( 'indicator' ),
563						default_ind = ul_offcanvas.hasClass( 'offcanvas_menu' ) ? 'fa fa-angle-down' : '',
564						indicator 	= indicator ? indicator : default_ind,
565						indicator2 	= ul_offcanvas.data( 'indicator2' ),
566						indicator2 	= indicator2 ? indicator2 : default_ind,
567						additional  = x.parent().find( '.xtra-mobile-menu-additional' );
568
569					additional.length && ul_offcanvas.append( '<li class="xtra-mobile-menu-additional">' + additional.html() + '</li>' );
570
571					// Add mobile menus indicator
572					if ( indicator.length || indicator2.length ) {
573						x.next( '.sf-menu' ).find( '.sf-with-ul' ).each(function() {
574							$( '.cz_indicator', this ).addClass( ( x.parent().parent().hasClass( 'sf-menu' ) ? indicator : indicator2 ) );
575						});
576					}
577
578					$( '.sf-with-ul, .cz > h6', ul_offcanvas ).on( 'click', function( e ) {
579						if ( $( e.target ).hasClass( 'cz_indicator' ) || $( e.target ).attr( 'href' ) == '#' ) {
580							$( this ).next().slideToggle( 'fast' );
581							e.preventDefault();
582						}
583					});
584
585				}
586
587			// OffCanvas
588			}).on( 'click', '.offcanvas_container > i', function() {
589
590				var x = $( this );
591
592				if ( ! x.hasClass( 'done' ) ) {
593
594					Codevz.offCanvas( x.addClass( 'done' ), 1 );
595
596				}
597
598			// Fullscreen Menu
599			}).on( 'click', '.icon_fullscreen_menu', function( e ) {
600
601				var x = $( '.fullscreen_menu' );
602
603				body.addClass( 'cz_noStickySidebar' ).find( '.fixed_side_1.have_center' ).find( '.fullscreen_menu,.xtra-close-icon' ).appendTo( '.fixed_side_1.have_center' );
604
605				$( '> .cz', x ).css( 'opacity', 0 );
606
607				x.fadeIn( 'fast' ).on( 'click', function( e ) {
608
609					if ( ! $( e.target ).closest( '.cz' ).length ) {
610
611						$( this ).delay( 500 ).fadeOut( 'fast', function() {
612							body.removeClass( 'cz_noStickySidebar' );
613							$( '.xtra-close-icon' ).addClass( 'hide' );
614							page.removeClass( 'no-scroll' );
615						});
616
617					}
618
619				});
620
621				if ( x.is(':visible') ) {
622
623					page.addClass( 'no-scroll' );
624					Codevz.showOneByOne( $( '> .cz', x ) );
625
626				}
627
628				var h = x.find( '> li' ).height() * ( ( x.find( '> li' ).length - 1 ) / 2 );
629
630				x.css( 'padding-top', ( ( wind.height() / 2 ) - h ) );
631
632				$( '.xtra-close-icon' ).toggleClass( 'hide' ).off().on( 'click', function() {
633					$( this ).addClass( 'hide' );
634					x.fadeOut( 'fast' );
635					page.removeClass( 'no-scroll' );
636				});
637
638			// Fullscreen
639			}).on( 'mouseenter mouseleave', 'ul.fullscreen_menu .cz', function( e ) {
640
641				e.stopPropagation();
642
643			}).on( 'click', 'ul.fullscreen_menu .cz', function( e ) {
644
645				if ( $( e.target ).hasClass( 'cz_indicator' ) ) {
646					$( this ).closest( 'li' ).find( '> ul' ).fadeToggle( 'fast' );
647					e.preventDefault();
648					e.stopPropagation();
649				}
650
651			// Hidden fullwidth content
652			}).on( 'click', '.hf_elm_icon', function( e ) {
653
654				var x = $( this );
655
656				x.next( '.hf_elm_area' ).slideToggle( 'fast' ).css({
657					width: inla.outerWidth(),
658					left: inla.offset().left,
659					top: x.offset().top + x.outerHeight()
660				});
661
662				body.on( 'click.cz_hf_elm', function(e) {
663					$( '.hf_elm_area' ).slideUp( 'fast' );
664					body.off( 'click.cz_hf_elm' );
665				});
666
667				e.preventDefault();
668				e.stopPropagation();
669
670			});
671
672			// Clear.
673			$( '.tagcloud' ).addClass( 'clr' );
674
675			// Input buttons to button tag
676			$( '.form-submit .submit, input.search-submit, .wpcf7-submit' ).codevz( 'button', function() {
677
678				var x = $( this );
679
680				$( '<button name="submit" type="submit" class="' + x.attr('class') + '">' + x.val() + '</button>' ).insertAfter( x );
681
682				x.detach();
683
684			});
685
686			// Post views count.
687			$( '.xtra-post-views' ).codevz( 'post_views', function() {
688
689				var x = $( this );
690
691				$.ajax({
692					type: "GET",
693					url: body.data( 'ajax' ) || ajaxurl,
694					dataType: 'html',
695					data: "action=codevz_ajax_post_views&id=" + x.attr( 'data-id' ) + "&nonce=" + x.attr( 'data-nonce' ),
696					success: function( data ) {
697						console.log( data );
698						// Post views count worked.
699					},
700					error: function( xhr, status, error ) {
701						console.log( xhr, status, error );
702					}
703				});
704
705			});
706
707			this.menu_anchor();
708		},
709
710		// Menu Anchor.
711		menu_anchor: function() {
712
713			// Disable Elementor links anchor.
714			if ( typeof elementorFrontend != 'undefined' ) {
715
716				setTimeout( function() {
717
718					elementorFrontend.elements.$document.off(
719						'click', 
720						elementorFrontend.utils.anchors.getSettings( 'selectors.links' ),
721						elementorFrontend.utils.anchors.handleAnchorLinks
722					);
723
724				}, 500 );
725
726			}
727
728			// Prevent hashtag link jump.
729			$( "a[href*='#']" ).not( 'a[target="_blank"]' ).on( 'click.prevent_jump', function( e ) {
730				e.preventDefault();
731			});
732
733			// Init.
734			var aBar 	= body.hasClass( 'admin-bar' ) ? 32 : 0,
735				mLink 	= $( "a[href*='#']" ).not( "a[href='#'],a[target='_blank'],a[href*='#/']" ),
736				sticky 	= $( '.header_is_sticky' ).not( '.smart_sticky, .header_4' ),
737				scrollTop = 0, timeout,
738				scrollToAnchor = function( target ) {
739
740					clearTimeout( timeout );
741
742					timeout = setTimeout( function() {
743
744						target = target.replace( '%20', ' ' );
745						target = ( target.indexOf( '#' ) >= 0 ) ? $( target ) : $( '#' + target );
746
747						if ( target.length && ! target.hasClass( 'cz_popup_modal' ) ) {
748
749							scrollTop = $( document ).scrollTop();
750
751							if ( wind.width() < 768 && $( '.header_4.header_is_sticky' ).length ) {
752								sticky = $( '.header_4.header_is_sticky' ).not( '.smart_sticky' );
753							}
754
755							if ( scrollTop == 0 && sticky.length ) {
756								$( document ).scrollTop( 1 );
757							}
758
759							setTimeout( function() {
760
761								page.animate({ scrollTop: target.offset().top - aBar - ( sticky.outerHeight() || 0 ) }, 1200, 'easeInOutCodevz', function() {
762
763									page.stop();
764
765								});
766
767								$( '.offcanvas-close' ).trigger( 'click' );
768
769							}, scrollTop == 0 ? 450 : 1 );
770
771						}
772
773					}, 50 );
774
775				};
776
777			// Prevent page scroll jumping.
778			var target = window.location.hash;
779			if ( target && target.indexOf( '#/' ) !== 0 ) {
780				target = target.replace( '#', '' ).replace( '%20', ' ' );
781				if ( $( '#' + target ).length ) {
782
783					// Stop scroll.
784					page.animate({scrollTop: 0}, 1);
785
786					// Scroll to anchor.
787					setTimeout(function() {
788						scrollToAnchor( target );
789					}, 1500 );
790				}
791			}
792
793			// Links.
794			if ( mLink.length ) {
795
796				mLink.off( 'click.anchor' ).on( 'click.anchor', function( e ) {
797
798					if ( $( this ).not( 'a[href*="#top"],[data-tab],.cz_popup_modal,.cz_no_anchor,.cz_no_anchor a, .vc_general, .cz_no_anchor a, .cz_lrpr a, .wc-tabs a, .cz_edit_popup_link, .page-numbers a, #cancel-comment-reply-link, .vc_carousel-control, [data-vc-container],.comment-form-rating a,.sm2-bar-ui a,.lwptoc a' ).length ) {
799
800						if ( ! $( e.target ).hasClass( 'cz_indicator' ) ) {
801
802							if ( $( this.hash ).length && location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname ) {
803								scrollToAnchor( this.hash );
804							} else if ( this.hash ) {
805								location = $( this ).attr( 'href' );
806							}
807
808						}
809
810						e.preventDefault();
811
812					}
813
814				});
815
816				var mPage  = $( '.sf-menu' ),
817					mPageH = mPage.outerHeight() + 15,
818					mItems = mPage.find( "a[href*='#']" ).not( "a[href='#'],a[href*='#/']" ),
819					sItems = mItems.map(function(){
820						var item = $( $( this ).attr( "href" ).replace( /\s+|%20/g, "" ).replace( /^.*\#(.*)$/g, "#$1" ) );
821						if ( item.length ) {
822							return item;
823						}
824					});
825
826				wind.on( 'scroll.anchor', function() {
827
828					clearTimeout( timeout );
829
830					timeout = setTimeout( function() {
831
832						var ft = $( this ).scrollTop() + mPageH + aBar + ( sticky.outerHeight() || 0 ),
833							cur = sItems.map(function() {
834								if ( $(this).offset().top < ft )
835									return this;
836								});
837
838						cur = cur[cur.length-1];
839						var id = cur && cur.length ? cur[0].id : "";
840						if ( id && ! $( '#' + id + '.cz_popup_modal' ).length && $( '#' + id ).length ) {
841							body.trigger( 'click' );
842							mItems.parent().removeClass( "current_menu" ).end().filter( "[href*='#" + id + "']" ).parent().addClass( "current_menu" );
843						} else {
844							mItems.parent().removeClass( "current_menu" );
845						}
846
847					}, 50 );
848
849				});
850			}
851		},
852
853		// Height changed = run callback.
854		heightChanged: function( elm, callback ) {
855			var lastHeight = elm.outerHeight(), newHeight;
856
857			// First.
858			callback();
859
860			// Height detect.
861			( function run() {
862
863				newHeight = elm.outerHeight();
864
865				if ( lastHeight != newHeight ) {
866					callback();
867					lastHeight = newHeight;
868				}
869
870				if ( elm.onElementHeightChangeTimer ) {
871					clearTimeout( elm.onElementHeightChangeTimer );
872				}
873
874				elm.onElementHeightChangeTimer = setTimeout( run, 500 );
875
876			})();
877
878		},
879
880		/*
881		*   offCanvas area
882		*/
883		offCanvas: function( selector, click ) {
884
885			var parent  = selector.parent(),
886				area    = selector.next(),
887				layout  = $( '#layout' ),
888				overlay = $( '.cz_overlay' ),
889				isRight, i, 
890				fixed_side = 0,
891				close, timeout;
892
893			if ( area.length ) {
894
895				var area = area.clone(),
896					isRight = area.hasClass( 'inview_right' ),
897					new_class = area.hasClass('sf-menu') ? 'sf-menu offcanvas_area' : 'offcanvas_area offcanvas_original';
898
899				body.prepend( area.removeClass().addClass( 'sidebar_offcanvas_area' ).addClass( new_class + ( isRight ? ' inview_right' : ' inview_left' ) ) );
900				var area_w = area.width() + 80;
901
902				if ( selector.closest( '.elementor-element' ).length ) {
903
904					var elementor_page = selector.closest( '.elementor' ).attr( 'data-elementor-id' );
905					body.addClass( 'elementor-page-' + elementor_page + ' elementor-' + elementor_page );
906
907					var classList = selector.closest( '.elementor-element' ).attr('class').split(/\s+/);
908					$.each( classList, function( index, item ) {
909						if ( item.indexOf( 'elementor-element-' ) == 0 ) {
910							area.addClass( 'elementor-element ' + item );
911						}
912					});
913
914				}
915
916				area.find( '.sub-menu' ).hide();
917
918			} else {
919
920				return;
921
922			}
923
924			// Open icon
925			selector.on( 'click', function(e) {
926
927				if ( area.hasClass( 'active_offcanvas' ) && ! body.hasClass( 'offcanvas_doing' ) ) {
928
929					page.removeClass( 'no-scroll' );
930
931					overlay.trigger( 'click' );
932
933				} else {
934
935					page.addClass( 'no-scroll' );
936
937					$( 'html' ).css( 'margin-top', '0 !important' );
938					$( '#layout' ).css( 'margin-top', '40px !important' );
939
940					// Close icon
941					if ( body.attr( 'class' ).indexOf( 'codevz-plus' ) >= 0 ) {
942						area.before( '<i class="fa czico-198-cancel offcanvas-close" aria-hidden="true"></i>' );
943					} else {
944						area.before( '<i class="fa fa-times offcanvas-close" aria-hidden="true"></i>' );
945					}
946					close = area.prev( '.offcanvas-close' );
947					close.on( 'click', function(e) {
948						if ( click ) {
949							body.removeClass( 'active_offcanvas' );
950							area.removeClass( 'active_offcanvas' );
951	
952							overlay.fadeOut();
953							setTimeout(function() {
954								$( '.offcanvas-close' ).detach();
955								wind.trigger( 'resize' );
956								page.removeClass( 'no-scroll' );
957							}, 500 );
958							
959							click = 0;
960						} else {
961							overlay.trigger( 'click' );
962						}
963					});
964					close.css( ( isRight ? 'right' : 'left' ), area.outerWidth() + fixed_side );
965
966					body.addClass( 'offcanvas_doing active_offcanvas' + ( isRight ? ' cz_offcanvas_right' : ' cz_offcanvas_left' ) );
967					area.addClass( 'active_offcanvas' );
968
969					// FX.
970					$( '> .cz', area ).css( 'opacity', 0 );
971
972					setTimeout( function() {
973						Codevz.showOneByOne( $( '> .cz', area ) );
974					}, 400 );
975
976					if ( wind.width() > 768 ) {
977
978						if ( ( $( '.fixed_side_left' ).length && $( '.cz_offcanvas_left' ).length ) || $( '.fixed_side_right' ).length  && $( '.cz_offcanvas_right' ).length ) {
979							if ( ! $( '#cz_ofs' ).length ) {
980								$( 'head' ).append( '<style id="cz_ofs"></style>' );
981							}
982							fixed_side = $( '.fixed_side' ).width();
983							$( '#cz_ofs' ).html( '.active_offcanvas .offcanvas_area.active_offcanvas{transform:translateX(' + ( isRight ? '-' : '' ) + fixed_side + 'px)}' );
984						}
985						
986					}
987
988					overlay.fadeIn();
989
990					setTimeout(function() {
991
992						body.removeClass( 'offcanvas_doing' );
993
994						if ( area.find( '.cz_acc_child' ).length ) {
995
996							Codevz_Plus.accordion();
997
998						}
999
1000					}, 1250 );
1001				}
1002
1003				e.stopPropagation();
1004			});
1005
1006			// First time
1007			if ( click ) {
1008				selector.trigger( 'click' );
1009			}
1010
1011			// Prevent close on open icon
1012			area.on( 'click', function(e) {
1013				e.stopPropagation();
1014			});
1015
1016			// reCall anchors
1017			this.menu_anchor();
1018
1019			// Click on body
1020			overlay.on( 'click', function( e ) {
1021
1022				if ( $( '.active_offcanvas' ).length && ! body.hasClass( 'offcanvas_doing' ) ) {
1023
1024					body.removeClass( 'active_offcanvas' );
1025					area.removeClass( 'active_offcanvas' );
1026
1027					overlay.fadeOut();
1028
1029					setTimeout(function() {
1030
1031						$( '.offcanvas-close' ).detach();
1032						wind.trigger( 'resize' );
1033						page.removeClass( 'no-scroll' );
1034
1035					}, 500 );
1036
1037				}
1038
1039				setTimeout(function() {
1040
1041					if ( ! overlay.is( ':visible' ) && $( '.active_offcanvas' ).length ) {
1042
1043						$( '.offcanvas-close' ).trigger( 'click' );
1044
1045						page.removeClass( 'no-scroll' );
1046
1047					}
1048
1049				}, 500 );
1050
1051			});
1052
1053			// Close mobile on window resize.
1054			wind.on( 'resize.offcanvas_close', function( e ) {
1055
1056				clearTimeout( timeout );
1057
1058				timeout = setTimeout( function() {
1059
1060					var mh4 = $( '#menu_header_4' );
1061
1062					if( mh4.hasClass( 'active_offcanvas' ) && wind.width() > 768 ) {
1063						mh4.prev( 'i' ).trigger( 'click' );
1064					}
1065
1066				}, 50 );
1067
1068			});
1069
1070			// Reload necessary scripts.
1071			if( ! area.hasClass( 'xtra-reload-js' ) ) {
1072
1073				// Fix menu icon click issue specially on mobile.
1074				area.find( '.cz a' ).on( 'click', function( e ) {
1075
1076					if ( $( e.target ).hasClass( 'cz_indicator' ) ) {
1077
1078						var en = $( this );
1079
1080						en.attr( 'data-href', en.attr( 'href' ) ).attr( 'href', '#' );
1081
1082						setTimeout( function() {
1083							en.attr( 'href', en.attr( 'data-href' ) );
1084						}, 250 );
1085
1086					}
1087
1088				});
1089
1090				// reInit codevz plus.
1091				if ( typeof Codevz_Plus != 'undefined' ) {
1092
1093					Codevz_Plus.init();
1094					if ( typeof Codevz_Plus.working_hours != 'undefined' ) {
1095						Codevz_Plus.working_hours();
1096					}
1097
1098				}
1099
1100				// Lazyload image inside offcanvas.
1101				setTimeout( function() {
1102
1103					$( window ).trigger( 'scroll.lazyload' );
1104
1105					area.find( '[data-src]' ).each( function() {
1106						$( this ).attr( 'src', $( this ).data( 'src' ) ).removeAttr( 'data-src' );
1107					});
1108
1109					area.find( '.cz_tooltip' ).removeClass( 'cz_tooltip_down cz_tooltip_right cz_tooltip_left' ).addClass( 'cz_tooltip_up' );
1110
1111				}, 500 );
1112
1113				// reInit contact form 7.
1114				if( typeof wpcf7 != 'undefined' && area.find( '.wpcf7' ).length ) {
1115
1116					area.find( 'div.wpcf7 > form' ).each( function() {
1117
1118						var $this = $( this );
1119
1120						if ( $.fn.initForm ) {
1121							wpcf7.initForm( $this );
1122
1123							if ( wpcf7.cached ) {
1124								wpcf7.refill( $this );
1125							}
1126						}
1127
1128					} );
1129
1130				}
1131
1132				// reInit Facebook.
1133				setTimeout( function(){
1134					if ( window.FB ) {
1135						FB.XFBML.parse();
1136					}
1137				}, 2000 );
1138
1139				area.addClass( 'xtra-reload-js' );
1140
1141			}
1142
1143		},
1144
1145	};
1146
1147})( jQuery );
1148
1149jQuery( function( $ ) {
1150	Codevz.init();
1151});

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.