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