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