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 wind.on( 'resize.responsive', function() { 290 291 var en = x, 292 parent = en.parent(), 293 elementor = en.closest( '.elementor-container' ), 294 menu_margin = parseFloat( parent.css( 'margin-left' ) ) + parseFloat( parent.css( 'margin-right' ) ), 295 elements = 0, 296 container, 297 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>' : '...'; 298 299 setTimeout( function() { 300 301 // Reset 302 en.append( en.find( '.cz-extra-menus > .sub-menu > li' ) ).find( '.cz-extra-menus' ).remove(); 303 304 // Add icon dots 305 if ( ! en.find( '.cz-extra-menus' ).length ) { 306 var submenu_title = $( '.cz_menu_subtitle' ).text() ? '<span class="cz_menu_subtitle"> </span>' : ''; 307 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>'); 308 } 309 310 var nw = en.find( '.cz-extra-menus' ), 311 nw_ul = nw.find( '> ul' ); 312 313 nw.hide().prev().addClass( 'cz-last-child' ); 314 315 // Get elements width 316 en.parent().parent().find( '.cz_elm' ).not( parent ).each(function() { 317 318 elements += $( this ).outerWidth() + parseFloat( $( this ).css( 'margin-left' ) ) + parseFloat( $( this ).css( 'margin-right' ) ); 319 320 }); 321 322 // Move back to parent 323 nw_ul.find( '> li' ).appendTo( en ); 324 325 // Move to hidden menu 326 $( en.find( '> li' ).not( '.cz-extra-menus' ).get().reverse() ).each( function() { 327 328 if ( elementor.length ) { 329 container = elementor.outerWidth(); 330 } else { 331 container = en.closest( '.have_center' ).length ? parent.parent().parent().outerWidth() : parent.parent().outerWidth(); 332 } 333 334 if ( ( parent.outerWidth() + menu_margin ) + elements + ( elementor ? 0 : 25 ) > container ) { 335 $( this ).prependTo( nw_ul ); 336 nw.show(); 337 } 338 339 }); 340 341 }, 1000 ); 342 343 }).trigger( 'resize.responsive' ); 344 345 } 346 347 }, 348 onBeforeShow: function() { 349 350 var x = $( this ); 351 352 // Sub menu. 353 if ( x.hasClass('sub-menu') ) { 354 355 // Check if mega menu is fullwide 356 if ( x.parent().hasClass( 'cz_megamenu_width_fullwide' ) ) { 357 358 var megamenu_row = body, 359 megamenu_row_offset = megamenu_row.offset().left, 360 megamenu_row_width = megamenu_row.width(); 361 362 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;' ); 363 364 } 365 366 // Sub-menu styling 367 if ( x.parent().data( 'sub-menu' ) ) { 368 setTimeout(function() { 369 x.attr( 'style', x.attr( 'style' ) + x.parent().data( 'sub-menu' ) ); 370 }, 50 ); 371 } 372 373 // Megamenu 374 if ( x.parent().hasClass( 'cz_parent_megamenu' ) ) { 375 x.addClass( 'cz_megamenu_' + $( '> .cz', x ).length ).find( 'ul' ).addClass( 'cz_megamenu_inner_ul clr' ); 376 } 377 378 // Megamenu full row 379 if ( x.parent().hasClass( 'cz_megamenu_width_full_row' ) ) { 380 381 var megamenu_row = $( '.row' ), 382 megamenu_row_offset = megamenu_row.offset().left, 383 megamenu_row_width = megamenu_row.width(); 384 385 if ( x.closest( '.cz-extra-menus' ).length ) { 386 387 megamenu_row_width = megamenu_row_width - ( megamenu_row.width() - x.parent().offset().left + 10 ); 388 389 } 390 391 x.attr( 'style', x.attr( 'style' ) + 'width: ' + megamenu_row_width + 'px;left:' + ( megamenu_row_offset - x.parent().offset().left ) + 'px;' ); 392 393 } 394 395 } 396 397 if ( x.closest('.fixed_side').length ) { 398 var pwidth = x.parent().closest( '.sub-menu' ).length ? '.sub-menu' : '.sf-menu', 399 ff_pos = $( '.fixed_side' ).hasClass( 'fixed_side_left' ) ? 'left' : 'right'; 400 x.css( ff_pos, x.closest( pwidth ).width() ); 401 } 402 403 setTimeout( function() { 404 405 // Lazyload image in dropdown menus. 406 wind.trigger( 'scroll.lazyload' ); 407 408 // Fix carousel. 409 if ( x.find( '.slick' ).length ) { 410 wind.trigger( 'resize.slick' ); 411 } 412 413 }, 200 ); 414 415 } 416 417 }); 418 419 }); 420 421 // Fix mobile menu icon. 422 $( 'i.icon_mobile_offcanvas_menu' ).removeClass( 'hide' ); 423 424 // Dropdown Menu 425 body.on( 'click', '.icon_dropdown_menu', function( e ) { 426 427 var x = $( this ), 428 pos = x.position(), 429 nav = x.parent().find('.sf-menu'),
430 row = $( this ).closest('.row').height(), 431 offset = ( ( inla.outerWidth() + inla.offset().left ) - x.offset().left ); 432 433 nav.fadeToggle( 'fast' ); 434 435 body.on( 'click.cz_idm', function(e) { 436 nav.fadeOut( 'fast' ); 437 body.off( 'click.cz_idm' ); 438 }); 439 440 $( '.cz', nav ).on( 'mouseenter mouseleave', function(e) { 441 e.stopPropagation(); 442 }).off( 'click' ).on( 'click', function(e) { 443 if ( $( e.target ).hasClass( 'cz_indicator' ) ) { 444 $( this ).closest( 'li' ).find('> ul').fadeToggle( 'fast' ); 445 e.preventDefault(); 446 e.stopPropagation(); 447 } 448 }); 449 450 e.stopPropagation(); 451 452 // Open Menu Horizontal 453 }).on( 'click', '.icon_open_horizontal', function( e ) { 454 455 var x = $( this ), 456 pos = x.position(), 457 nav = x.parent().find('.sf-menu'), 458 row = $( this ).closest('.row').height(), 459 offset = ( ( inla.outerWidth() + inla.offset().left ) - x.offset().left ); 460 461 nav.fadeToggle( 'fast' ); 462 463 Codevz.showOneByOne( $( '> .cz', nav ), 100, ( nav.hasClass( 'inview_left' ) ? 'left' : 'right' ) ); 464 465 body.on( 'click.cz_ioh', function(e) { 466 nav.fadeOut( 'fast' ); 467 body.off( 'click.cz_ioh' ); 468 }); 469 470 e.stopPropagation(); 471 472 // Mobile Menu 473 }).on( 'click', 'i.icon_mobile_offcanvas_menu', function() { 474 475 var x = $( this ); 476 477 if ( ! x.hasClass( 'done' ) ) { 478 479 Codevz.offCanvas( x.addClass( 'done' ), 1 ); 480 481 var ul_offcanvas = $( 'ul.offcanvas_area' ), 482 indicator = ul_offcanvas.data( 'indicator' ), 483 default_ind = ul_offcanvas.hasClass( 'offcanvas_menu' ) ? 'fa fa-angle-down' : '', 484 indicator = indicator ? indicator : default_ind, 485 indicator2 = ul_offcanvas.data( 'indicator2' ), 486 indicator2 = indicator2 ? indicator2 : default_ind, 487 additional = x.parent().find( '.xtra-mobile-menu-additional' ); 488 489 additional.length && ul_offcanvas.append( '<li class="xtra-mobile-menu-additional">' + additional.html() + '</li>' ); 490 491 // Add mobile menus indicator 492 if ( indicator.length || indicator2.length ) { 493 x.next( '.sf-menu' ).find( '.sf-with-ul' ).each(function() { 494 $( '.cz_indicator', this ).addClass( ( x.parent().parent().hasClass( 'sf-menu' ) ? indicator : indicator2 ) ); 495 }); 496 } 497 498 $( '.sf-with-ul, .cz > h6', ul_offcanvas ).on( 'click', function( e ) { 499 if ( $( e.target ).hasClass( 'cz_indicator' ) || $( e.target ).attr( 'href' ) == '#' ) { 500 $( this ).next().slideToggle( 'fast' ); 501 e.preventDefault(); 502 } 503 }); 504 505 } 506 507 // OffCanvas 508 }).on( 'click', '.offcanvas_container > i', function() { 509 510 var x = $( this ); 511 512 if ( ! x.hasClass( 'done' ) ) { 513 514 Codevz.offCanvas( x.addClass( 'done' ), 1 ); 515 516 } 517 518 // Fullscreen Menu 519 }).on( 'click', '.icon_fullscreen_menu', function( e ) { 520 521 var x = $( '.fullscreen_menu' ); 522 523 body.addClass( 'cz_noStickySidebar' ).find( '.fixed_side_1.have_center' ).find( '.fullscreen_menu,.xtra-close-icon' ).appendTo( '.fixed_side_1.have_center' ); 524 525 x.fadeIn( 'fast' ).on( 'click', function() { 526 $( this ).delay( 500 ).fadeOut( 'fast', function() { 527 body.removeClass( 'cz_noStickySidebar' ); 528 $( '.xtra-close-icon' ).addClass( 'hide' ); 529 page.removeClass( 'no-scroll' ); 530 }); 531 }); 532 533 if ( x.is(':visible') ) { 534 535 page.addClass( 'no-scroll' ); 536 Codevz.showOneByOne( $( '> .cz', x ), 150 ); 537 538 } 539 540 var h = x.find( '> li' ).height() * ( ( x.find( '> li' ).length - 1 ) / 2 ); 541 542 x.css( 'padding-top', ( ( wind.height() / 2 ) - h ) ); 543 544 $( '.xtra-close-icon' ).toggleClass( 'hide' ).off().on( 'click', function() { 545 $( this ).addClass( 'hide' ); 546 x.fadeOut( 'fast' ); 547 page.removeClass( 'no-scroll' ); 548 }); 549 550 // Fullscreen 551 }).on( 'mouseenter mouseleave', 'ul.fullscreen_menu .cz', function( e ) { 552 553 e.stopPropagation(); 554 555 }).on( 'click', 'ul.fullscreen_menu .cz', function( e ) { 556 557 if ( $( e.target ).hasClass( 'cz_indicator' ) ) { 558 $( this ).closest( 'li' ).find( '> ul' ).fadeToggle( 'fast' ); 559 e.preventDefault(); 560 e.stopPropagation(); 561 } 562 563 // Hidden fullwidth content 564 }).on( 'click', '.hf_elm_icon', function( e ) { 565 566 var x = $( this ); 567 568 x.next( '.hf_elm_area' ).slideToggle( 'fast' ).css({ 569 width: inla.outerWidth(), 570 left: inla.offset().left, 571 top: x.offset().top + x.outerHeight() 572 }); 573 574 body.on( 'click.cz_hf_elm', function(e) {
575 $( '.hf_elm_area' ).slideUp( 'fast' ); 576 body.off( 'click.cz_hf_elm' ); 577 }); 578 579 e.preventDefault(); 580 e.stopPropagation(); 581 582 }); 583 584 // Extra 585 $( '.tagcloud' ).addClass( 'clr' ); 586 587 // Input buttons to button tag 588 $( '.form-submit .submit, input.search-submit, .wpcf7-submit' ).codevz( 'button', function() { 589 590 var x = $( this ); 591 592 $( '<button name="submit" type="submit" class="' + x.attr('class') + '">' + x.val() + '</button>' ).insertAfter( x ); 593 594 x.detach(); 595 596 }); 597 598 // Post views count. 599 $( '.xtra-post-views' ).codevz( 'post_views', function() { 600 601 var x = $( this ); 602 603 $.ajax({ 604 type: "GET", 605 url: body.data( 'ajax' ) || ajaxurl, 606 dataType: 'html', 607 data: "action=codevz_ajax_post_views&id=" + x.attr( 'data-id' ) + "&nonce=" + x.attr( 'data-nonce' ), 608 success: function( data ) { 609 console.log( data ); 610 // Post views count worked. 611 }, 612 error: function( xhr, status, error ) { 613 console.log( xhr, status, error ); 614 } 615 }); 616 617 }); 618 619 this.menu_anchor(); 620 }, 621 622 // Menu Anchor. 623 menu_anchor: function() { 624 625 // Disable Elementor links anchor. 626 if ( typeof elementorFrontend != 'undefined' ) { 627 628 setTimeout( function() { 629 630 elementorFrontend.elements.$document.off( 631 'click', 632 elementorFrontend.utils.anchors.getSettings( 'selectors.links' ), 633 elementorFrontend.utils.anchors.handleAnchorLinks 634 ); 635 636 }, 500 ); 637 638 } 639 640 // Prevent hashtag link jump. 641 $( "a[href='#']" ).not( 'a[target="_blank"]' ).on( 'click.prevent_jump', function( e ) { 642 e.preventDefault(); 643 }); 644 645 // Init. 646 var aBar = body.hasClass( 'admin-bar' ) ? 32 : 0, 647 mLink = $( "a[href*='#']" ).not( "a[href='#'],a[target='_blank'],a[href*='#/']" ), 648 sticky = $( '.header_is_sticky' ).not( '.smart_sticky, .header_4' ), 649 scrollTop = 0, timeout, 650 scrollToAnchor = function( target ) { 651 652 clearTimeout( timeout ); 653 654 timeout = setTimeout( function() { 655 656 target = target.replace( '%20', ' ' ); 657 target = ( target.indexOf( '#' ) >= 0 ) ? $( target ) : $( '#' + target ); 658 659 if ( target.length && ! target.hasClass( 'cz_popup_modal' ) ) { 660 661 scrollTop = $( document ).scrollTop(); 662 663 if ( wind.width() < 768 && $( '.header_4.header_is_sticky' ).length ) { 664 sticky = $( '.header_4.header_is_sticky' ).not( '.smart_sticky' ); 665 } 666 667 if ( scrollTop == 0 && sticky.length ) { 668 $( document ).scrollTop( 1 ); 669 } 670 671 setTimeout( function() { 672 673 page.animate({ scrollTop: target.offset().top - aBar - ( sticky.outerHeight() || 0 ) }, 1200, 'easeInOutCodevz', function() { 674 675 page.stop(); 676 677 }); 678 679 $( '.offcanvas-close' ).trigger( 'click' ); 680 681 }, scrollTop == 0 ? 450 : 1 ); 682 683 } 684 685 }, 50 ); 686 687 }; 688 689 // Prevent page scroll jumping. 690 var target = window.location.hash; 691 if ( target ) { 692 target = target.replace( '#', '' ).replace( '%20', ' ' ); 693 if ( $( '#' + target ).length ) { 694 695 // Stop scroll. 696 page.animate({scrollTop: 0}, 1); 697 698 // Scroll to anchor. 699 setTimeout(function() { 700 scrollToAnchor( target ); 701 }, 1500 ); 702 } 703 } 704 705 // Links. 706 if ( mLink.length ) { 707 708 mLink.off( 'click.anchor' ).on( 'click.anchor', function( e ) { 709 710 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 ) { 711 712 if ( ! $( e.target ).hasClass( 'cz_indicator' ) ) { 713 714 if ( $( this.hash ).length && location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname ) { 715 scrollToAnchor( this.hash ); 716 } else if ( this.hash ) { 717 location = $( this ).attr( 'href' ); 718 } 719 720 } 721 722 e.preventDefault(); 723 724 } 725 726 }); 727 728 var mPage = $( '.sf-menu' ), 729 mPageH = mPage.outerHeight() + 15, 730 mItems = mPage.find( "a[href*='#']" ).not( "a[href='#'],a[href*='#/']" ), 731 sItems = mItems.map(function(){ 732 var item = $( $( this ).attr( "href" ).replace( /\s+|%20/g, "" ).replace( /^.*\#(.*)$/g, "#$1" ) ); 733 if ( item.length ) { 734 return item; 735 } 736 }); 737 738 wind.on( 'scroll.anchor', function() { 739 740 clearTimeout( timeout ); 741 742 timeout = setTimeout( function() { 743 744 var ft = $( this ).scrollTop() + mPageH + aBar + ( sticky.outerHeight() || 0 ), 745 cur = sItems.map(function() { 746 if ( $(this).offset().top < ft ) 747 return this; 748 }); 749 750 cur = cur[cur.length-1]; 751 var id = cur && cur.length ? cur[0].id : ""; 752 if ( id && ! $( '#' + id + '.cz_popup_modal' ).length && $( '#' + id ).length ) { 753 body.trigger( 'click' ); 754 mItems.parent().removeClass( "current_menu" ).end().filter( "[href*='#" + id + "']" ).parent().addClass( "current_menu" ); 755 } else { 756 mItems.parent().removeClass( "current_menu" ); 757 } 758 759 }, 50 ); 760 761 }); 762 } 763 }, 764 765 // Height changed = run callback. 766 heightChanged: function( elm, callback ) { 767 var lastHeight = elm.outerHeight(), newHeight; 768 769 // First. 770 callback(); 771 772 // Height detect. 773 ( function run() { 774 775 newHeight = elm.outerHeight(); 776 777 if ( lastHeight != newHeight ) { 778 callback(); 779 lastHeight = newHeight; 780 } 781 782 if ( elm.onElementHeightChangeTimer ) { 783 clearTimeout( elm.onElementHeightChangeTimer ); 784 } 785 786 elm.onElementHeightChangeTimer = setTimeout( run, 500 ); 787 788 })(); 789 790 }, 791 792 /* 793 * offCanvas area 794 */ 795 offCanvas: function( selector, click ) { 796 797 var parent = selector.parent(), 798 area = selector.next(), 799 layout = $( '#layout' ),
800 overlay = $( '.cz_overlay' ), 801 isRight, i, 802 fixed_side = 0, 803 close, timeout; 804 805 if ( area.length ) { 806 807 var area = area.clone(), 808 isRight = area.hasClass( 'inview_right' ), 809 new_class = area.hasClass('sf-menu') ? 'sf-menu offcanvas_area' : 'offcanvas_area offcanvas_original'; 810 811 body.prepend( area.removeClass().addClass( 'sidebar_offcanvas_area' ).addClass( new_class + ( isRight ? ' inview_right' : ' inview_left' ) ) ); 812 var area_w = area.width() + 80; 813 814 if ( selector.closest( '.elementor-element' ).length ) { 815 816 var elementor_page = selector.closest( '.elementor' ).attr( 'data-elementor-id' ); 817 body.addClass( 'elementor-page-' + elementor_page + ' elementor-' + elementor_page ); 818 819 var classList = selector.closest( '.elementor-element' ).attr('class').split(/\s+/); 820 $.each( classList, function( index, item ) { 821 if ( item.indexOf( 'elementor-element-' ) == 0 ) { 822 area.addClass( 'elementor-element ' + item ); 823 } 824 }); 825 826 } 827 828 area.find( '.sub-menu' ).hide(); 829 830 } else { 831 832 return; 833 834 } 835 836 // Open icon 837 selector.on( 'click', function(e) { 838 839 if ( area.hasClass( 'active_offcanvas' ) && ! body.hasClass( 'offcanvas_doing' ) ) { 840 841 page.removeClass( 'no-scroll' ); 842 843 overlay.trigger( 'click' ); 844 845 } else { 846 847 page.addClass( 'no-scroll' ); 848 849 $( 'html' ).css( 'margin-top', '0 !important' ); 850 $( '#layout' ).css( 'margin-top', '40px !important' ); 851 852 // Close icon 853 if ( body.attr( 'class' ).indexOf( 'codevz-plus' ) >= 0 ) { 854 area.before( '<i class="fa czico-198-cancel offcanvas-close" aria-hidden="true"></i>' ); 855 } else { 856 area.before( '<i class="fa fa-times offcanvas-close" aria-hidden="true"></i>' ); 857 } 858 close = area.prev( '.offcanvas-close' ); 859 close.on( 'click', function(e) { 860 if ( click ) { 861 body.removeClass( 'active_offcanvas' ); 862 area.removeClass( 'active_offcanvas' ); 863 864 overlay.fadeOut(); 865 setTimeout(function() { 866 $( '.offcanvas-close' ).detach(); 867 wind.trigger( 'resize' ); 868 page.removeClass( 'no-scroll' ); 869 }, 500 ); 870 871 click = 0; 872 } else { 873 overlay.trigger( 'click' ); 874 } 875 }); 876 close.css( ( isRight ? 'right' : 'left' ), area.outerWidth() + fixed_side ); 877 878 body.addClass( 'offcanvas_doing active_offcanvas' + ( isRight ? ' cz_offcanvas_right' : ' cz_offcanvas_left' ) ); 879 area.addClass( 'active_offcanvas' ); 880 881 if ( wind.width() > 768 ) { 882 883 if ( ( $( '.fixed_side_left' ).length && $( '.cz_offcanvas_left' ).length ) || $( '.fixed_side_right' ).length && $( '.cz_offcanvas_right' ).length ) { 884 if ( ! $( '#cz_ofs' ).length ) { 885 $( 'head' ).append( '<style id="cz_ofs"></style>' ); 886 } 887 fixed_side = $( '.fixed_side' ).width(); 888 $( '#cz_ofs' ).html( '.active_offcanvas .offcanvas_area.active_offcanvas{transform:translateX(' + ( isRight ? '-' : '' ) + fixed_side + 'px)}' ); 889 } 890 891 } 892 893 overlay.fadeIn(); 894 895 setTimeout(function() { 896 body.removeClass( 'offcanvas_doing' ); 897 }, 1250 ); 898 } 899 900 e.stopPropagation(); 901 }); 902 903 // First time 904 if ( click ) { 905 selector.trigger( 'click' ); 906 } 907 908 // Prevent close on open icon 909 area.on( 'click', function(e) { 910 e.stopPropagation(); 911 }); 912 913 // reCall anchors 914 this.menu_anchor(); 915 916 // Click on body 917 overlay.on( 'click', function( e ) { 918 919 if ( $( '.active_offcanvas' ).length && ! body.hasClass( 'offcanvas_doing' ) ) { 920 921 body.removeClass( 'active_offcanvas' ); 922 area.removeClass( 'active_offcanvas' ); 923 924 overlay.fadeOut(); 925 926 setTimeout(function() { 927 928 $( '.offcanvas-close' ).detach(); 929 wind.trigger( 'resize' ); 930 page.removeClass( 'no-scroll' ); 931 932 }, 500 ); 933 934 } 935 936 setTimeout(function() { 937 938 if ( ! overlay.is( ':visible' ) && $( '.active_offcanvas' ).length ) { 939 940 $( '.offcanvas-close' ).trigger( 'click' ); 941 942 page.removeClass( 'no-scroll' ); 943 944 } 945 946 }, 500 ); 947 948 }); 949 950 // Close mobile on window resize. 951 wind.on( 'resize.offcanvas_close', function( e ) { 952 953 clearTimeout( timeout ); 954 955 timeout = setTimeout( function() { 956 957 var mh4 = $( '#menu_header_4' ); 958 959 if( mh4.hasClass( 'active_offcanvas' ) && wind.width() > 768 ) { 960 mh4.prev( 'i' ).trigger( 'click' ); 961 } 962 963 }, 50 ); 964 965 }); 966 967 // Reload necessary scripts. 968 if( ! area.hasClass( 'xtra-reload-js' ) ) { 969 970 // Fix menu icon click issue specially on mobile. 971 area.find( '.cz a' ).on( 'click', function( e ) { 972 973 if ( $( e.target ).hasClass( 'cz_indicator' ) ) { 974 975 var en = $( this ); 976 977 en.attr( 'data-href', en.attr( 'href' ) ).attr( 'href', '#' ); 978 979 setTimeout( function() { 980 en.attr( 'href', en.attr( 'data-href' ) ); 981 }, 250 ); 982 983 } 984 985 }); 986 987 // reInit codevz plus. 988 if ( typeof Codevz_Plus != 'undefined' ) { 989 990 Codevz_Plus.init(); 991 if ( typeof Codevz_Plus.working_hours != 'undefined' ) { 992 Codevz_Plus.working_hours(); 993 } 994 995 } 996 997 // Lazyload image inside offcanvas. 998 setTimeout( function() { 999 1000 $( window ).trigger( 'scroll.lazyload' ); 1001 1002 area.find( '[data-src]' ).each( function() { 1003 $( this ).attr( 'src', $( this ).data( 'src' ) ).removeAttr( 'data-src' ); 1004 }); 1005 1006 area.find( '.cz_tooltip' ).removeClass( 'cz_tooltip_down cz_tooltip_right cz_tooltip_left' ).addClass( 'cz_tooltip_up' ); 1007 1008 }, 500 ); 1009 1010 // reInit contact form 7. 1011 if( typeof wpcf7 != 'undefined' && area.find( '.wpcf7' ).length ) { 1012 1013 area.find( 'div.wpcf7 > form' ).each( function() { 1014 1015 var $this = $( this ); 1016 1017 if ( $.fn.initForm ) { 1018 wpcf7.initForm( $this ); 1019 1020 if ( wpcf7.cached ) { 1021 wpcf7.refill( $this ); 1022 } 1023 } 1024 1025 } ); 1026 1027 } 1028 1029 // reInit Facebook. 1030 setTimeout( function(){ 1031 if ( window.FB ) { 1032 FB.XFBML.parse(); 1033 } 1034 }, 2000 ); 1035 1036 area.addClass( 'xtra-reload-js' ); 1037 1038 } 1039 1040 }, 1041 1042 /* 1043 * Show one by one with delay 1044 */ 1045 showOneByOne: function( e, s, d ) { 1046 var e = ( d == 'left' ) ? $( e.get().reverse() ) : e, 1047 b = ( d == 'left' ) ? {opacity:0,left:10} : {opacity: 0,left:-10}; 1048 1049 e.css( b ).each(function( i ) { 1050 $( this ).delay( s * i ).animate({opacity:1,left:0}); 1051 }); 1052 }, 1053 1054 }; 1055 1056})( jQuery ); 1057 1058jQuery( function( $ ) { 1059 Codevz.init(); 1060});
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.