PageSourceSearch

https://altwood.co.il/wp-content/themes/xtra/js/custom.js

js altwood.co.il collected 2026-10-05 07:44:25 UTC 38,486 bytes, 1,042 lines download raw bytes

1/* Custom codevz menu - 1.7.6 */
2!function(e,s){"use strict";var o=function(){var o={bcClass:"sf-breadcrumb",menuClass:"sf-js-enabled",anchorClass:"sf-with-ul",menuArrowClass:"sf-arrows"},n=function(){var s=/^(?![\w\W]*Windows Phone)[\w\W]*(iPhone|iPad|iPod)/i.test(navigator.userAgent);return s&&e("html").css("cursor","pointer").on("click",e.noop),s}(),t=function(){var e=document.documentElement.style;return"behavior"in e&&"fill"in e&&/iemobile/i.test(navigator.userAgent)}(),i=function(){return!!s.PointerEvent}(),r=function(e,s){var n=o.menuClass;s.cssArrows&&(n+=" "+o.menuArrowClass),e.toggleClass(n)},a=function(s,n){return s.find("li."+n.pathClass).slice(0,n.pathLevels).addClass(n.hoverClass+" "+o.bcClass).filter(function(){return e(this).children(n.popUpSelector).hide().show().length}).removeClass(n.pathClass)},l=function(e){e.children("a").toggleClass(o.anchorClass)},h=function(e){var s=e.css("ms-touch-action"),o=e.css("touch-action");o=o||s,o="pan-y"===o?"auto":"pan-y",e.css({"ms-touch-action":o,"touch-action":o})},u=function(e){return e.closest("."+o.menuClass)},p=function(e){return u(e).data("sf-options")},c=function(){var s=e(this),o=p(s);clearTimeout(o.sfTimer),s.siblings().codevzMenu("hide").end().codevzMenu("show")},f=function(s){s.retainPath=e.inArray(this[0],s.$path)>-1,this.codevzMenu("hide"),this.parents("."+s.hoverClass).length||(s.onIdle.call(u(this)),s.$path.length&&e.proxy(c,s.$path)())},d=function(){var s=e(this),o=p(s);n?e.proxy(f,s,o)():(clearTimeout(o.sfTimer),o.sfTimer=setTimeout(e.proxy(f,s,o),o.delay))},v=function(s){var o=e(this),n=p(o),t=o.siblings(s.data.popUpSelector);return n.onHandleTouch.call(t)===!1?this:void(t.length>0&&t.is(":hidden")&&(o.one("click.codevzMenu",!1),"MSPointerDown"===s.type||"pointerdown"===s.type?o.trigger("focus"):e.proxy(c,o.parent("li"))()))},m=function(s,o){var r="li:has("+o.popUpSelector+")";e.fn.hoverIntent&&!o.disableHI?s.hoverIntent(c,d,r):s.on("mouseenter.codevzMenu",r,c).on("mouseleave.codevzMenu",r,d);var a="MSPointerDown.codevzMenu";i&&(a="pointerdown.codevzMenu"),n||(a+=" touchend.codevzMenu"),t&&(a+=" mousedown.codevzMenu"),s.on("focusin.codevzMenu","li",c).on("focusout.codevzMenu","li",d).on(a,"a",o,v)};return{hide:function(s){if(this.length){var o=this,n=p(o);if(!n)return this;var t=n.retainPath===!0?n.$path:"",i=o.find("li."+n.hoverClass).add(this).not(t).removeClass(n.hoverClass).children(n.popUpSelector),r=n.speedOut;if(s&&(i.show(),r=0),n.retainPath=!1,n.onBeforeHide.call(i)===!1)return this;i.hide()}return this},show:function(){var e=p(this);if(!e)return this;var s=this.addClass(e.hoverClass),o=s.children(e.popUpSelector);return e.onBeforeShow.call(o)===!1?this:(o.show(),this)},destroy:function(){return this.each(function(){var s,n=e(this),t=n.data("sf-options");return t?(s=n.find(t.popUpSelector).parent("li"),clearTimeout(t.sfTimer),r(n,t),l(s),h(n),n.off(".codevzMenu").off(".hoverIntent"),s.children(t.popUpSelector).attr("style",function(e,s){return s.replace(/display[^;]+;?/g,"")}),t.$path.removeClass(t.hoverClass+" "+o.bcClass).addClass(t.pathClass),n.find("."+t.hoverClass).removeClass(t.hoverClass),t.onDestroy.call(n),void n.removeData("sf-options")):!1})},init:function(s){return this.each(function(){var n=e(this);if(n.data("sf-options"))return!1;var t=e.extend({},e.fn.codevzMenu.defaults,s),i=n.find(t.popUpSelector).parent("li");t.$path=a(n,t),n.data("sf-options",t),r(n,t),l(i),h(n),m(n,t),i.not("."+o.bcClass).codevzMenu("hide",!0),t.onInit.call(this)})}}}();e.fn.codevzMenu=function(s,n){return o[s]?o[s].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof s&&s?e.error("Method "+s+" does not exist on jQuery.fn.codevzMenu"):o.init.apply(this,arguments)},e.fn.codevzMenu.defaults={popUpSelector:"ul,.sf-mega",hoverClass:"sfHover",pathClass:"overrideThisToUse",pathLevels:1,delay:300,easing:'linear',animation:{opacity:"show"},animationOut:{opacity:"hide"},speed:100,speedOut:100,cssArrows:!0,disableHI:!1,onInit:e.noop,onBeforeShow:e.noop,onShow:e.noop,onBeforeHide:e.noop,onHide:e.noop,onIdle:e.noop,onDestroy:e.noop,onHandleTouch:e.noop}}(jQuery,window);
3
4/**
5 * Custom theme scripts
6 *
7 * @author Codevz
8 * @website www.codevz.com
9 */
10var Codevz = (function($) {
11	"use strict";
12
13	$.fn.codevz = function( n, i ) {
14		$( this ).each(function( a ) {
15			var e = $( this );
16
17			if ( e.data( 'codevz' ) !== n || $( '.vc_editor' ).length ) {
18				i.apply( e.data( 'codevz', n ), [ a ] );
19			}
20		});
21	}
22
23	var body = $( 'body' ),
24		wind = $( window ),
25		inla = $( '.inner_layout' ),
26		abar = ( $( '.admin-bar' ).length ? 32 : 0 );
27
28	return {
29		init: function() {
30			this.search();
31			this.loading();
32			this.header_shape();
33			this.full_height_line();
34
35			// WP 5.0 full content
36			wind.on( 'resize', function() {
37				var wind_width = wind.width();
38				
39				$( '.alignfull' ).each(function() {
40					var inla_width = $( this ).parent().width(),
41						from_left  = ( ( wind_width - inla_width ) / 2 );
42
43					$( this ).css({
44						width: wind_width,
45						left: -from_left
46					});
47				});
48			});
49
50			// Posts equality
51			$( '.cz_default_loop_grid' ).closest( '.cz_posts_container' ).each(function() {
52				$( this ).addClass( 'cz_posts_equal' );
53			});
54
55			// RTL
56			if ( window.location.search.indexOf( 'rtl' ) >= 1 ) {
57				$( "a[target!='_blank']" ).each(function() {
58					if ( ! (/rtl/.test( this.href ) ) ) {
59						this.href += (/\?/.test( this.href ) ? '&' : '?') + 'rtl';
60					}
61				});
62			}
63
64			// Fixed Footer
65			$( '.cz_fixed_footer' ).codevz( 'fixed_footer', function() {
66				wind.on( 'resize', function() {
67					body.css( 'margin-bottom', $( '.cz_fixed_footer' ).height() );
68				});
69
70				// Temp fix
71				setTimeout(function() {
72					body.css( 'margin-bottom', $( '.cz_fixed_footer' ).height() );
73				}, 1000 );
74			});
75
76			// Menus
77			$( '.sf-menu' ).codevz( 'sf_menu', function() {
78				var disMenu 	= $( this ),
79					indicator 	= disMenu.data( 'indicator' ),
80					default_ind = disMenu.hasClass( 'offcanvas_menu' ) ? 'fa fa-angle-down' : '',
81					indicator 	= indicator ? indicator : default_ind,
82					indicator2 	= disMenu.data( 'indicator2' ),
83					indicator2 	= indicator2 ? indicator2 : default_ind,
84					opa = $( '.page_content, .page_cover, footer' );
85
86				// Fullscreen menu move
87				$( '.fixed_side_1.have_center .fullscreen_menu' ).codevz( 'move_fm', function() {
88					$( this ).appendTo( '.fixed_side_1.have_center' );
89				});
90
91				// Super Fish
92				disMenu.codevzMenu({
93					onInit: function() {
94
95						// Menu Indicators
96						$( '.sf-with-ul, h6', this ).each(function() {
97							var en = $( this );
98							if ( ! $( '.cz_indicator', en ).length ) {
99								if ( $( '.cz_menu_subtitle', en ).length ) {
100									$( '.cz_menu_subtitle', en ).before( '<i class="cz_indicator"></i>' );
101								} else {
102									en.append( '<i class="cz_indicator"></i>' );
103								}
104							}
105							if ( ( indicator && indicator.length ) || ( indicator2 && indicator2.length ) ) {
106								$( '.cz_indicator', en ).addClass( ( en.parent().parent().hasClass( 'sf-menu' ) ? indicator : indicator2 ) );
107							}
108						});
109
110						// Check submenus of current menu parent
111						//disMenu.find( '.current_page_parent' ).each(function() {
112						//	if ( ! $( this ).hasClass( 'current_page_item' ) && ! $( this ).find( '.current_menu' ).length ) {
113						//		$( this ).removeClass( 'current_menu' );
114						//	}
115						//});
116
117						// Fix menus width
118						Codevz.fixMenusWidthBreaks();
119					},
120					onBeforeShow: function() {
121						var dis = $( this );
122
123						if ( dis.hasClass('sub-menu') ) {
124							var ul_offset = 100;
125
126							// Check if mega menu is fullwide
127							if ( dis.parent().hasClass( 'cz_megamenu_width_fullwide' ) ) {
128								dis.css( 'cssText', 'width: ' + wind.width() + 'px !important' );
129								ul_offset = 0;
130							}
131
132							// Sub-menu styling
133							if ( dis.parent().data( 'sub-menu' ) ) {
134								setTimeout(function() {
135									dis.attr( 'style', dis.attr( 'style' ) + dis.parent().data( 'sub-menu' ) );
136								}, 50 );
137							}
138
139							// Megamenu
140							if ( dis.parent().hasClass( 'cz_parent_megamenu' ) ) {
141								dis.addClass( 'cz_megamenu_' + $( '> .cz', dis ).length ).find( 'ul' ).addClass( 'cz_megamenu_inner_ul clr' );
142							}
143
144							// Megamenu width offset of window
145							var parent_li_offset = wind.width() - dis.parent().offset().left,
146								dis_ul_width = dis.width() + ul_offset;
147							if ( parent_li_offset < dis_ul_width ) {
148								var new_ul_offset = dis_ul_width - parent_li_offset;
149								dis.css( 'left', -new_ul_offset + 'px' );
150								if ( dis.parent().parent().hasClass('sub-menu') ) {
151									dis.addClass( 'cz_open_menu_reverse' ).css('left', '');
152								}
153							} else {
154								dis.removeClass( 'cz_open_menu_reverse' );
155							}
156
157							// Megamenu full row
158							if ( dis.parent().hasClass( 'cz_megamenu_width_full_row' ) ) {
159								var megamenu_row = $( '.row' ),
160									megamenu_row_offset = megamenu_row.offset().left;
161								dis.attr( 'style', dis.attr( 'style' ) + 'width: ' + megamenu_row.width() + 'px;left:' + ( megamenu_row_offset - dis.parent().offset().left ) + 'px;' );
162								ul_offset = 0;
163							}
164
165						}
166
167						if ( dis.closest('.fixed_side').length ) {
168							var pwidth = dis.parent().closest( '.sub-menu' ).length ? '.sub-menu' : '.sf-menu',
169								ff_pos = $( '.fixed_side' ).hasClass( 'fixed_side_left' ) ? 'left' : 'right';
170							dis.css( ff_pos, dis.closest( pwidth ).width() );
171						}
172					}
173				});
174
175				// Fullscreen Menu
176				$( '.icon_fullscreen_menu' ).codevz( 'fulls_menu', function() {
177					$( this ).off( 'click' ).on( 'click', function() {
178						var sf_f = $( '.fullscreen_menu' );
179						body.addClass( 'cz_noStickySidebar' );
180						sf_f.fadeIn( 'fast' ).on( 'click', function() {
181							$( this ).fadeOut( 'fast', function() {
182								body.removeClass( 'cz_noStickySidebar' );
183							});
184						});
185						if ( sf_f.is(':visible') ) {
186							Codevz.showOneByOne( $( '> .cz', sf_f ), 150 );
187						}
188
189						var h = sf_f.find( '> li' ).height() * ( ( sf_f.find( '> li' ).length - 1 ) / 2 );
190						sf_f.css( 'padding-top', ( ( wind.height() / 2 ) - h ) );
191					});
192				});
193
194				// Fullscreen
195				$( 'ul.fullscreen_menu' ).codevz( 'ul_fulls_menu', function() {
196					$( '.cz', this ).on( 'hover', function(e) {
197						e.stopPropagation();
198					}).off( 'click' ).on( 'click', function(e) {
199						if ( $( e.target ).hasClass( 'cz_indicator' ) ) {
200							$( this ).closest( 'li' ).find('> ul').fadeToggle( 'fast' );
201							e.preventDefault();
202							e.stopPropagation();
203						}
204					});
205				});
206
207				// Dropdown Menu
208				$( '.icon_dropdown_menu' ).codevz( 'dropdown_menu', function() {
209					$( this ).off( 'click' ).on( 'click', function(e) {
210						var dis = $( this ),
211							pos = dis.position(),
212							nav = dis.next().next('.sf-menu'),
213							row = $( this ).closest('.row').height(),
214							offset = ( ( inla.outerWidth() + inla.offset().left ) - dis.offset().left );
215
216						if ( nav.is(':visible') ) {
217							nav.fadeOut( 'fast' );
218							return;
219						}
220
221						nav.fadeToggle( 'fast' );
222
223						body.on( 'click.cz_idm', function(e) {
224							nav.fadeOut( 'fast' );
225							body.off( 'click.cz_idm' );
226						});
227
228						$( '.cz', nav ).on( 'hover', function(e) {
229							e.stopPropagation();
230						}).off( 'click' ).on( 'click', function(e) {
231							if ( $( e.target ).hasClass( 'cz_indicator' ) ) {
232								$( this ).closest( 'li' ).find('> ul').fadeToggle( 'fast' );
233								e.preventDefault();
234								e.stopPropagation();
235							}
236						});
237
238						e.stopPropagation();
239					});
240				});
241
242				// Open Menu Horizontal
243				$( '.icon_open_horizontal' ).codevz( 'iohor', function() {
244					$( this ).off( 'click' ).on( 'click', function(e) {
245						var dis = $( this ),
246							pos = dis.position(),
247							nav = dis.next().next('.sf-menu'),
248							row = $( this ).closest('.row').height(),
249							offset = ( ( inla.outerWidth() + inla.offset().left ) - dis.offset().left );
250
251						if ( nav.is(':visible') ) {
252							nav.fadeOut( 'fast' );
253							return;
254						}
255
256						nav.fadeToggle( 'fast' );
257						Codevz.showOneByOne( $( '> .cz', nav ), 100, ( nav.hasClass( 'inview_left' ) ? 'left' : 'right' ) );
258
259						body.on( 'click.cz_ioh', function(e) {
260							nav.fadeOut( 'fast' );
261							body.off( 'click.cz_ioh' );
262						});
263
264						e.stopPropagation();
265					});
266				});
267
268				// Mobile Menu
269				disMenu.prev( 'i.icon_mobile_offcanvas_menu' ).codevz( 'imom', function() {
270					var en = $( this );
271
272					en.removeClass( 'hide' ).on( 'click', function() {
273						if ( ! $( this ).hasClass( 'done' ) ) {
274							$( this ).addClass( 'done' );
275							Codevz.offCanvas( $( this ), 1 );
276							
277							// Add mobile menus indicator
278							if ( indicator.length || indicator2.length ) {
279								$( this ).next( '.sf-menu' ).find( '.sf-with-ul' ).each(function() {
280									$( '.cz_indicator', this ).addClass( ( $( this ).parent().parent().hasClass( 'sf-menu' ) ? indicator : indicator2 ) );
281								});
282							}
283
284							var ul_offcanvas = $( 'ul.offcanvas_area' );
285							$( '.sf-with-ul, .cz > h6', ul_offcanvas ).on( 'click', function(e) {
286								if ( $( e.target ).hasClass( 'cz_indicator' ) ) {
287									$( this ).next().slideToggle( 'fast' );
288									e.preventDefault();
289								}
290							});
291						}
292					});
293				});
294			});
295
296			// OffCanvas
297			$( '.offcanvas_container > i' ).codevz( 'offcanvas_i', function() {
298				$( this ).on( 'click', function() {
299					if ( ! $( this ).hasClass( 'done' ) ) {
300						$( this ).addClass( 'done' );
301						Codevz.offCanvas( $( this ), 1 );
302					}
303				});
304			});
305
306			// WPML
307			$( '.cz_language_switcher' ).codevz( 'lang_switcher', function() {
308				var dis = $( this );
309				$( '.cz_current_language', dis ).prependTo( dis );
310			});
311
312			// Fix WPML widgets
313			$( '.footer_widget, .widget' ).each(function() {
314				if ( $( '> .clr', this ).html() === '' ) {
315					$( this ).remove();
316				}
317			});
318
319			// Hidden fullwidth content
320			$( '.hf_elm_icon' ).codevz( 'hf_elm_icon', function() {
321				$( this ).on( 'click', function(e) {
322					var dis = $( this );
323
324					dis.next( '.hf_elm_area' ).slideToggle( 'fast' ).css({
325						width: inla.outerWidth(),
326						left: inla.offset().left,
327						top: dis.offset().top + dis.outerHeight()
328					});
329
330					e.preventDefault();
331					e.stopPropagation();
332				});
333
334				body.on( 'click', function() {
335					$( '.hf_elm_area' ).slideUp( 'fast' );
336				});
337			});
338
339			// Header on title
340			if ( $( '.header_onthe_cover' ).length ) {
341				Codevz.header_on_title();
342				wind.on( 'resize', function() {
343					Codevz.header_on_title();
344				});
345
346				if ( $.fn.imagesLoaded ) {
347					$( '.page_header' ).imagesLoaded().progress(function( imgLoad, image ) {
348						Codevz.header_on_title();
349					});
350				} else {
351					$( '.page_header img' ).on( 'load', function() {
352						setTimeout( function() {
353							Codevz.header_on_title();
354						}, 250 );
355					});
356				}
357
358				Codevz.heightChanged( '.page_header', function() {
359					Codevz.header_on_title();
360				});
361			}
362
363			// iframes auto size
364			$( '.cz_iframe, .single .cz_post_content iframe, .single_con iframe, object, embed' ).not('.wp-embedded-content').codevz( 'cz_iframe', function() {
365				var en = $( this ), newWidth;
366				wind.on( 'resize', function() {
367					en.attr( 'data-aspectRatio', en.height() / en.width() ).removeAttr( 'height width' );
368					newWidth = en.parent().width();
369					en.width( newWidth ).height( newWidth * en.attr( 'data-aspectRatio' ) );
370				});
371			});
372
373			// Extra
374			$( '.tagcloud' ).length && $( '.tagcloud' ).addClass( 'clr' );
375
376			// Input buttons to button tag
377			$( '.form-submit .submit, input.search-submit, .wpcf7-submit' ).codevz( 'button', function() {
378				var en = $( this );
379				$('<button name="submit" type="submit" class="' + en.attr('class') + '">' + en.val() + '</button>').insertAfter( en );
380				en.detach();
381			});
382
383			/* Sticky */
384			$( '.header_is_sticky' ).codevz( 'header_sticky', function(n) {
385				var header_sticky = $( this ),
386					header_5 = $( '.header_5' ),
387					lastScrollTop = 0,
388					st, stickyNav, sticky_func, 
389					scrollTop = header_sticky.offset().top,
390					h_offset = header_sticky.position(),
391					smart_sticky = function( scroll ) {
392						if ( header_sticky.hasClass( 'smart_sticky' ) ) {
393							st = scroll.scrollTop();
394
395							if ( st > ( h_offset.top + header_sticky.outerHeight() ) && st > lastScrollTop ) {
396								header_sticky.css( 'transform', 'translateY(-' + ( header_sticky.outerHeight() + 20 ) + 'px)' );
397							} else if ( st < lastScrollTop ) {
398								header_sticky.css( 'transform', 'none' );
399							}
400
401							lastScrollTop = st;
402						}
403					};
404
405				if ( header_sticky.hasClass( 'header_5' ) ) {
406					
407					header_5.addClass( 'onSticky' );
408					wind.on( 'scroll', function(e){
409						var ph = $( '.page_header' ).height();
410
411						if ( wind.scrollTop() >= ph ) {
412							header_5.css( 'transform', 'none' ).css( 'width', inla.width() + 'px' );
413						} else {
414							header_5.css( 'transform', 'translateY(-' + ( ph + 20 ) + 'px)' ).css( 'width', inla.width() + 'px' );
415						}
416
417						smart_sticky( $( this ) );
418					});
419
420				} else if ( header_sticky.length ) {
421
422					/* Add corpse */
423					if ( ! header_sticky.prev( '.Corpse_Sticky').length ) {
424						header_sticky.before( '<div class="Corpse_Sticky' + ( header_sticky.hasClass( 'header_4' ) ? ' cz_sticky_corpse_for_header_4' : '' ) + '"></div>' );
425					}
426
427					var scroll_down,
428						scroll_top,
429						new_scrollTop,
430						cz_sticky_h12 = $( '.cz_sticky_h12' ).length,
431						cz_sticky_h13 = $( '.cz_sticky_h13' ).length,
432						cz_sticky_h23 = $( '.cz_sticky_h23' ).length,
433						cz_sticky_h123 = $( '.cz_sticky_h123' ).length;
434
435					sticky_func = function(e) {
436						if ( header_sticky.hasClass( 'header_4' ) && header_sticky.css( 'display' ) == 'none' ) {
437							return;
438						}
439
440						new_scrollTop = scrollTop;
441						if ( cz_sticky_h12 && header_sticky.hasClass( 'header_2' ) ) {
442							new_scrollTop = scrollTop+1 - $( '.header_1' ).outerHeight();
443						} else if ( cz_sticky_h13 && header_sticky.hasClass( 'header_3' ) ) {
444							new_scrollTop = scrollTop+1 - $( '.header_1' ).outerHeight();
445						} else if ( cz_sticky_h23 && header_sticky.hasClass( 'header_3' ) ) {
446							new_scrollTop = scrollTop+1 - $( '.header_2' ).outerHeight();
447						} else if ( cz_sticky_h123 ) {
448							if ( header_sticky.hasClass( 'header_2' ) ) {
449								new_scrollTop = scrollTop+1 - $( '.header_1' ).outerHeight();
450							}
451							if ( header_sticky.hasClass( 'header_3' ) ) {
452								new_scrollTop = scrollTop+1 - ( $( '.header_1' ).outerHeight() + $( '.header_2' ).outerHeight() );
453							}
454						}
455
456						scroll_top = wind.scrollTop() + abar;
457						scroll_down = scroll_top > new_scrollTop;
458						scroll_down = ( scroll_top === 32 ) ? 0 : scroll_down;
459
460						if ( scroll_down && cz_sticky_h12 && header_sticky.hasClass( 'header_2' ) ) {
461							$( '.header_2' ).css( 'marginTop', $( '.header_1' ).outerHeight() );
462						} else if ( scroll_down && cz_sticky_h13 && header_sticky.hasClass( 'header_3' ) ) {
463							$( '.header_3' ).css( 'marginTop', $( '.header_1' ).outerHeight() );
464						} else if ( scroll_down && cz_sticky_h23 && header_sticky.hasClass( 'header_3' ) ) {
465							$( '.header_3' ).css( 'marginTop', $( '.header_2' ).outerHeight() );
466						} else if ( cz_sticky_h123 ) {
467							if ( scroll_down && header_sticky.hasClass( 'header_2' ) ) {
468								$( '.header_2' ).css( 'marginTop', $( '.header_1' ).outerHeight() );
469							}
470							if ( scroll_down && header_sticky.hasClass( 'header_3' ) ) {
471								$( '.header_3' ).css( 'marginTop', ( $( '.header_1' ).outerHeight() + $( '.header_2' ).outerHeight() ) );
472							}
473						}
474
475						if ( scroll_down ) {
476							header_sticky.addClass( 'onSticky' ).prev( '.Corpse_Sticky' ).css( 'height', header_sticky.outerHeight() + 'px' );
477						} else {
478							header_sticky.removeClass( 'onSticky' ).prev( '.Corpse_Sticky').css( 'height', 'auto' );
479							header_sticky.css( 'marginTop', '' );
480						}
481
482						smart_sticky( $( this ) );
483						header_sticky.css( 'width', inla.width() + 'px' );
484						setTimeout(function() {
485							header_sticky.css( 'width', inla.width() + 'px' );
486						}, 300 );
487					};
488
489					wind.off( 'scroll.cz_sticky_' + n ).on( 'scroll.cz_sticky_' + n, sticky_func );
490					wind.off( 'resize.cz_sticky_' + n ).on( 'resize.cz_sticky_' + n, sticky_func );
491				}
492			});
493
494			this.menu_anchor();
495		},
496
497		/*
498		 *  Header and title position fix
499		 */
500		header_on_title: function() {
501			var en 		= $( '.header_onthe_cover' ),
502				margin  = $( '.header_after_cover' ).length ? 'margin-bottom' : 'margin-top';
503
504			en.css( margin, - $( '.page_header' ).outerHeight() ).css( 'opacity', '1' );
505		},
506
507		/*
508		 *  Full height line element
509		 */
510		full_height_line: function() {
511			$( '.header_line_1' ).css( 'height', '' ).each(function() {
512				$( this ).height( $( this ).closest( '.row' ).height() );
513			});
514		},
515
516		/*
517		 *  Menu Anchor
518		 */
519		menu_anchor: function() {
520
521			// Define
522			var easing = ( $.easing != 'undefined' ) ? 'easeInOutExpo' : null,
523				mPage = $( '.sf-menu' ),
524				mLink = $( "a[href*='#']" ).not( '.cz_no_anchor, .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' ),
525				sticky = $( '.header_is_sticky' ).not( '.smart_sticky' ), 
526				t, offset,
527				scrollToAnchor = function( target ) {
528					target = ( target.indexOf( '#' ) >= 0 ) ? $( target ) : $( '#' + target );
529
530					if ( target.length ) {
531						offset = target.offset().top;
532						$( 'html, body' ).animate({ scrollTop: ( offset - abar ) - sticky.outerHeight() }, 1200, easing, function() {
533							var new_sticky = $( '.onSticky' ).not( '.smart_sticky' );
534							$( 'html, body' ).animate({ scrollTop: ( offset - abar ) - new_sticky.outerHeight() }, 100 );
535						});
536					}
537				};
538
539			// Prevent page scroll jumping
540			var target = window.location.hash;
541			if ( target ) {
542				target = target.replace( '#', '' );
543				if ( $( '#' + target ).length ) {
544
545					// Stop scroll
546					window.location.hash = '';
547					$( 'html, body' ).animate({scrollTop: 0}, 1);
548
549					// Scroll to anchor
550					setTimeout(function() {
551						scrollToAnchor( target );
552					}, 1500 );
553				}
554			}
555
556			// Links
557			if ( mLink.length ) {
558				mLink.off( 'click.cz_manchor' ).on( 'click.cz_manchor', function(e) {
559					if ( location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname ) {
560						scrollToAnchor( this.hash );
561					} else {
562						location = $( this ).attr( 'href' );
563					}
564					e.preventDefault();
565				});
566
567				var mPageH = mPage.outerHeight() + 15,
568					mItems = mPage.find( "a[href*='#']" ),
569					sItems = mItems.map(function(){
570						var item = $( $( this ).attr( "href" ).replace( /\s+|%20/g, "" ).replace( /^.*\#(.*)$/g, "#$1" ) );
571						if ( item.length ) {
572							return item;
573						}
574					});
575
576				wind.on( 'scroll', function() {
577					var ft = $( this ).scrollTop() + mPageH + sticky.outerHeight() + abar,
578						cur = sItems.map(function() {
579							if ( $(this).offset().top < ft )
580								return this;
581							});
582
583					cur = cur[cur.length-1];
584					var id = cur && cur.length ? cur[0].id : "";
585					if ( id && !$( '#' + id + '.cz_popup_modal' ).length && $( '#' + id ).length ) {
586						body.trigger( 'click' );
587						mItems.parent().removeClass( "current_menu" ).end().filter( "[href*='#" + id + "']" ).parent().addClass( "current_menu" );
588					} else {
589						mItems.parent().removeClass( "current_menu" );
590					}
591				});
592			}
593		},
594
595		/*
596		*   Fix menus lenght related to parent width
597		*/
598		fixMenusWidthBreaks: function() {
599			wind.off( 'resize.cz_fix_menu_width' ).on( 'resize.cz_fix_menu_width', function() {
600				$( 'header .cz_menu_default' ).not( '#menu_header_4, .cz-not-three-dots' ).each(function() {
601					var en = $( this ), parent = en.parent(), parent_width, items_width = 0, need_move = 0, nw, nw_ul;
602
603					setTimeout(function() {
604						// Multiple menu in one row
605						if ( parent.parent().find( '.cz_menu_default' ).length >= 2 ) {
606							return;
607						}
608
609						// Reset
610						en.append( en.find( '.cz-extra-menus > .sub-menu > li' ) ).find( '.cz-extra-menus' ).remove();
611
612						// Parent width
613						parent_width = parent.parent().outerWidth() - 50 - ( parseInt( parent.css( 'marginLeft' ) ) + parseInt( parent.css( 'marginRight' ) ) );
614						if ( en.closest( '.have_center' ).length ) {
615							parent_width = parent.parent().parent().outerWidth() - 50 - ( parseInt( parent.css( 'marginLeft' ) ) + parseInt( parent.css( 'marginRight' ) ) );
616						}
617
618						// Decrease each width
619						parent.parent().find( '> div' ).each(function() {
620							var enn = $( this );
621							if ( enn.attr( 'class' ) !== parent.attr( 'class' ) ) {
622								parent_width = parent_width - enn.outerWidth() - ( parseInt( enn.parent().css( 'marginLeft' ) ) + parseInt( enn.parent().css( 'marginRight' ) ) );
623							}
624						});
625
626						// Add icon dots
627						if ( ! en.find( '.cz-extra-menus' ).length ) {
628							en.append( '<li class="cz-extra-menus cz"><a href="#" class="sf-with-ul"><span>&nbsp;<i class="fa czico-055-three cz-extra-menus" style="margin:0"></i>&nbsp;</span></a><ul class="sub-menu"></ul></li>');
629						}
630
631						nw = en.find( '.cz-extra-menus' ), nw_ul = nw.find( '> ul' );
632
633						en.find( '> li' ).each(function( i ) {
634							var li = $(this);
635							li.data( 'w', li.outerWidth() ).data( 'i', i );
636							items_width += li.hasClass( 'cz-extra-menus' ) ? 0 : li.outerWidth();
637							need_move = ( items_width > parent_width ) ? 1 : 0;
638						});
639
640						if ( need_move ) {
641							items_width = nw.outerWidth();
642							en.find( '> li' ).not( '.cz-extra-menus' ).each(function( i ) {
643								var li = $( this ), li_width = li.outerWidth();
644								if ( items_width <= parent_width ) {
645									items_width += li_width;
646								}
647								if ( items_width > parent_width ) {
648									var moved = 0;
649									nw_ul.find( '> li' ).each(function() {
650										if ( ! moved && Number( $( this ).data( 'i' ) ) > i ) {
651											li.data( 'w', li_width ).insertBefore( $( this ) );
652											moved = true;
653										}
654									});
655
656									if ( ! moved ) {
657										li.data( 'w', li_width ).appendTo( nw_ul );
658									}
659								}
660							});
661							nw.show();
662							
663						} else {
664							var items = nw_ul.find( '> li' ), ii = 0, need_move = true;
665
666							items.each(function() {
667								if ( ! need_move ) {
668									return;
669								}
670								if ( items.length - ii == 1 ) {
671									items_width -= nw.outerWidth();
672								}
673								items_width += parseFloat( $( this ).data( 'w' ) );
674								if ( items_width < parent_width ) {
675									$( this ).insertBefore( nw );
676									ii++;
677								} else {
678									need_move = 0;
679								}
680							});
681							if ( items.length - ii == 0 ) {
682								nw.hide();
683							}
684						}
685					}, 200 );
686				});
687			});
688
689			setTimeout(function() {
690				Codevz.full_height_line();
691			}, 1500 );
692		},
693
694		/*
695		*   Height changed = run callback
696		*/
697		heightChanged: function( elm, callback ) {
698			var elm = ( typeof elm == 'string' ) ? $( elm ) : elm,
699				lastHeight = elm.outerHeight(), newHeight;
700
701			// First
702			callback();
703
704			// Height detection
705			(function run() {
706				newHeight = elm.outerHeight();
707				if ( lastHeight != newHeight ) {
708					callback();
709					lastHeight = newHeight;
710				}
711
712				if ( elm.onElementHeightChangeTimer ) {
713					clearTimeout( elm.onElementHeightChangeTimer );
714				}
715
716				elm.onElementHeightChangeTimer = setTimeout( run, 100 );
717			})();
718		},
719
720		/*
721		*   Ajax Search
722		*/
723		search: function() {
724			var time = false;
725
726			// Input changes
727			if ( $( '.cz_ajax_search' ).length ) {
728				$( '.cz_ajax_search' ).on('keyup', '[name="s"]', function() {
729					clearTimeout( time );
730					var form    = $( this ).parent(),
731						results = form.next( '.ajax_search_results' ),
732						icon 	= 'fa ' + $( 'button i', form ).attr( 'class' ),
733						ajax 	= $( '#intro' ).data( 'ajax' ),
734						iLoader = 'fa fa-superpowers fa-pulse';
735
736					if ( $( this ).val().length < 3 ) {
737						$( '.ajax_search_results' ).slideUp( 'fast' );
738						$( 'button i', form ).addClass( icon ).removeClass( iLoader );
739						return;
740					}
741					$( 'button i', form ).removeClass( icon ).addClass( iLoader );
742
743					// Send request
744					time = setTimeout(
745						function() {
746							$.ajax({
747								type: "GET",
748								url: ajax,
749								dataType: 'html',
750								data: "action=codevz_ajax_search&" + form.serialize(),
751								success: function( data ) {
752									results.html( data ).slideDown( 'fast' );
753									$( 'button i', form ).removeClass( iLoader ).addClass( icon );
754								},
755								error: function( xhr, status, error ) {
756									results.html( '<b class="ajax_search_error">' + error + '</b>' ).slideDown( 'fast' );
757									$( 'button i', form ).removeClass( iLoader ).addClass( icon );
758									console.log( xhr, status, error );
759								}
760							});
761						},
762						500
763					);
764				});
765			}
766
767			// Search icon
768			$( '.search_with_icon' ).codevz( 'search_wi', function() {
769				$( this ).on( 'click', function(e) {
770					e.stopPropagation();
771				}).on( 'click', '[name="s"]', function() {
772					if ( $( this ).val() ) {
773						$( '.ajax_search_results' ).slideDown( 'fast' );
774					}
775				});
776			});
777
778			// Search dropdown and shop quick cart
779			$( '.search_style_icon_dropdown, .elms_shop_cart' ).codevz( 'dr_search_cart', function() {
780				var en = $( this );
781
782				if ( ( wind.width() / 2 ) > ( en.offset().left + 300 ) ) {
783					en.addClass( 'inview_right' );
784				}
785			});
786
787			// Search dropdown
788			$( '.search_style_icon_dropdown > i' ).codevz( 'sdr_fullwor', function() {
789				$( this ).on( 'click', function(e) {
790					var dis     = $( this ),
791						outer   = dis.parent().find('.outer_search'),
792						row_h   = dis.closest('.row').height(),
793						clr     = dis.closest('.clr');
794
795					if ( outer.is( ':visible' ) ) {
796						outer.fadeOut( 'fast' );
797					} else {
798						outer.fadeIn( 'fast' ).find('input').focus();
799					}
800				});
801			});
802
803			// Search fullscreen
804			$( '.search_style_icon_full > i' ).codevz( 'ssifi', function() {
805				$( this ).on( 'click', function() {
806					//$( this ).closest( '.header_1,.header_2,.header_3' ).css( 'z-index', '9999' );
807					$( this ).parent().find( '.outer_search' ).fadeIn( 'fast' ).find('input').focus();
808					wind.off( 'resize.cz_search_full' ).on( 'resize.cz_search_full', function() {
809						var w = wind.width(),
810							h = wind.height(),
811							s = $( this ).find('.outer_search .search');
812						s.css({
813							'top': h / 4 - s.height() / 2,
814							'left': w / 2 - s.width() / 2
815						});
816					});
817				});
818			});
819
820			$( 'body, .outer_search' ).on( 'click', function(e) {
821				if ( $( e.target ).closest('.outer_search .search').length ) {
822					return;
823				}
824
825				$('.ajax_search_results').fadeOut( 'fast' );
826				$( '.search_style_icon_dropdown, .search_style_icon_full' ).find('.outer_search').fadeOut( 'fast' );
827			});
828
829		},
830
831		/*
832		*   Loading
833		*/
834		loading: function() {
835			var p 		= $( '.pageloader' ),
836				pp 		= p.find( '.pageloader_percentage' ),
837				p_done 	= function() {
838					p.addClass( 'pageloader_done' );
839					setTimeout(function() {
840						p.addClass( 'pageloader_done_all' );
841					}, 1200 );
842				}, 
843				time;
844
845			if ( p.length ) {
846				if ( pp.length ) {
847					var images = $( '.inner_layout img' ),
848						imgCount = images.length;
849
850					images.imagesLoaded().progress(function( imgLoad, image ) {
851						if ( imgLoad.progressedCount === imgCount ) {
852							pp.html( '100%' );
853							p_done();
854						} else {
855							pp.html( ( ( imgLoad.progressedCount / imgCount ) * 100 ).toFixed() + '%' );
856						}
857					});
858				} else {
859					wind.on( 'load', function() {
860						p_done();
861					});
862				}
863
864				// Custom time
865				if ( p.data( 'time' ) ) {
866					time = setTimeout( function(){
867						p_done();
868					}, p.data( 'time' ) );
869				}
870
871				// Loading on click
872				if ( ! pp.length ) {
873					clearTimeout( time );
874					$( 'a[href*="//"]' ).not( 'a[href*="#"],.cz_lightbox,.cz_a_lightbox a,a[href*="youtube.com/watch?"],a[href*="youtu.be/watch?"],a[href*="vimeo.com/"],a[href*=".jpg"],.product a,.esgbox,.jg-entry,.prettyphoto,.cz_grid_title,.ngg-fancybox,.fancybox,.lightbox,a[href*=".jpeg"],a[href*=".png"],a[href*=".gif"],.cz_language_switcher,.add_to_cart_button,.cart_list .remove,a[target="_blank"],[href^="#"],[href*="wp-login"],[id^="wpadminb"] a,[href*="wp-admin"],[data-rel^="prettyPhoto"],a[href$=".jpg"],a[href$=".jpeg"],a[href$=".png"],a[href$=".gif"],a[href$=".mp3"],a[href$=".zip"],a[href$=".rar"],a[href$=".mov"],a[href$=".mp4"],a[href$=".pdf"],a[href$=".mpeg"],.comment-reply-link' ).on( 'click', function(e) {
875						p.data( 'time', 99999 );
876						p.addClass( 'pageloader_click' ).removeClass( 'pageloader_done pageloader_done_all' );
877					});
878				}
879			}
880		},
881
882		/*
883		*   offCanvas area
884		*/
885		offCanvas: function( selector, click ) {
886			var parent  = selector.parent(),
887				area    = selector.next(),
888				layout  = $('#layout'),
889				overlay = '.cz_overlay',
890				isRight, i, 
891				fixed_side = 0,
892				close;
893
894			if ( area.length ) {
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				$( '.sub-menu', area ).hide();
903			} else {
904				return;
905			}
906
907			// Open icon
908			selector.on( 'click', function(e) {
909
910				if ( area.hasClass( 'active_offcanvas' ) ) {
911					body.trigger( 'click' );
912				} else {
913
914					// Close icon
915					area.before( '<i class="fa czico-198-cancel offcanvas-close"></i>' );
916					close = area.prev( '.offcanvas-close' );
917					close.on( 'click', function(e) {
918						if ( click ) {
919							body.removeClass( 'active_offcanvas' );
920							area.removeClass( 'active_offcanvas' );
921							
922							$( overlay ).fadeOut();
923							setTimeout(function() {
924								$( '.offcanvas-close' ).detach();
925								wind.trigger( 'resize' );
926							}, 500 );
927							
928							click = 0;
929						} else {
930							body.trigger( 'click' );
931						}
932					});
933					close.css( ( isRight ? 'right' : 'left' ), area.outerWidth() + fixed_side );
934
935					body.addClass( 'offcanvas_doing active_offcanvas' + ( isRight ? ' cz_offcanvas_right' : ' cz_offcanvas_left' ) );
936					area.addClass( 'active_offcanvas' );
937					if ( ( $( '.fixed_side_left' ).length && $( '.cz_offcanvas_left' ).length ) || $( '.fixed_side_right' ).length  && $( '.cz_offcanvas_right' ).length ) {
938						if ( ! $( '#cz_ofs' ).length ) {
939							$( 'head' ).append( '<style id="cz_ofs"></style>' );
940						}
941						fixed_side = $( '.fixed_side' ).width();
942						$( '#cz_ofs' ).html( '.active_offcanvas .offcanvas_area.active_offcanvas{transform:translateX(' + ( isRight ? '-' : '' ) + fixed_side + 'px)}' );
943					}
944					$( overlay ).fadeIn();
945
946					setTimeout(function() {
947						body.removeClass( 'offcanvas_doing' );
948					}, 500 );
949				}
950
951				e.stopPropagation();
952			});
953
954			// First time
955			if ( click ) {
956				selector.trigger( 'click' );
957			}
958
959			// Prevent close on open icon
960			area.on( 'click', function(e) {
961				e.stopPropagation();
962			});
963
964			// reCall anchors
965			this.menu_anchor();
966
967			// Click on body
968			body.on( 'click.offcanvas', function(e) {
969				if ( ! click && $( '.active_offcanvas' ).length && ! body.hasClass( 'offcanvas_doing' ) ) {
970					body.removeClass( 'active_offcanvas' );
971					area.removeClass( 'active_offcanvas' );
972					
973					$( overlay ).fadeOut();
974					setTimeout(function() {
975						$( '.offcanvas-close' ).detach();
976						wind.trigger( 'resize' );
977					}, 500 );
978				}
979			});
980
981			// Close on page scroll
982			wind.on( 'scroll', function() {
983				body.trigger( 'click' );
984			});
985
986			// Reload necessary scripts
987			if ( typeof cz_scripts != 'undefined' && ! area.hasClass( 'cz_plus_done' ) ) {
988				if ( typeof cz_scripts.cp != 'undefined' ) {
989					i = document.createElement("script");
990					i.type = "text/javascript";
991					i.src = cz_scripts.cp;
992					document.getElementsByTagName("body")[0].appendChild( i );
993				}
994				if ( typeof cz_scripts.cf7 != 'undefined' && ! $( '.cz_ajax_loader' ).length && area.find( '.wpcf7' ).length ) {
995					i = document.createElement("script");
996					i.type = "text/javascript";
997					i.src = cz_scripts.cf7;
998					document.getElementsByTagName("body")[0].appendChild( i );
999				}
1000
1001				area.addClass( 'cz_plus_done' );
1002			}
1003
1004		},
1005
1006		/*
1007		*   Show one by one with delay
1008		*/
1009		showOneByOne: function( e, s, d ) {
1010			var e = ( d == 'left' ) ? $( e.get().reverse() ) : e,
1011				b = ( d == 'left' ) ? {opacity:0,left:10} : {opacity: 0,left:-10};
1012
1013			e.css( b ).each(function( i ) {
1014				$( this ).delay( s * i ).animate({opacity:1,left:0});
1015			});
1016		},
1017
1018		/*
1019		*   Header shape size
1020		*/
1021		header_shape: function() {
1022			$( 'div[class*="cz_row_shape_"]' ).codevz( 'row_shape', function() {
1023				var en = $( this ), cls, css, hei;
1024				Codevz.heightChanged( en, function() {
1025					cls = en.attr( 'class' ) || 'cz_no_class',
1026					cls = '.' + cls.replace(/  /g, '.').replace(/ /g, '.'),
1027					hei = en.height() + 37;
1028
1029					if ( ! $( '> style', en ).length ) {
1030						en.append('<style></style>');
1031					}
1032					$( '> style', en ).html( cls + ' .row:before,' + cls + ' .row:after{width:' + hei + 'px}.elms_row ' + cls + ':before, .elms_row ' + cls + ':after{width:' + hei + 'px}' );
1033				});
1034			});
1035		},
1036
1037	};
1038})(jQuery);
1039
1040jQuery(document).ready(function($) {
1041	Codevz.init();
1042});

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.