1( function( theme, $ ) { 2 'use strict'; 3 4 theme = theme || {}; 5 6 $.extend( theme, { 7 mfpConfig: { 8 tClose: js_porto_vars.popup_close, 9 tLoading: '<div class="porto-ajax-loading"><i class="porto-loading-icon"></i></div>', 10 gallery: { 11 tPrev: js_porto_vars.popup_prev, 12 tNext: js_porto_vars.popup_next, 13 tCounter: js_porto_vars.mfp_counter 14 }, 15 image: { 16 tError: js_porto_vars.mfp_img_error 17 }, 18 ajax: { 19 tError: js_porto_vars.mfp_ajax_error 20 }, 21 callbacks: { 22 open: function() { 23 $( 'body' ).addClass( 'lightbox-opened' ); 24 var fixed = this.st.fixedContentPos; 25 if ( fixed ) { 26 $( '#header.sticky-header .header-main.sticky, #header.sticky-header .main-menu-wrap, .fixed-header #header.sticky-header .header-main, .fixed-header #header.sticky-header .main-menu-wrap' ).css( theme.rtl_browser ? 'left' : 'right', theme.getScrollbarWidth() ); 27 } 28 /* D3-Ahsan - Start */ 29 var that = $( this._lastFocusedEl ); 30 if ( ( that.closest( '.portfolios-lightbox' ).hasClass( 'with-thumbs' ) ) && $( document ).width() >= 1024 ) { 31 32 var portfolio_lightbox_thumbnails_base = that.closest( '.portfolios-lightbox.with-thumbs' ).find( '.porto-portfolios-lighbox-thumbn
32ails' ).clone(), 33 magnificPopup = $.magnificPopup.instance; 34 35 $( 'body' ).prepend( portfolio_lightbox_thumbnails_base ); 36 37 var $portfolios_lightbox_thumbnails = $( 'body > .porto-portfolios-lighbox-thumbnails' ), 38 $portfolios_lightbox_thumbnails_carousel = $portfolios_lightbox_thumbnails.children( '.owl-carousel' ); 39 $portfolios_lightbox_thumbnails_carousel.themeCarousel( $portfolios_lightbox_thumbnails_carousel.data( 'plugin-options' ) ); 40 $portfolios_lightbox_thumbnails_carousel.trigger( 'refresh.owl.carousel' ); 41 42 var $carousel_items_wrapper = $portfolios_lightbox_thumbnails_carousel.find( '.owl-stage' ); 43 44 $carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' ); 45 $carousel_items_wrapper.find( '.owl-item' ).eq( magnificPopup.currItem.index ).addClass( 'current' ); 46 47 $.magnificPopup.instance.next = function() { 48 var magnificPopup = $.magnificPopup.instance; 49 $.magnificPopup.proto.next.call( this ); 50 $carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' ); 51 $carousel_items_wrapper.find( '.owl-item' ).eq( magnificPopup.currItem.index ).addClass( 'current' ); 52 }; 53 54 $.magnificPopup.instance.prev = function() { 55 var magnificPopup = $.magnificPopup.instance; 56 $.magnificPopup.proto.prev.call( this ); 57 $carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' ); 58 $carousel_items_wrapper.find( '.owl-item' ).eq( magnificPopup.currItem.index ).addClass( 'current' ); 59 }; 60 61 $carousel_items_wrapper.find( '.owl-item' ).on( 'click', function() { 62 $carousel_items_wrapper.find( '.owl-item' ).removeClass( 'current' ); 63 $.magnificPopup.instance.goTo( $( this ).index() ); 64 $( this ).addClass( 'current' ); 65 } ); 66 67 } 68 /* End - D3-Ahsan */ 69 }, 70 close: function() { 71 $( 'body' ).removeClass( 'lightbox-opened' ); 72 var fixed = this.st.fixedContentPos; 73 if ( fixed ) { 74 $( '#header.sticky-header .header-main.sticky, #header.sticky-header .main-menu-wrap, .fixed-header #header.sticky-header .header-main, .fixed-header #header.sticky-header .main-menu-wrap' ).css( theme.rtl_browser ? 'left' : 'right', '' ); 75 } 76 $( '.owl-carousel .owl-stage' ).each( function() { 77 var $this = $( this ), 78 w = $this.width() + parseInt( $this.css( 'padding-left' ) ) + parseInt( $this.css( 'padding-right' ) ); 79 80 $this.css( { 'width': w + 200 } ); 81 setTimeout( function() { 82 $this.css( { 'width': w } ); 83 }, 0 ); 84 } ); 85 /* D3-Ahsan - Start */ 86 var that = $( this._lastFocusedEl ); 87 if ( ( that.parents( '.portfolios-lightbox' ).hasClass( 'with-thumbs' ) ) && $( document ).width() >= 1024 ) { 88 $( ' body >
88 .porto-portfolios-lighbox-thumbnails' ).remove(); 89 } 90 /* End - D3-Ahsan */ 91 } 92 } 93 }, 94 } ); 95 96} ).apply( this, [window.theme, jQuery] ); 97 98// Search 99( function( theme, $ ) { 100 'use strict'; 101 102 theme = theme || {}; 103 104 $.extend( theme, { 105 106 Search: { 107 108 defaults: { 109 popup: $( '.searchform-popup' ), 110 form: $( '.searchform' ) 111 }, 112 113 initialize: function( $popup, $form ) { 114 this.$popup = ( $popup || this.defaults.popup ); 115 this.$form = ( $form || this.defaults.form ); 116 this.form_layout = this.$form.hasClass( 'search-layout-overlay' ) ? 'overlay' : this.$form.hasClass( 'search-layout-reveal' ) ? 'reveal' : false; 117 118 this.build() 119 .events(); 120 121 return this; 122 }, 123 124 build: function() { 125 var self = this; 126 127 /* Change search form values */ 128 var $search_form_texts = self.$form.find( '.text input' ), 129 $search_form_cats = self.$form.find( '.cat' ); 130 131 if ( $( '.searchform .cat' ).get( 0 ) && $.fn.selectric ) { 132 $( '.searchform .cat' ).selectric( { 133 arrowButtonMarkup: '', 134 expandToItemText: true, 135 maxHeight: 240 136 } ); 137 } 138 139 $search_form_texts.on( 'change', function() { 140 var $this = $( this ), 141 val = $this.val(); 142 143 $search_form_texts.each( function() { 144 if ( $this != $( this ) ) $( this ).val( val ); 145 } ); 146 } ); 147 148 $search_form_cats.on( 'change', function() { 149 var $this = $( this ), 150 val = $this.val(); 151 152 $search_form_cats.each( function() { 153 if ( $this != $( this ) ) $( this ).val( val ); 154 } ); 155 } ); 156 157 return this; 158 }, 159 160 events: function() { 161 var self = this; 162 163 $( 'body' ).on( 'click', '.searchform-popup', function( e ) { 164 e.stopPropagation(); 165 } ); 166 $( 'body' ).off( 'click', '.searchform-popup .search-toggle' ).on( 'click', '.searchform-popup .search-toggle', function( e ) { 167 var $this = $( this ), 168 $form = $this.next(); 169 $this.toggleClass( 'opened' ); 170 if ( 'overlay' == self.form_layout ) { 171 $this.siblings( '.search-layout-overlay' ).addClass( 'show' ); 172 $( 'html' ).toggleClass( 'porto-search-opened porto-search-overlay-wrap' ); 173 $this.closest( '.vc_row.vc_row-flex>.vc_column_container>.vc_column-inner' ).css( 'z-index', '999' ); 174 } else if ( 'reveal' == self.form_layout ) { 175 self.parents = []; 176 var $element = self.$popup; 177 while ( ! ( ( $element.hasClass( 'elementor-container' ) && ! $element.parent().hasClass( 'elementor-inner-container' ) ) || ( $element.hasClass( 'e-con-inner' ) && ! $element.parent().hasClass( 'e-child' ) ) || ( $element.parent().hasClass( 'vc_row' ) && ! $element.parent().hasClass( 'vc_inner' ) ) || 'header' == $element.parent().attr( 'id' ) || $element.parent().hasClass( 'header-main' ) || $element.parent().hasClass( 'header-top' ) || $element.parent().hasClass( 'header-bottom' ) ) ) { 178 $element = $element.parent(); 179 $element.addClass( 'position-static' ); 180 self.parents.push( $element ); 181 } 182 if ( 'static' == $element.parent().css( 'position' ) ) { 183 self.topParent = $element.parent(); 184 self.topParent.addClass( 'position-relative' ); 185 } 186 $form.toggle(); 187 window.setTimeout( function () { 188 $( 'body' ).toggleClass( 'porto-search-opened' ); 189 }, 100 ); 190 } else { 191 $form.toggle(); 192 } 193 if ( $this.hasClass( 'opened' ) ) { 194 $( '#mini-cart.open' ).removeClass( 'open' ); 195 $this.next().find( 'input[type="text"]' ).focus(); 196 if ( self.$popup.find( '.btn-close-search-form' ).length ) { 197 self.$popup.parent().addClass( 'position-static' ); 198 } 199 } else if ( 'reveal' == self.form_layout ) { 200 self.removeFormStyle(); 201 } 202 e.preventDefault(); 203 e.stopPropagation(); 204 } ); 205 206 $( 'html,body' ).on( 'click', function() { 207 self.removeFormStyle(); 208 } ); 209 210 if ( !( 'ontouchstart' in document ) ) { 211 212 $( window ).on( 'resize', function() { 213 self.removeFormStyle(); 214 } ); 215 } 216 217 $( '.btn-close-search-form' ).on( 'click', function( e ) { 218 e.preventDefault(); 219 self.removeFormStyle(); 220 } ); 221 222 return self; 223 }, 224 225 removeFormStyle: function() { 226 this.$form.removeAttr( 'style' ); 227 var $searchToggle = this.$popup.find( '.search-toggle' ); 228 $searchToggle.removeClass( 'opened' ); 229 if ( 'overlay' == this.form_layout ) { 230 $( 'html' ).removeClass( 'porto-search-opened porto-search-overlay-wrap' ); 231 $searchToggle.siblings( '.search-layout-overlay' ).removeClass( 'show' ); 232 $searchToggle.closest( '.vc_row.vc_row-flex>.vc_column_container>.vc_column-inner' ).css( 'z-index', '' ); 233 } else if ( 'reveal' == this.form_layout && this.parents && this.parents.length >= 1 ) { 234 $( 'body' ).removeClass( 'porto-search-opened' );
235 this.parents.forEach( $element => { 236 $element.removeClass( 'position-static' ); 237 }); 238 if ( this.topParent ) { 239 this.topParent.removeClass( 'position-relative' ); 240 } 241 } 242 if ( this.$popup.find( '.btn-close-search-form' ).length ) { 243 this.$popup.parent().removeClass( 'position-static' ); 244 } 245 } 246 } 247 248 } ); 249 250} ).apply( this, [window.theme, jQuery] ); 251 252 253// Animate 254( function( theme, $ ) { 255 'use strict'; 256 257 theme = theme || {}; 258 259 var instanceName = '__animate'; 260 261 var Animate = function( $el, opts ) { 262 return this.initialize( $el, opts ); 263 }; 264 265 Animate.defaults = { 266 accX: 0, 267 accY: -120, 268 delay: 1, 269 duration: 1000 270 }; 271 272 Animate.prototype = { 273 initialize: function( $el, opts ) { 274 if ( $el.data( instanceName ) ) { 275 return this; 276 } 277 278 this.$el = $el; 279 280 this 281 .setData() 282 .setOptions( opts ) 283 .build(); 284 285 return this; 286 }, 287 288 setData: function() { 289 this.$el.data( instanceName, true ); 290 291 return this; 292 }, 293 294 setOptions: function( opts ) { 295 this.options = $.extend( true, {}, Animate.defaults, opts, { 296 wrapper: this.$el 297 } ); 298 299 return this; 300 }, 301 302 build: function() { 303 var self = this, 304 $el = this.options.wrapper, 305 delay = 0, 306 duration = 0; 307 308 if ( $el.data( 'appear-animation-svg' ) ) { 309 $el.find( '[data-appear-animation]' ).each( function() { 310 var $this = $( this ), 311 opts; 312 313 var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) ); 314 if ( pluginOptions ) 315 opts = pluginOptions; 316 317 $this.themeAnimate( opts ); 318 } ); 319 320 return this; 321 } 322 323 $el.addClass( 'appear-animation' ); 324 325 var el_obj = $el.get( 0 ); 326 327 delay = Math.abs( $el.data( 'appear-animation-delay' ) ? $el.data( 'appear-animation-delay' ) : self.options.delay ); 328 duration = Math.abs( $el.data( 'appear-animation-duration' ) ? $el.data( 'appear-animation-duration' ) : self.options.duration ); 329 if ( 'undefined' !== typeof $el.data( 'appear-animation' ) && $el.data( 'appear-animation' ).includes( 'revealDir' ) ) { 330 if ( delay > 1 ) { 331 el_obj.style.setProperty( '--porto-reveal-animation-delay', delay + 'ms' ); 332 } 333 if ( duration != 1000 ) { 334 el_obj.style.setProperty( '--porto-reveal-animation-duration', duration + 'ms' ); 335 } 336 if ( $el.data( 'animation-reveal-clr' ) ) { 337 el_obj.style.setProperty( '--porto-reveal-clr', $el.data( 'animation-reveal-clr' ) ); 338 } 339 } else { 340 if ( delay > 1 ) { 341 el_obj.style.animationDelay = delay + 'ms'; 342 } 343 if ( duration != 1000 ) { 344 el_obj.style.animationDuration = duration + 'ms'; 345 } 346 } 347 348 /*if ( $el.find( '.porto-lazyload:not(.lazy-load-loaded)' ).length ) { 349 $el.find( '.porto-lazyload:not(.lazy-load-loaded)' ).trigger( 'appear' ); 350 }*/ 351 $el.addClass( $el.data( 'appear-animation' ) + ' appear-animation-visible' ); 352 353 return this; 354 } 355 }; 356 357 // expose to scope 358 $.extend( theme, { 359 Animate: Animate 360 } ); 361 362 // jquery plugin 363 $.fn.themeAnimate = function( opts ) { 364 return this.map( function() { 365 var $this = $( this ); 366 367 if ( $this.data( instanceName ) ) { 368 return $this; 369 } else { 370 return new theme.Animate( $this, opts ); 371 } 372 373 } ); 374 }; 375 376} ).apply( this, [window.theme, jQuery] ); 377 378// Animated Letters 379( function( theme, $ ) { 380 381 theme = theme || {}; 382 383 var instanceName = '__animatedLetters'; 384 385 var PluginAnimatedLetters = function( $el, opts ) { 386 return this.initialize( $el, opts ); 387 }; 388 389 PluginAnimatedLetters.defaults = { 390 contentType: 'letter', 391 animationName: 'typeWriter', 392 animationSpeed: 50, 393 startDelay: 500, 394 minWindowWidth: 768, 395 letterClass: '', 396 wordClass: '' 397 }; 398 399 PluginAnimatedLetters.prototype = { 400 initialize: function( $el, opts ) { 401 if ( $el.data( instanceName ) ) { 402 return this; 403 } 404 405 var self = this; 406 407 this.$el = $el; 408 this.initialText = $el.text(); 409 this.timeoutId = null; 410 this 411 .setData() 412 .setOptions( opts ) 413 .build() 414 .events(); 415 416 return this; 417 }, 418 419 setData: function() { 420 this.$el.data( instanceName, this ); 421 422 return this; 423 }, 424 425 setOptions: function( opts ) { 426 this.options = $.extend( true, {}, PluginAnimatedLetters.defaults, opts, { 427 wrapper: this.$el 428 } ); 429 430 return this; 431 }, 432 433 build: function() { 434 var self = this, 435 letters = self.$el.text().split( '' ); 436 437 if ( $( window ).width() < self.options.minWindowWidth ) { 438 self.$el.addClass( 'initialized' ); 439 return this; 440 } 441 442 if ( self.options.firstLoadNoAnim ) { 443 self.$el.css( { 444 visibility: 'visible' 445 } ); 446 447 // Inside Carousel 448 if ( self.$el.closest( '.owl-carousel' ).get( 0 ) ) { 449 setTimeout( function() { 450 self.$el.closest( '.owl-carousel' ).on( 'change.owl.carousel', function() { 451 self.options.firstLoadNoAnim = false; 452 self.build(); 453 } ); 454 }, 500 ); 455 } 456 457 return this; 458 } 459 460 // Add class to show 461 self.$el.addClass( 'initialized' ); 462 463 // Set Min Height to avoid flicking issues 464 self.setMinHeight(); 465 if ( self.options.contentType == 'letter' ) { 466 self.$el.text( '' ); 467 if ( self.options.animationName == 'typeWriter' ) { 468 self.$el.append( '<span class="letters-wrapper"></span><span class="typeWriter"></pre>' ); 469 470 var index = 0; 471 var timeout = function() { 472 var st = setTimeout( function() { 473 var letter = letters[index]; 474 475 self.$el.find( '.letters-wrapper' ).append( '<span class="letter ' + ( self.options.letterClass ? self.options.letterClass + ' ' : '' ) + '">' + letter + '</span>' ); 476 477 index++; 478 timeout(); 479 }, self.options.animationSpeed ); 480 481 if ( index >= letters.length ) { 482 clearTimeout( st ); 483 } 484 }; 485 timeout(); 486 } else { 487 this.timeoutId = setTimeout( function() { 488 for ( var i = 0; i < letters.length; i++ ) { 489 var letter = letters[i]; 490 491 self.$el.append( '<span class="letter ' + ( self.options.letterClass ? self.options.letterClass + ' ' : '' ) + self.options.animationName + ' animated" style="animation-delay: ' + ( i * self.options.animationSpeed ) + 'ms;">' + ( letter 492 == ' ' ? ' ' : letter ) + '</span>' ); 493 494 } 495 }, self.options.startDelay ); 496 } 497 } else if ( self.options.contentType == 'word' ) { 498 var words = self.$el.text().split( " " ),
499 delay = self.options.startDelay; 500 501 self.$el.empty(); 502 503 $.each( words, function( i, v ) { 504 self.$el.append( $( '<span class="animated-words-wrapper">' ).html( '<span class="animated-words-item ' + self.options.wordClass + ' appear-animation" data-appear-animation="' + self.options.animationName + '" data-appear-animation-delay="' + delay + '">' + v + ' </span>' ) ); 505 delay = delay + self.options.animationSpeed; 506 } ); 507 508 if ( $.isFunction( $.fn['themeAnimate'] ) && self.$el.find( '.animated-words-item[data-appear-animation]' ).length ) { 509 510 self.$el.find( '[data-appear-animation]' ).each( function() { 511 var $this = $( this ), 512 opts; 513 514 var pluginOptions = theme.getOptions( $this.data( 'plugin-options' ) ); 515 if ( pluginOptions ) 516 opts = pluginOptions; 517 518 $this.themeAnimate( opts ); 519 } ); 520 } 521 522 self.$el.addClass( 'initialized' ); 523 } 524 return this; 525 }, 526 527 setMinHeight: function() { 528 var self = this; 529 530 // if it's inside carousel 531 if ( self.$el.closest( '.owl-carousel' ).get( 0 ) ) { 532 self.$el.closest( '.owl-carousel' ).addClass( 'd-block' ); 533 self.$el.css( 'min-height', self.$el.height() ); 534 self.$el.closest( '.owl-carousel' ).removeClass( 'd-block' ); 535 } else { 536 self.$el.css( 'min-height', self.$el.height() ); 537 } 538 539 return this; 540 }, 541 542 destroy: function() { 543 var self = this; 544 545 self.$el 546 .html( self.initialText ) 547 .css( 'min-height', '' ); 548 if ( this.timeoutId ) { 549 clearTimeout( this.timeoutId ); 550 this.timeoutId = null; 551 } 552 return this; 553 }, 554 555 events: function() { 556 var self = this; 557 558 // Destroy 559 self.$el.on( 'animated.letters.destroy', function() { 560 self.destroy(); 561 } ); 562 563 // Initialize 564 self.$el.on( 'animated.letters.initialize', function() { 565 self.build(); 566 } ); 567 568 return this; 569 } 570 }; 571 572 // expose to scope 573 $.extend( theme, { 574 PluginAnimatedLetters: PluginAnimatedLetters 575 } ); 576 577 // jquery plugin 578 $.fn.themePluginAnimatedLetters = function( opts ) { 579 return this.map( function() { 580 var $this = $( this ); 581 582 if ( $this.data( instanceName ) ) { 583 return $this.data( instanceName ); 584 } else { 585 return new PluginAnimatedLetters( $this, opts ); 586 } 587 588 } ); 589 } 590 591} ).apply( this, [window.theme, jQuery] ); 592 593// Carousel 594if ( typeof jQuery.fn.owlCarousel == 'function' ) { 595 ( function( theme, $ ) { 596 'use strict'; 597 598 theme = theme || {}; 599 600 var instanceName = '__carousel'; 601 602 var Carousel = function( $el, opts ) { 603 return this.initialize( $el, opts ); 604 }; 605 606 Carousel.defaults = $.extend( {}, { 607 loop: true, 608 navText: [], 609 themeConfig: false, 610 lazyLoad: true, 611 lg: 0, 612 md: 0, 613 sm: 0, 614 xs: 0, 615 single: false, 616 rtl: theme.rtl 617 } ); 618 619 Carousel.prototype = { 620 initialize: function( $el, opts ) { 621 if ( $el.data( instanceName ) ) { 622 return this; 623 } 624 625 this.$el = $el; 626 627 this 628 .setData() 629 .setOptions( opts ) 630 .build(); 631 632 return this; 633 }, 634 635 setData: function() { 636 this.$el.data( instanceName, true ); 637 638 return this; 639 }, 640 641 setOptions: function( opts ) { 642 if ( ( opts && opts.themeConfig ) || !opts ) { 643 this.options = $.extend( true, {}, Carousel.defaults, theme.owlConfig, opts, { 644 wrapper: this.$el, 645 themeConfig: true 646 } ); 647 } else { 648 this.options = $.extend( true, {}, Carousel.defaults, opts, { 649 wrapper: this.$el 650 } ); 651 } 652 653 return this; 654 }, 655 656 calcOwlHeight: function( $el ) { 657 var h = 0; 658 $el.find( '.owl-item.active' ).each( function() { 659 if ( h < $( this ).height() ) 660 h = $( this ).height(); 661 } ); 662 $el.children( '.owl-stage-outer' ).height( h ); 663 }, 664 665 build: function() { 666 if ( !$.fn.owlCarousel ) { 667 return this; 668 } 669 670 var $el = this.options.wrapper, 671 loop = this.options.loop, 672 lg = this.options.lg, 673 md = this.options.md, 674 sm = this.options.sm, 675 xs = this.options.xs, 676 single = this.options.single, 677 zoom = $el.find( '.zoom' ).filter( function() { 678 if ( $( this ).closest( '.tb-image-type-slider' ).length ) { 679 return false; 680 } 681 return true; 682 } ).get( 0 ), 683 responsive = {}, 684 items, 685 count = $el.find( '.owl-item' ).length > 0 ? $el.find( '.owl-item:not(.cloned)' ).length : $el.find( '> *' ).length, 686 fullscreen = typeof this.options.fullscreen == 'undefined' ? false : this.options.fullscreen;
687 688 689 /*if (fullscreen) { 690 $el.children().width(window.innerWidth - theme.getScrollbarWidth()); 691 $el.children().height($el.closest('.fullscreen-carousel').length ? $el.closest('.fullscreen-carousel').height() : window.innerHeight); 692 $el.children().css('max-height', '100%'); 693 $(window).on('resize', function() { 694 $el.find('.owl-item').children().width(window.innerWidth - theme.getScrollbarWidth()); 695 $el.find('.owl-item').children().height($el.closest('.fullscreen-carousel').length ? $el.closest('.fullscreen-carousel').height() : window.innerHeight); 696 $el.find('.owl-item').children().css('max-height', '100%'); 697 }); 698 }*/ 699 700 if ( single ) { 701 items = 1; 702 } else if ( typeof this.options.responsive != 'undefined' ) { 703 for ( var w in this.options.responsive ) { 704 var number_items = Number( this.options.responsive[w] ); 705 responsive[Number( w )] = { items: number_items, loop: ( loop && count >= number_items ) ? true : false }; 706 } 707 } else { 708 items = this.options.items ? this.options.items : ( lg ? lg : 1 ); 709 var isResponsive = ( this.options.xxl || this.options.xl || lg || md || sm || xs ); 710 if ( isResponsive ) { 711 if ( this.options.xxl ) { 712 responsive[theme.screen_xxl] = { items: this.options.xxl, loop: ( loop && count > this.options.xxl ) ? true : false, mergeFit: this.options.mergeFit }; 713 } else if ( lg && items > lg + 1 ) { 714 responsive[theme.screen_xxl] = { items: items, loop: ( loop && count > items ) ? true : false, mergeFit: this.options.mergeFit }; 715 responsive[theme.screen_xl] = { items: lg + 1, loop: ( loop && count > lg + 1 ) ? true : false, mergeFit: this.options.mergeFit }; 716 } 717 if ( this.options.xl ) { 718 responsive[theme.screen_xl] = { items: this.options.xl, loop: ( loop && count > this.options.xl ) ? true : false, mergeFit: this.options.mergeFit }; 719 } else if ( typeof responsive[theme.screen_xl] == 'undefined' && ( ! lg || items != lg ) ) { 720 responsive[theme.screen_xl] = { items: items, loop: ( loop && count >= items ) ? true : false, mergeFit: this.options.mergeFit }; 721 } 722 if ( lg ) responsive[992] = { items: lg, loop: ( loop && count >= lg ) ? true : false, mergeFit: this.options.mergeFit_lg }; 723 if ( md ) responsive[768] = { items: md, loop: ( loop && count > md ) ? true : false, mergeFit: this.options.mergeFit_md }; 724 if ( sm ) { 725 responsive[576] = { items: sm, loop: ( loop && count > sm ) ? true : false, mergeFit: this.options.mergeFit_sm }; 726 } else { 727 if ( xs && xs > 1 ) { 728 responsive[576] = { items: xs, loop: ( loop && count > xs ) ? true : false, mergeFit: this.options.mergeFit_sm }; 729 } else { 730 responsive[576] = { items: 1, mergeFit: false }; 731 } 732 } 733 if ( xs ) { 734 responsive[0] = { items: xs, loop: ( loop && count > xs ) ? true : false, mergeFit: this.options.mergeFit_xs }; 735 } else { 736 responsive[0] = { items: 1 }; 737 } 738 } 739 } 740 741 if ( !$el.hasClass( 'show-nav-title' ) && this.options.themeConfig && theme.slider_nav && theme.slider_nav_hover ) { 742 $el.addClass( 'show-nav-hover' ); 743 } 744 745 this.options = $.extend( true, {}, this.options, { 746 items: items, 747 loop: ( loop && count > items ) ? true : false, 748 responsive: responsive, 749 onInitialized: function() { 750 if ( $el.hasClass( 'stage-margin' ) ) { 751 $el.find( '.owl-stage-outer' ).css( { 752 'margin-left': this.options.stagePadding, 753 'margin-right': this.options.stagePadding 754 } ); 755 } 756 var heading_cls = '.porto-u-heading, .vc_custom_heading, .slider-title, .elementor-widget-heading, .porto-heading'; 757 if ( $el.hasClass( 'show-dots-title' ) && ( $el.prev( heading_cls ).length || $el.closest( '.slider-wrapper' ).prev( heading_cls ).length || $el.closest( '.porto-recent-posts' ).prev( heading_cls ).length || $el.closest( '.elementor-widget-porto_recent_posts, .elementor-section' ).prev( heading_cls ).length ) ) { 758 var $obj = $el.prev( heading_cls ); 759 if ( !$obj.length ) { 760 $obj = $el.closest( '.slider-wrapper' ).prev( heading_cls ); 761 } 762 if ( !$obj.length ) { 763 $obj = $el.closest( '.porto-recent-posts' ).prev( heading_cls ); 764 } 765 if ( !$obj.length ) { 766 $obj = $el.closest( '.elementor-widget-porto_recent_posts, .elementor-section' ).prev( heading_cls ); 767 } 768 try { 769 var innerWidth = $obj.addClass( 'w-auto' ).css( 'display', 'inline-block' ).width(); 770 $obj.removeClass( 'w-auto' ).css( 'display', '' ); 771 if ( innerWidth + 15 + $el.find( '.owl-dots' ).width() <= $obj.width() ) { 772 $el.find( '.owl-dots' ).css( ( $( 'body' ).hasClass( 'rtl' ) ? 'right' : 'left' ), innerWidth + 15 + ( $el.width() - $obj.width() ) / 2 );
773 $el.find( '.owl-dots' ).css( 'top', -1 * $obj.height() / 2 - parseInt( $obj.css( 'margin-bottom' ) ) - $el.find( '.owl-dots' ).height() / 2 + 2 ); 774 } else { 775 $el.find( '.owl-dots' ).css( 'position', 'static' ); 776 } 777 } catch ( e ) { } 778 } 779 } 780 } ); 781 782 // Auto Height Fixes 783 if ( this.options.autoHeight ) { 784 var thisobj = this; 785 $( window ).on( 'resize', function() { 786 thisobj.calcOwlHeight( $el ); 787 } ); 788 789 if ( theme.isLoaded ) { 790 setTimeout( function() { 791 thisobj.calcOwlHeight( $el ); 792 }, 100 ); 793 } else { 794 $( window ).on( 'load', function() { 795 thisobj.calcOwlHeight( $el ); 796 } ); 797 } 798 } 799 800 var links = false; 801 if ( zoom ) { 802 links = []; 803 var i = 0; 804 805 $el.find( '.zoom' ).each( function() { 806 var slide = {}, 807 $zoom = $( this ); 808 809 slide.src = $zoom.data( 'src' ) ? $zoom.data( 'src' ) : $zoom.data( 'mfp-src' ); 810 slide.title = $zoom.data( 'title' ); 811 links[i] = slide; 812 $zoom.data( 'index', i ); 813 i++; 814 } ); 815 } 816 817 if ( $el.hasClass( 'show-nav-title' ) ) { 818 this.options.stagePadding = 0; 819 } else { 820 if ( this.options.themeConfig && theme.slider_nav && theme.slider_nav_hover ) 821 $el.addClass( 'show-nav-hover' ); 822 if ( this.options.themeConfig && !theme.slider_nav_hover && theme.slider_margin ) 823 $el.addClass( 'stage-margin' ); 824 } 825 if ( $el.hasClass( 'has-ccols-spacing' ) ) { 826 $el.removeClass( 'has-ccols-spacing' ); 827 } 828 $el.owlCarousel( this.options ); 829 830 if ( zoom && links ) { 831 $el.on( 'click', '.zoom', function( e ) { 832 e.preventDefault(); 833 if ( $.fn.magnificPopup ) { 834 var image_index = $( this ).data( 'index' ); 835 if ( typeof image_index == 'undefined' ) { 836 image_index = ( $( this ).closest( '.owl-item' ).index() - $el.find( '.cloned' ).length / 2 ) % $el.data( 'owl.carousel' ).items().length; 837 } 838 $.magnificPopup.close(); 839 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 840 items: links, 841 gallery: { 842 enabled: true 843 }, 844 type: 'image' 845 } ), image_index ); 846 } 847 return false; 848 } ); 849 } 850 851 return this; 852 } 853 } 854 // expose to scope 855 $.extend( theme, { 856 Carousel: Carousel 857 } ); 858 859 // jquery plugin 860 $.fn.themeCarousel = function( opts, zoom ) { 861 return this.map( function() { 862 var $this = $( this ); 863 864 if ( $this.data( instanceName ) ) { 865 return $this; 866 } else { 867 return new theme.Carousel( $this, opts, zoom ); 868 } 869 870 } ); 871 } 872 873 } ).apply( this, [window.theme, jQuery] ); 874} 875 876// Lightbox 877( function( theme, $ ) { 878 'use strict'; 879 880 theme = theme || {}; 881 882 var instanceName = '__lightbox'; 883 884 var Lightbox = function( $el, opts ) { 885 return this.initialize( $el, opts ); 886 }; 887 888 Lightbox.defaults = { 889 callbacks: { 890 open: function() { 891 $( 'body' ).addClass( 'lightbox-opened' ); 892 }, 893 close: function() { 894 $( 'body' ).removeClass( 'lightbox-opened' ); 895 } 896 } 897 }; 898 899 Lightbox.prototype = { 900 initialize: function( $el, opts ) { 901 if ( $el.data( instanceName ) ) { 902 return this; 903 } 904 905 this.$el = $el; 906 907 this 908 .setData() 909 .setOptions( opts ) 910 .build(); 911 912 return this; 913 }, 914 915 setData: function() { 916 this.$el.data( instanceName, this ); 917 918 return this; 919 }, 920 921 setOptions: function( opts ) { 922 this.options = $.extend( true, {}, Lightbox.defaults, theme.mfpConfig, opts, { 923 wrapper: this.$el 924 } ); 925 926 return this; 927 }, 928 929 build: function() { 930 if ( !$.fn.magnificPopup ) { 931 return this; 932 } 933 934 this.options.wrapper.magnificPopup( this.options ); 935 936 return this; 937 } 938 }; 939 940 // expose to scope 941 $.extend( theme, { 942 Lightbox: Lightbox 943 } ); 944 945 // jquery plugin 946 $.fn.themeLightbox = function( opts ) { 947 return this.map( function() { 948 var $this = $( this ); 949 950 if ( $this.data( instanceName ) ) { 951 return $this.data( instanceName ); 952 } else { 953 return new theme.Lightbox( $this, opts ); 954 } 955 956 } ); 957 } 958 959} ).apply( this, [window.theme, jQuery] ); 960 961// Visual Composer Image Zoom 962( function( theme, $ ) { 963 'use strict'; 964 965 theme = theme || {}; 966 967 var instanceName = '__toggle'; 968 969 var VcImageZoom = function( $el, opts ) { 970 return this.initialize( $el, opts ); 971 }; 972 973 VcImageZoom.defaults = { 974 975 }; 976 977 VcImageZoom.prototype = { 978 initialize: function( $el, opts ) { 979 if ( $el.data( instanceName ) ) { 980 return this; 981 } 982 983 this.$el = $el; 984 985 this 986 .setData() 987 .setOptions( opts ) 988 .build(); 989 990 return this; 991 }, 992 993 setData: function() { 994 this.$el.data( instanceName, this ); 995 996 return this; 997 }, 998 999 setOptions: function( opts ) { 1000 this.options = $.extend( true, {}, VcImageZoom.defaults, opts, { 1001 wrapper: this.$el 1002 } ); 1003 1004 return this; 1005 }, 1006 1007 build: function() { 1008 var self = this, 1009 $el = this.options.container; 1010 $el.parent().magnificPopup( $.extend( true, {}, theme.mfpConfig, { 1011 delegate: ".porto-vc-zoom", 1012 gallery: { 1013 enabled: true 1014 }, 1015 mainClass: 'mfp-with-zoom', 1016 zoom: { 1017 enabled: true, 1018 duration: 300 1019 }, 1020 type: 'image' 1021 } ) ); 1022 1023 return this; 1024 } 1025 }; 1026 1027 // expose to scope 1028 $.extend( theme, { 1029 VcImageZoom: VcImageZoom 1030 } ); 1031 1032 // jquery plugin 1033 $.fn.themeVcImageZoom = function( opts ) { 1034 return this.map( function() { 1035 var $this = $( this ); 1036 1037 if ( $this.data( instanceName ) ) { 1038 return $this.data( instanceName ); 1039 } else { 1040 return new theme.VcImageZoom( $this, opts ); 1041 } 1042 1043 } ); 1044 } 1045 1046} ).apply( this, [window.theme, jQuery] ); 1047 1048 1049// Post Filter 1050( function( theme, $ ) { 1051 'use strict'; 1052 1053 theme = theme || {}; 1054 1055 $.extend( theme, { 1056 1057 PostFilter: { 1058 1059 cache: { 1060 }, 1061 1062 defaults: { 1063 elements: '.portfolio-filter' 1064 }, 1065 1066 initialize: function( $elements, post_type ) { 1067 this.$elements = ( $elements || $( this.defaults.elements ) ); 1068 this.build( post_type ); 1069 1070 return this; 1071 }, 1072 1073 filterFn: function( e ) { 1074 if ( typeof e == 'undefined' || typeof e.data == 'undefined' || typeof e.data.elements == 'undefined' || !e.data.elements || !e.data.elements.length ) { 1075 return; 1076 } 1077 var self = e.data.selfobj;
1078 1079 if ( self.isLoading ) { 1080 return false; 1081 } 1082 var $this = e.data.thisobj, 1083 $elements = e.data.elements, 1084 position = e.data.position, 1085 post_type = e.data.post_type, 1086 $parent = e.data.parent, 1087 $posts_wrap = e.data.posts_wrap, 1088 use_ajax = e.data.use_ajax, 1089 page_path = e.data.page_path, 1090 infinite_load = e.data.infinite_load, 1091 load_more = e.data.load_more; 1092 e.preventDefault(); 1093 if ( $( this ).hasClass( 'active' ) ) { 1094 return; 1095 } 1096 1097 self.isLoading = true; 1098 var selector = $( this ).attr( 'data-filter' ); 1099 if ( 'sidebar' == position ) { 1100 $( '.sidebar-overlay' ).trigger( 'click' ); 1101 } 1102 1103 $this.find( '.active' ).removeClass( 'active' ); 1104 1105 if ( use_ajax ) { 1106 var current_cat = '*' == selector ? '' : selector; 1107 if ( !page_path ) { 1108 page_path = $posts_wrap.data( 'page_path' ); 1109 } 1110 if ( page_path ) { 1111 $posts_wrap.data( 'page_path', page_path.replace( /&category=[^&]*&/, '&category=' + current_cat + '&' ) ); 1112 } 1113 1114 $( this ).addClass( 'active' ); 1115 self.load_posts( current_cat, infinite_load || load_more ? true : false, $parent, post_type, $posts_wrap, undefined, $( this ).children( 'a' ).attr( 'href' ) ); 1116 } else if ( 'faq' == post_type ) { 1117 $parent.find( '.faq' ).each( function() { 1118 var $that = $( this ), easing = "easeInOutQuart", timeout = 300; 1119 if ( selector == '*' ) { 1120 if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() { 1121 $( this ).attr( 'style', '' ).show(); 1122 } ); 1123 selected++; 1124 } else { 1125 if ( $that.hasClass( selector ) ) { 1126 if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() { 1127 $( this ).attr( 'style', '' ).show(); 1128 } ); 1129 selected++; 1130 } else { 1131 if ( $that.css( 'display' ) != 'none' ) $that.stop( true ).slideUp( timeout, easing, function() { 1132 $( this ).attr( 'style', '' ).hide(); 1133 } ); 1134 } 1135 } 1136 } ); 1137 1138 if ( !selected && $parent.find( '.faqs-infinite' ).length && typeof ( $.fn.infinitescroll ) != 'undefined' ) { 1139 $parent.find( '.faqs-infinite' ).infinitescroll( 'retrieve' ); 1140 } 1141 } else if ( $parent.hasClass( 'portfolios-timeline' ) ) { 1142 var selected = 0; 1143 $parent.find( '.portfolio' ).each( function() { 1144 var $that = $( this ), easing = "easeInOutQuart", timeout = 300; 1145 if ( selector == '*' ) { 1146 if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() { 1147 $( this ).attr( 'style', '' ).show(); 1148 } ); 1149 selected++; 1150 } else { 1151 if ( $that.hasClass( selector ) ) { 1152 if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() { 1153 $( this ).attr( 'style', '' ).show(); 1154 } ); 1155 selected++; 1156 } else { 1157 if ( $that.css( 'display' ) != 'none' ) $that.stop( true ).slideUp( timeout, easing, function() { 1158 $( this ).attr( 'style', '' ).hide(); 1159 } ); 1160 } 1161 } 1162 } ); 1163 if ( !selected && $parent.find( '.portfolios-infinite' ).length && typeof ( $.fn.infinitescroll ) != 'undefined' ) { 1164 $parent.find( '.portfolios-infinite' ).infinitescroll( 'retrieve' ); 1165 } 1166 setTimeout( function() { 1167 theme.FilterZoom.initialize( $parent ); 1168 }, 400 ); 1169 } else { 1170 $parent.find( '.' + post_type + '-row' ).isotope( { 1171 filter: selector == '*' ? selector : '.' + selector 1172 } ); 1173 } 1174 1175 if ( !use_ajax ) { 1176 $( this ).addClass( 'active' ); 1177 self.isLoading = false; 1178 } 1179 1180 if ( position == 'sidebar' ) { 1181 self.$elements.each( function() { 1182 var $that = $( this ); 1183 1184 if ( $that == $this && $that.data( 'position' ) != 'sidebar' ) return; 1185 $that.find( 'li' ).removeClass( 'active' ); 1186 $that.find( 'li[data-filter="' + selector + '"]' ).addClass( 'active' ); 1187 } ); 1188 } 1189 1190 if ( !use_ajax ) { 1191 window.location.hash = '#' + selector; 1192 } 1193 theme.refreshVCContent(); 1194 return false; 1195 }, 1196 1197 build: function( post_type_param ) { 1198 var self = this; 1199 1200 self.$elements.each( function() { 1201 var $this = $( this ), 1202 position = $this.data( 'position' ), 1203 $parent, 1204 post_type; 1205 if ( typeof post_type_param == 'undefined' ) { 1206 if ( $this.hasClass( 'member-filter' ) ) { 1207 post_type = 'member'; 1208 } else if ( $this.hasClass( 'faq-filter' ) ) { 1209 post_type = 'faq'; 1210 } else if ( $this.hasClass( 'product-filter' ) ) { 1211 post_type = 'product'; 1212 } else if ( $this.hasClass( 'post-filter' ) ) { 1213 post_type = 'post'; 1214 } else if ( $this.hasClass( 'portfolio-filter' ) ) { 1215 post_type = 'portfolio'; 1216 } else { 1217 post_type = $this.attr( 'data-filter-type' ); 1218 } 1219 } else { 1220 post_type = post_type_param; 1221 } 1222 1223 if ( 'sidebar' == position ) { 1224 $parent = $( '.main-content .page-' + post_type + 's' ); 1225 //theme.scrolltoContainer($parent); 1226 } else if ( 'global' == position ) { 1227 $parent = $( '.main-content .page-' + post_type + 's' ); 1228 } else { 1229 $parent = $this.closest( '.page-' + post_type + 's' ); 1230 } 1231 if ( !$parent.length ) { 1232 $parent = $this.closest( '.porto-posts-grid' ); 1233 } 1234 if ( !$parent || !$parent.length ) { 1235 return; 1236 } 1237 var use_ajax = $this.hasClass( 'porto-ajax-filter' ), 1238 infinite_load = $parent.hasClass( 'load-infinite' ), 1239 load_more = $parent.hasClass( 'load-more' ); 1240 1241 var $posts_wrap = $parent.find( '.' + post_type + 's-container' ), 1242 page_path; 1243 if ( use_ajax && ( ( !infinite_load && !load_more ) || !$parent.data( 'ajax_load_options' ) ) ) { 1244 var current_url = window.location.href; 1245 if ( -1 !== current_url.indexOf( '#' ) ) { 1246 current_url = current_url.split( '#' )[0]; 1247 } 1248 page_path = theme.ajax_url + ( -1 === theme.ajax_url.indexOf( '?' ) ? '?' : '&' ) + 'action=porto_ajax_posts&nonce=' + js_porto_vars.porto_nonce + '&post_type=' + post_type + '¤t_link=' + current_url + '&category=&page=%cur_page%'; 1249 if ( $parent.data( 'post_layout' ) ) { 1250 page_path += '&post_layout=' + $parent.data( 'post_layout' ); 1251 } 1252 $posts_wrap.data( 'page_path', page_path ); 1253 } 1254 1255 $this.find( 'li' ).on( 'click', { thisobj: $this, selfobj: self, elements: self.$elements, position: position, parent: $parent, post_type: post_type, posts_wrap: $posts_wrap, use_ajax: use_ajax, page_path: page_path, infinite_load: infinite_load, load_more: load_more }, self.filterFn ); 1256 } ); 1257
1258 $( window ).on( 'hashchange', { elements: self.$elements }, self.hashchange ); 1259 self.hashchange( { data: { elements: self.$elements } } ); 1260 1261 return self; 1262 }, 1263 1264 hashchange: function( e ) { 1265 if ( typeof e == 'undefined' || typeof e.data == 'undefined' || typeof e.data.elements == 'undefined' || !e.data.elements || !e.data.elements.length ) { 1266 return; 1267 } 1268 var $elements = e.data.elements, 1269 $filter = $( $elements.get( 0 ) ), 1270 hash = window.location.hash; 1271 1272 if ( hash ) { 1273 var $o = $filter.find( 'li[data-filter="' + hash.replace( '#', '' ) + '"]' ); 1274 if ( !$o.hasClass( 'active' ) ) { 1275 $o.trigger( 'click' ); 1276 } 1277 } 1278 }, 1279 1280 set_elements: function( $elements ) { 1281 var self = this; 1282 if ( typeof $elements == 'undefined' || !$elements || !$elements.length ) { 1283 self.destroy( self.$elements ); 1284 return; 1285 } 1286 self.$elements = $elements; 1287 $( window ).off( 'hashchange', self.hashchange ).on( 'hashchange', { elements: $elements }, self.hashchange ); 1288 }, 1289 1290 destroy: function( $elements ) { 1291 if ( typeof $elements == 'undefined' || !$elements || !$elements.length ) { 1292 return; 1293 } 1294 var self = this; 1295 $elements.find( 'li' ).off( 'click', self.filterFn ); 1296 $( window ).off( 'hashchange', self.hashchange ); 1297 }, 1298 1299 load_posts: function( cat, is_infinite, $parent, post_type, $posts_wrap, default_args, page_url ) { 1300 var _gridcookie = ''; 1301 if ( $parent.hasClass( 'archive-products' ) ) { 1302 _gridcookie = new URLSearchParams( location.search.substring( 1 ) ).get( 'gridcookie' ); 1303 if ( ! ( _gridcookie == null || _gridcookie == '' || _gridcookie == 'grid' ) ) { 1304 page_url = theme.addUrlParam( page_url, 'gridcookie', _gridcookie ); 1305 } 1306 } 1307 var pid = $parent.attr( 'id' ), 1308 self = this, 1309 is_archive = $parent.hasClass( 'archive-posts' ), 1310 successfn = function( res, directcall ) { 1311 if ( !res ) { 1312 return; 1313 } 1314 if ( ( typeof directcall == 'undefined' || true !== directcall ) && typeof default_args == 'undefined' && pid ) { 1315 if ( !self.cache[pid] ) { 1316 self.cache[pid] = {}; 1317 } 1318 self.cache[pid][cat + _gridcookie] = res; 1319 } 1320 var $res = $( res ), 1321 is_shop = $parent.hasClass( 'archive-products' ), 1322 $posts = $res.find( is_archive ? '.archive-posts .posts-wrap' : '.posts-wrap' ).children(); 1323 1324 if ( !$posts.length ) { 1325 return; 1326 } 1327 1328 if ( typeof $posts_wrap == 'undefined' || is_archive ) { 1329 $posts_wrap = $parent.find( '.' + post_type + 's-container' ); 1330 } 1331 if ( !$posts_wrap.length ) { 1332 return; 1333 } 1334 1335 if ( $posts_wrap.data( 'isotope' ) ) { 1336 $posts_wrap.isotope( 'remove', $posts_wrap.children() ); 1337 } else { 1338 $posts_wrap.children().remove(); 1339 } 1340 1341 if ( $posts_wrap.hasClass( 'owl-loaded' ) ) { 1342 $posts_wrap.removeClass( 'owl-loaded' ); 1343 } 1344 $posts.children().addClass( 'fadeInUp animated' ); 1345 $posts_wrap.append( $posts ); 1346 theme.refreshVCContent( $posts ); 1347 1348 // filter 1349 var $old_filter = $parent.find( '.' + post_type + '-filter' ); 1350 if ( $old_filter.length && !$old_filter.hasClass( 'porto-ajax-filter' ) && !$parent.hasClass( 'load-infinite' ) && !$parent.hasClass( 'load-more' ) ) { 1351 var $new_filter = $res.find( ( is_archive ? '.archive-posts ' : '' ) + '.' + post_type + '-filter' ); 1352 if ( $new_filter.length ) { 1353 $old_filter.find( 'li:first-child' ).trigger( 'click' ); 1354 theme.PostFilter.destroy( $old_filter ); 1355 $old_filter.replaceWith( $new_filter ); 1356 //$new_filter = $parent.find( '.' + post_type + '-filter' ); 1357 theme.PostFilter.initialize( $new_filter, post_type ); 1358 theme.PostFilter.set_elements( $( 'ul[data-filter-type], ul.portfolio-filter, ul.member-filter, ul.faq-filter, .porto-ajax-filter.product-filter, .porto-ajax-filter.post-filter' ) ); 1359 } 1360 } 1361 1362 porto_init( $parent ); 1363 1364 var behavior_action = ''; 1365 if ( post_type != 'product' && post_type != 'member' && post_type != 'faq' && post_type != 'portfolio' && post_type != 'post' ) { 1366 behavior_action = 'ptu'; 1367 } else { 1368 behavior_action = post_type; 1369 } 1370 theme.PostsInfinite[behavior_action + 'Behavior']( $posts, $posts_wrap ); 1371 1372 // init CountDown 1373 $( document.body ).trigger( 'porto_init_countdown', [$posts_wrap] ); 1374 1375 // pagination 1376 var $old_pagination = $parent.find( '.pagination-wrap' ), 1377 $new_pagination = $res.find( ( is_archive ? '.archive-posts ' : '' ) + '.pagination-wrap' ).eq( 0 ), 1378 has_pagination = false, 1379 nst_pagination = false; 1380 if ( $old_pagination.length ) { 1381 if ( $new_pagination.length ) { 1382 $old_pagination.replaceWith( $new_pagination ); 1383 has_pagination = true; 1384 nst_pagination = true; 1385 } else { 1386 $old_pagination.children().remove(); 1387 } 1388 } else if ( $new_pagination.length ) { 1389 $parent.append( $new_pagination ); 1390 has_pagination = true; 1391 nst_pagination = true; 1392 } 1393 1394 if ( is_shop ) { // shop builder with counter per page widget 1395 let _paginationWrap = $( '.woocommerce-pagination' ); 1396 var $old_pagination = _paginationWrap.find( 'ul.page-numbers' ), 1397 $new_pagination = $res.find( '.woocommerce-pagination ul.page-numbers' ).eq( 0 ), 1398 has_pagination = false; 1399 if ( $old_pagination.length ) { 1400 if ( $new_pagination.length ) { 1401 $old_pagination.replaceWith( $new_pagination ); 1402 has_pagination = true; 1403 } else { 1404 $old_pagination.children().remove(); 1405 } 1406 } else if ( $new_pagination.length ) { 1407 _paginationWrap.append( $new_pagination ); 1408 has_pagination = true; 1409 } 1410 } 1411 1412 1413 if ( is_infinite ) { 1414 var infinitescroll_ins = $posts_wrap.data( 'infinitescroll' ); 1415 if ( has_pagination || ( is_shop && nst_pagination ) ) { 1416 var $new_posts_wrap = $res.find( is_archive ? '.archive-posts .posts-wrap' : '.posts-wrap' ); 1417 if ( $new_posts_wrap.data( 'cur_page' ) ) { 1418 $posts_wrap.data( 'cur_page', $new_posts_wrap.data( 'cur_page' ) ); 1419 $posts_wrap.data( 'max_page', $new_posts_wrap.data( 'max_page' ) ); 1420 } 1421 1422 var should_init_again = true; 1423 if ( infinitescroll_ins ) { 1424 if ( infinitescroll_ins.options.state.isDestroyed ) { 1425 $posts_wrap.removeData( 'infinitescroll' ); 1426 } else { 1427 should_init_again = false; 1428 if ( $new_posts_wrap.data( 'cur_page' ) ) { 1429 infinitescroll_ins.update( { 1430 maxPage: $new_posts_wrap.data( 'max_page' ), 1431 state: { 1432 currPage: $new_posts_wrap.data( 'cur_page' ) 1433 } 1434 } ); 1435 }
1436 if ( infinitescroll_ins.options.state.isPaused ) { 1437 infinitescroll_ins.resume(); 1438 } 1439 } 1440 } 1441 1442 if ( should_init_again ) { 1443 var ins = $posts_wrap.data( '__postsinfinite' ); 1444 if ( ins ) { 1445 ins.destroy(); 1446 } 1447 var selector_product = '.' + post_type + ', .timeline-date'; 1448 if ( is_shop ) { 1449 selector_product = '.archive-products .products'; 1450 if ( $( '.elementor-widget-wc-archive-products' ).length ) { 1451 selector_product = '.elementor-widget-wc-archive-products .products'; 1452 } 1453 } 1454 new theme.PostsInfinite( $posts_wrap, selector_product, $posts_wrap.data( 'infiniteoptions' ), post_type ); 1455 } 1456 1457 if ( is_archive ) { 1458 var page_path = $posts_wrap.siblings( '.pagination-wrap' ).find( '.next' ).attr( 'href' ); 1459 if ( page_path ) { 1460 page_path += ( -1 !== page_path.indexOf( '?' ) ? '&' : '?' ) + 'portoajax=1&load_posts_only=2'; 1461 page_path = page_path.replace( /(paged=)(\d+)|(page\/)(\d+)/, '$1$3%cur_page%' ); 1462 $posts_wrap.data( 'page_path', page_path ); 1463 } 1464 } 1465 var selector_product = '.' + post_type + ', .timeline-date'; 1466 if ( is_shop ) { 1467 selector_product = '.archive-products .products'; 1468 if ( $( '.elementor-widget-wc-archive-products' ).length ) { 1469 selector_product = '.elementor-widget-wc-archive-products .products'; 1470 } 1471 } 1472 new theme.PostsInfinite( $posts_wrap, selector_product, $posts_wrap.data( 'infiniteoptions' ), post_type ); 1473 } 1474 } 1475 1476 // in archive page 1477 if ( is_archive ) { 1478 // update widgets 1479 $( '.sidebar-content' ).each( function( index ) { 1480 var $this = $( this ), 1481 $that = $( $res.find( '.sidebar-content' ).get( index ) ); 1482 1483 $this.html( $that.html() ); 1484 1485 // in shop 1486 if ( is_shop ) { 1487 if ( typeof updateSelect2 != 'undefined' && updateSelect2 ) { 1488 // Use Select2 enhancement if possible 1489 if ( jQuery().selectWoo ) { 1490 var porto_wc_layered_nav_select = function() { 1491 $this.find( 'select.woocommerce-widget-layered-nav-dropdown' ).each( function() { 1492 $( this ).selectWoo( { 1493 placeholder: $( this ).find( 'option' ).eq( 0 ).text(), 1494 minimumResultsForSearch: 5, 1495 width: '100%', 1496 allowClear: typeof $( this ).attr( 'multiple' ) != 'undefined' && $( this ).attr( 'multiple' ) == 'multiple' ? 'false' : 'true' 1497 } ); 1498 } ); 1499 }; 1500 porto_wc_layered_nav_select(); 1501 } 1502 $( 'body' ).children( 'span.select2-container' ).remove(); 1503 } 1504 } 1505 } ); 1506 1507 // in shop 1508 if ( is_shop ) { 1509 var $script = $res.filter( 'script:contains("var woocommerce_price_slider_params")' ).first(); 1510 if ( $script && $script.length && $script.text().indexOf( '{' ) !== -1 && $script.text().indexOf( '}' ) !== -1 ) { 1511 var arrStr = $script.text().substring( $script.text().indexOf( '{' ), $script.text().indexOf( '}' ) + 1 ); 1512 window.woocommerce_price_slider_params = JSON.parse( arrStr ); 1513 } 1514 1515 // update entry title 1516 var $title = $( '.entry-title' ); 1517 if ( $title.length ) { 1518 var $newTitle = $res.find( '.entry-title' ).eq( 0 ); 1519 if ( $newTitle.length ) { 1520 $title.html( $newTitle.html() ); 1521 } 1522 } 1523 1524 // update entry description 1525 var $desc = $( '.entry-description' ); 1526 if ( $desc.length ) { 1527 var $newDesc = $res.find( '.entry-description' ).eq( 0 ); 1528 if ( $newDesc.length ) { 1529 $desc.html( $newDesc.html() ); 1530 } 1531 } 1532 1533 // top toolbar 1534 var shop_before = '.shop-loop-before', 1535 $shop_before = $( shop_before ); 1536 if ( $shop_before.length ) { 1537 if ( $res.find( shop_before ).length ) { 1538 $shop_before.each( function( index ) { 1539 var $res_shop_before = $res.find( shop_before ).eq( index ); 1540 if ( $res_shop_before.length ) { 1541 $( this ).html( $res_shop_before.html() ).show(); 1542 } 1543 } ); 1544 } else { 1545 $shop_before.empty(); 1546 } 1547 } 1548 1549 // update result count 1550 var $count = $( '.woocommerce-result-count' ); 1551 if ( $count.length ) { 1552 var $newCount = $res.find( '.woocommerce-result-count' ).eq( 0 ); 1553 if ( $newCount.length ) { 1554 $count[0].outerHTML = $newCount.length ? $newCount[0].outerHTML : ''; 1555 } 1556 } 1557 1558 // trigger ready event 1559 $( document ).trigger( 'yith_wcan_init_shortcodes' ); 1560 $( document ).trigger( 'yith-wcan-ajax-filtered' ); 1561 } 1562 1563 // update browser history (IE doesn't support it) 1564 if ( page_url && !navigator.userAgent.match( /msie/i ) ) { 1565 window.history.pushState( { 'pageTitle': ( res && res.pageTitle ) || '' }, '', page_url ); 1566 } 1567 } 1568 1569 $( document.body ).trigger( 'porto_load_posts_end', [$parent.parent()] ); 1570 }; 1571 1572 if ( typeof default_args == 'undefined' && typeof self.cache[pid] != 'undefined' && typeof self.cache[pid][cat+ _gridcookie] != 'undefined' && self.cache[pid][cat+ _gridcookie] ) { 1573 successfn( self.cache[pid][cat+ _gridcookie], true ); 1574 self.isLoading = false; 1575 $parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove(); 1576 return; 1577 } 1578 1579 var ajax_load_options = $parent.data( 'ajax_load_options' ); 1580 if ( ( $parent.hasClass( 'archive-products' ) && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'shop' ) ) || 1581 ( is_archive && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'blog' ) ) ) { // skeleton
1581screen in archive builder 1582 $posts_wrap = $parent.find( '.' + post_type + 's-container' ); 1583 if ( ajax_load_options ) { 1584 var tag_name = 'div'; 1585 if ( 'product' == post_type && 'ul' == $posts_wrap.get( 0 ).tagName.toLowerCase() ) { 1586 tag_name = 'li'; 1587 } 1588 $posts_wrap.addClass( 'skeleton-body' ).empty(); 1589 for ( var i = 0; i < Number( ajax_load_options.count || ( ajax_load_options.columns && ajax_load_options.columns * 3 ) || 12 ); i++ ) { 1590 $posts_wrap.append( '<' + tag_name + ' class="porto-tb-item post ' + post_type + ( 'product' == post_type ? ' product-col' : '' ) + '"></' + tag_name + '>' ); 1591 } 1592 } else { 1593 $posts_wrap.addClass( 'skeleton-body' ).children().empty(); 1594 } 1595 } else { 1596 if ( !$parent.children( '.porto-loading-icon' ).length ) { 1597 $parent.append( '<i class="porto-loading-icon"></i>' ); 1598 } 1599 $parent.addClass( 'porto-ajax-loading' ); 1600 } 1601 1602 var current_url = window.location.href; 1603 if ( -1 !== current_url.indexOf( '#' ) ) { 1604 current_url = current_url.split( '#' )[0]; 1605 } 1606 1607 var args, load_url = theme.ajax_url; 1608 if ( $parent.hasClass( 'archive-posts' ) ) { // archive builder 1609 args = { 1610 portoajax: true, 1611 load_posts_only: true 1612 }; 1613 if ( $parent.closest( '.porto-block' ).length ) { 1614 args['builder_id'] = $parent.closest( '.porto-block' ).data( 'id' ); 1615 } 1616 load_url = typeof page_url != 'undefined' ? page_url : current_url; 1617 } else { 1618 args = { 1619 action: 'porto_ajax_posts', 1620 nonce: js_porto_vars.porto_nonce, 1621 post_type: post_type, 1622 current_link: current_url 1623 }; 1624 if ( $parent.data( 'post_layout' ) ) { 1625 args['post_layout'] = $parent.data( 'post_layout' ); 1626 } 1627 if ( ajax_load_options ) { 1628 args['extra'] = ajax_load_options; 1629 } 1630 if ( typeof default_args != 'undefined' ) { 1631 args = $.extend( args, default_args ); 1632 } 1633 } 1634 if ( cat ) { 1635 args['category'] = cat; 1636 } 1637 1638 $.ajax( { 1639 url: load_url, 1640 type: 'post', 1641 data: args, 1642 success: successfn, 1643 complete: function() { 1644 self.isLoading = false; 1645 $posts_wrap.removeClass( 'skeleton-body' ); 1646 $parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove(); 1647 } 1648 } ); 1649 1650 } 1651 } 1652 1653 } ); 1654 1655} ).apply( this, [window.theme, jQuery] ); 1656 1657// Filter Zoom 1658( function( theme, $ ) { 1659 'use strict'; 1660 1661 theme = theme || {}; 1662 1663 $.extend( theme, { 1664 1665 FilterZoom: { 1666 1667 defaults: { 1668 elements: null 1669 }, 1670 1671 initialize: function( $elements ) { 1672 this.$elements = ( $elements || this.defaults.elements ); 1673 1674 this.build(); 1675 1676 return this; 1677 }, 1678 1679 build: function() { 1680 var self = this; 1681 1682 self.$elements.each( function() { 1683 var $this = $( this ), 1684 zoom = $this.find( '.zoom, .thumb-info-zoom' ).get( 0 ); 1685 1686 if ( !zoom ) return; 1687 1688 $this.find( '.zoom, .thumb-info-zoom' ).off( 'click' ); 1689 var links = []; 1690 var i = 0; 1691 $this.find( 'article' ).each( function() { 1692 var $that = $( this ); 1693 if ( $that.css( 'display' ) != 'none' ) { 1694 var $zoom = $that.find( '.zoom, .thumb-info-zoom' ), 1695 slide, 1696 src = $zoom.data( 'src' ), 1697 title = $zoom.data( 'title' ); 1698 1699 $zoom.data( 'index', i ); 1700 if ( Array.isArray( src ) ) { 1701 $.each( src, function( index, value ) { 1702 slide = {}; 1703 slide.src = value; 1704 slide.title = title[index]; 1705 links[i] = slide; 1706 i++; 1707 } ); 1708 } else { 1709 slide = {}; 1710 slide.src = src; 1711 slide.title = title; 1712 links[i] = slide; 1713 i++; 1714 } 1715 } 1716 } ); 1717 $this.find( 'article' ).each( function() { 1718 var $that = $( this ); 1719 if ( $that.css( 'display' ) != 'none' ) { 1720 $that.off( 'click', '.zoom, .thumb-info-zoom' ).on( 'click', '.zoom, .thumb-info-zoom', function( e ) {
1721 var $zoom = $( this ), $parent = $zoom.parents( '.thumb-info' ), offset = 0; 1722 if ( $parent.get( 0 ) ) { 1723 var $slider = $parent.find( '.porto-carousel' ); 1724 if ( $slider.get( 0 ) ) { 1725 offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2; 1726 } 1727 } 1728 e.preventDefault(); 1729 if ( $.fn.magnificPopup ) { 1730 $.magnificPopup.close(); 1731 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 1732 items: links, 1733 gallery: { 1734 enabled: true 1735 }, 1736 type: 'image' 1737 } ), $zoom.data( 'index' ) + offset ); 1738 } 1739 return false; 1740 } ); 1741 } 1742 } ); 1743 } ); 1744 1745 return self; 1746 } 1747 } 1748 1749 } ); 1750 1751} ).apply( this, [window.theme, jQuery] ); 1752 1753// Mouse Parallax 1754( function( theme, $ ) { 1755 'use strict'; 1756 1757 theme = theme || {}; 1758 1759 var instanceName = '__parallax'; 1760 1761 var Mouseparallax = function( $el, opts ) { 1762 return this.initialize( $el, opts ); 1763 }; 1764 1765 Mouseparallax.prototype = { 1766 initialize: function( $el, opts ) { 1767 this.$el = $el; 1768 1769 this 1770 .setData() 1771 .setOptions( opts ) 1772 .build(); 1773 1774 return this; 1775 }, 1776 1777 setData: function() { 1778 this.$el.data( instanceName, this ); 1779 return this; 1780 }, 1781 1782 setOptions: function( opts ) { 1783 this.options = $.extend( true, {}, { 1784 wrapper: this.$el, 1785 opts: opts 1786 } ); 1787 return this; 1788 }, 1789 1790 build: function() { 1791 if ( !$.fn.parallax ) { 1792 return this; 1793 } 1794 1795 var $el = this.options.wrapper, 1796 opts = this.options.opts 1797 1798 $el.parallax( opts ); 1799 } 1800 }; 1801 1802 //expose to scope 1803 $.extend( theme, { 1804 Mouseparallax: Mouseparallax 1805 } ); 1806 1807 // jquery plugin 1808 $.fn.themeMouseparallax = function( opts ) { 1809 var obj = this.map( function() { 1810 var $this = $( this ); 1811 1812 if ( $this.data( instanceName ) ) { 1813 return $this.data( instanceName ); 1814 } else { 1815 return new theme.Mouseparallax( $this, opts ); 1816 } 1817 } ); 1818 return obj; 1819 } 1820} ).apply( this, [window.theme, jQuery] ); 1821 1822// Read More 1823( function( theme, $ ) { 1824 1825 theme = theme || {}; 1826 1827 var instanceName = '__readmore'; 1828 1829 var PluginReadMore = function( $el, opts ) { 1830 return this.initialize( $el, opts ); 1831 }; 1832 1833 PluginReadMore.defaults = { 1834 buttonOpenLabel: 'Read More <i class="fas fa-chevron-down text-2 ms-1"></i>', 1835 buttonCloseLabel: 'Read Less <i class="fas fa-chevron-up text-2 ms-1"></i>', 1836 enableToggle: true, 1837 maxHeight: 300, 1838 overlayColor: '#43a6a3', 1839 overlayHeight: 100, 1840 startOpened: false, 1841 align: 'left' 1842 }; 1843 1844 PluginReadMore.prototype = { 1845 initialize: function( $el, opts ) { 1846 var self = this; 1847 1848 this.$el = $el; 1849 1850 this 1851 .setData() 1852 .setOptions( opts ) 1853 .build() 1854 .events() 1855 .resize(); 1856 1857 if ( self.options.startOpened ) { 1858 self.options.wrapper.find( '.readmore-button-wrapper > button' ).trigger( 'click' ); 1859 } 1860 1861 return this; 1862 }, 1863 1864 setData: function() { 1865 this.$el.data( instanceName, this ); 1866 1867 return this; 1868 }, 1869 1870 setOptions: function( opts ) { 1871 this.options = $.extend( true, {}, PluginReadMore.defaults, opts, { 1872 wrapper: this.$el 1873 } ); 1874 1875 return this; 1876 }, 1877 1878 build: function() { 1879 var self = this; 1880 1881 self.options.wrapper.addClass( 'position-relative' ); 1882 1883 // Overlay 1884 self.options.wrapper.append( '<div class="readmore-overlay"></div>' ); 1885 1886 // Check if is Safari 1887 var backgroundCssValue = 'linear-gradient(180deg, rgba(2, 0, 36, 0) 0%, ' + self.options.overlayColor + ' 100%)'; 1888 if ( $( 'html' ).hasClass( 'safari' ) ) { 1889 backgroundCssValue = '-webkit-linear-gradient(top, rgba(2, 0, 36, 0) 0%, ' + self.options.overlayColor + ' 100%)' 1890 } 1891 1892 self.options.wrapper.find( '.readmore-overlay' ).css( { 1893 background: backgroundCssValue, 1894 position: 'absolute', 1895 bottom: 0, 1896 left: 0, 1897 width: '100%', 1898 height: self.options.overlayHeight, 1899 'z-index': 1 1900 } ); 1901 1902 // Read More Button 1903 self.options.wrapper.find( '.readmore-button-wrapper' ).removeClass( 'd-none' ).css( { 1904 position: 'absolute', 1905 bottom: 0, 1906 left: 0, 1907 width: '100%', 1908 'z-index': 2 1909 } ); 1910 1911 // Button Label 1912 self.options.wrapper.find( '.readmore-button-wrapper > button' ).html( self.options.buttonOpenLabel ); 1913 1914 self.options.wrapper.css( { 1915 'height': self.options.maxHeight, 1916 'overflow-y': 'hidden' 1917 } ); 1918 1919 // Alignment 1920 switch ( self.options.align ) { 1921 case 'center': 1922 self.options.wrapper.find( '.readmore-button-wrapper' ).addClass( 'text-center' ); 1923 break; 1924 1925 case 'right': 1926 self.options.wrapper.find( '.readmore-button-wrapper' ).addClass( 'text-end' ); 1927 break; 1928 1929 case 'left': 1930 default: 1931 self.options.wrapper.find( '.readmore-button-wrapper' ).addClass( 'text-start' ); 1932 break; 1933 } 1934 1935 return this; 1936 1937 }, 1938 1939 events: function() { 1940 var self = this; 1941 1942 // Read More 1943 self.readMore = function() { 1944 self.options.wrapper.find( '.readmore-button-wrapper > button:not(.readless)' ).on( 'click', function( e ) { 1945 e.preventDefault(); 1946 self.options.wrapper.addClass( 'opened' ); 1947 1948 var $this = $( this ); 1949 1950 setTimeout( function() { 1951 self.options.wrapper.animate( { 1952 'height': self.options.wrapper[0].scrollHeight 1953 }, function() { 1954 if ( !self.options.enableToggle ) { 1955 $this.fadeOut(); 1956 } 1957
1958 $this.html( self.options.buttonCloseLabel ).addClass( 'readless' ).off( 'click' ); 1959 1960 self.readLess(); 1961 1962 self.options.wrapper.find( '.readmore-overlay' ).fadeOut(); 1963 self.options.wrapper.css( { 1964 'max-height': 'none', 1965 'overflow': 'visible' 1966 } ); 1967 1968 self.options.wrapper.find( '.readmore-button-wrapper' ).animate( { 1969 bottom: -20 1970 } ); 1971 } ); 1972 }, 200 ); 1973 } ); 1974 } 1975 1976 // Read Less 1977 self.readLess = function() { 1978 self.options.wrapper.find( '.readmore-button-wrapper > button.readless' ).on( 'click', function( e ) { 1979 e.preventDefault(); 1980 self.options.wrapper.removeClass( 'opened' ); 1981 1982 var $this = $( this ); 1983 1984 // Button 1985 self.options.wrapper.find( '.readmore-button-wrapper' ).animate( { 1986 bottom: 0 1987 } ); 1988 1989 // Overlay 1990 self.options.wrapper.find( '.readmore-overlay' ).fadeIn(); 1991 1992 setTimeout( function() { 1993 self.options.wrapper.height( self.options.wrapper[0].scrollHeight ).animate( { 1994 'height': self.options.maxHeight 1995 }, function() { 1996 $this.html( self.options.buttonOpenLabel ).removeClass( 'readless' ).off( 'click' ); 1997 1998 self.readMore(); 1999 2000 self.options.wrapper.css( { 2001 'overflow': 'hidden' 2002 } ); 2003 } ); 2004 }, 200 ); 2005 } ); 2006 } 2007 2008 // First Load 2009 self.readMore(); 2010 2011 return this; 2012 }, 2013 2014 resize: function() { 2015 var self = this; 2016 window.addEventListener( 'resize', function() { 2017 self.options.wrapper.hasClass( 'opened' ) ? self.options.wrapper.css( { 'height': 'auto' } ) : self.options.wrapper.css( { 'height': self.options.maxHeight } ); 2018 } ) 2019 } 2020 }; 2021 2022 // expose to scope 2023 $.extend( theme, { 2024 PluginReadMore: PluginReadMore 2025 } ); 2026 2027 // jquery plugin 2028 $.fn.themePluginReadMore = function( opts ) { 2029 return this.map( function() { 2030 var $this = $( this ); 2031 2032 if ( $this.data( instanceName ) ) { 2033 return $this.data( instanceName ); 2034 } else { 2035 return new PluginReadMore( $this, $this.data( 'plugin-options' ) ); 2036 } 2037 2038 } ); 2039 } 2040 2041} ).apply( this, [window.theme, jQuery] ); 2042 2043// Mouse Hover Split 2044( function( theme, $ ) { 2045 2046 theme = theme || {}; 2047 2048 var instanceName = '__mousehoversplit'; 2049 2050 var PluginHoverSplit = function( $el ) { 2051 return this.initialize( $el ); 2052 } 2053 2054 PluginHoverSplit.prototype = { 2055 initialize: function( $el ) { 2056 if ( $el.data( instanceName ) ) { 2057 return this; 2058 } 2059 this.$el = $el.addClass( 'slide-wrapper' ); 2060 2061 this 2062 .setData() 2063 .event(); 2064 2065 return this; 2066 }, 2067 2068 setData: function() { 2069 this.$el.data( instanceName, this ); 2070 this.$el.addClass( 'initialized' ); 2071 var $columns = this.$el.find( '>.split-slide' ); 2072 for ( var index = 0; index < $columns.length; index++ ) { 2073 var column = $columns[index]; 2074 if ( index == 0 ) { 2075 column.classList.add( 'slide-left' ); 2076 this.left = column; 2077 } else if ( index == 1 ) { 2078 column.classList.add( 'slide-right' ); 2079 break; 2080 } 2081 } 2082 2083 return this; 2084 }, 2085 2086 event: function() { 2087 // Refresh 2088 this.refresh(); 2089 this.refreshFunc = this.refresh.bind( this ); 2090 $( window ).on( 'resize', this.refreshFunc ); 2091 2092 //Hover 2093 this.handleMoveFunc = this.handleMove.bind( this ); 2094 $( document.body ).on( 'mousemove', this.handleMoveFunc ); 2095 }, 2096 handleMove: function( e ) { 2097 if ( e.clientX < this.$el.offset().left ) { 2098 this.left.style.width = '0'; 2099 } else { 2100 this.left.style.width = `calc( ${ ( e.clientX - this.$el.offset().left ) / ( this.$el.innerWidth() ) * 100 }% - 3px ) `; 2101 } 2102 }, 2103 refresh: function( e ) { 2104 if ( e && e.type == 'resize' ) { 2105 this.$el.css( 'min-height', $( this.left ).height() ); 2106 } 2107 this.$el.find( '>.split-slide>*' ).css( 'width', this.$el.innerWidth() ); 2108 }, 2109 clearData: function() { 2110 // Remove class and instance 2111 this.$el.removeClass( 'slide-wrapper' ).removeData( instanceName ).css( 'min-height', '' ); 2112 this.$el.find( '>*' ).removeClass( 'slide-left slide-right' ).css( 'width', '' ); 2113 2114 // Clear Event 2115 $( window ).off( 'resize', this.refreshFunc ); 2116 $( document.body ).off( 'mousemove', this.handleMoveFunc ); 2117 } 2118 } 2119 2120 // expose to scope 2121 $.extend( theme, { 2122 PluginHoverSplit: PluginHoverSplit 2123 } ); 2124 2125 $.fn.themePluginHoverSplit = function() { 2126 return this.map( function() { 2127 var $this = $( this ), 2128 $splitColumns = $this.find( '>.split-slide' ); 2129 if ( $splitColumns.length >= 2 ) { 2130 if ( $this.data( instanceName ) ) { 2131 return $this.data( instanceName ); 2132 } else { 2133 return new PluginHoverSplit( $this ); 2134 } 2135 } 2136 } ); 2137 } 2138} ).apply( this, [window.theme, jQuery] ); 2139 2140// Horizontal Scroller 2141( function( theme, $ ) { 2142 theme = theme || {}; 2143 2144 var instanceName = '__horizontalscroller'; 2145 2146 var PluginHScroller = function( $el, opts ) { 2147 return this.initialize( $el, opts ); 2148 } 2149 2150 PluginHScroller.defaults = { 2151 lg: 3, 2152 md: 1, 2153 init_refresh: false, 2154 }; 2155 2156 PluginHScroller.prototype = { 2157 initialize: function( $el, opts ) { 2158 if ( $el.data( instanceName ) ) { 2159 return this; 2160 } 2161 this.$el = $el; 2162 2163 this 2164 .setData( opts ) 2165 .build() 2166 .event(); 2167 2168 return this; 2169 }, 2170 setData: function( opts ) { 2171 this.$el.data( instanceName, this ); 2172 this.options = $.extend( true, {}, PluginHScroller.defaults, opts ); 2173 this.$hScroller = this.$el.find( '.horizontal-scroller' ); 2174 this.$hScrollerItems = this.$hScroller.find( '.horizontal-scroller-items' ); 2175 this.$hScrollerItems.find( '>*' ).addClass( 'horizontal-scroller-item' ); 2176 return this; 2177 }, 2178 build: function() { 2179 // Copy Original HTML to clone on Resize.
2180 this.originalScrollHTML = this.$hScroller.html(); 2181 this.scrollerInitialized = false; 2182 2183 return this; 2184 }, 2185 // Generate Scroller 2186 generateScroller: function() { 2187 var items = gsap.utils.toArray( this.$hScrollerItems.find( '.horizontal-scroller-item' ) ); 2188 gsap.to( items, { 2189 xPercent: -100 * ( items.length - ( $( window ).width() > 991 ? this.options.lg : this.options.md ) ), 2190 ease: 'none', 2191 scrollTrigger: { 2192 trigger: '.horizontal-scroller', 2193 pin: true, 2194 scrub: 1, 2195 snap: 1 / ( items.length - 1 ), 2196 end: () => '+=' + this.$hScrollerItems.width(), 2197 el: this.$el, 2198 } 2199 } ); 2200 2201 this.scrollerInitialized = true; 2202 }, 2203 event: function() { 2204 if ( this.options.init_refresh ) { 2205 this.generateScroller(); 2206 } 2207 // Scroll Event to initialize when visible 2208 this.scrollFunc = this.scroll.bind( this ); 2209 $( window ).on( 'scroll', this.scrollFunc ); 2210 2211 // Resize Event removing and restarting 2212 this.afterResizeFunc = this.afterResize.bind( this ); 2213 $( window ).on( 'afterResize', this.afterResizeFunc ); 2214 }, 2215 scroll: function() { 2216 if ( !this.scrollerInitialized ) { 2217 2218 var position = this.$el[0].getBoundingClientRect(); 2219 2220 if ( position.top >= 0 && position.top < window.innerHeight && position.bottom >= 0 ) { 2221 this.generateScroller(); 2222 } 2223 } 2224 }, 2225 afterResize: function() { 2226 2227 this.scrollerInitialized = false; 2228 var Alltrigger = ScrollTrigger.getAll(); 2229 2230 for ( var i = 0; i < Alltrigger.length; i++ ) { 2231 if ( Alltrigger[i]['vars'] && typeof Alltrigger[i]['vars']['el'] != 'undefined' && Alltrigger[i]['vars']['el'] == this.$el ) { 2232 Alltrigger[i].kill( true ); 2233 this.$el.empty().html( '<div class="horizontal-scroller">' + this.originalScrollHTML + '</div>' ); 2234 this.$hScrollerItems = this.$el.find( '.horizontal-scroller-items' ); 2235 break; 2236 } 2237 } 2238 }, 2239 clearData: function() { 2240 this.$el.removeData( instanceName ); 2241 $( window ).off( 'scroll', this.scrollFunc ); 2242 $( window ).off( 'afterResize', this.afterResizeFunc ); 2243 } 2244 }; 2245 // expose to scope 2246 $.extend( theme, { 2247 PluginHScroller: PluginHScroller 2248 } ); 2249 $.fn.themePluginHScroller = function( opt = false ) { 2250 if ( typeof gsap !== 'undefined' && typeof ScrollTrigger !== 'undefined' ) { 2251 return this.map( function() { 2252 var $this = $( this ); 2253 if ( $this.data( instanceName ) ) { 2254 return $this.data( instanceName ); 2255 } else { 2256 if ( $this.find( '.horizontal-scroller-items>*' ).length ) { 2257 options = $this.data( 'plugin-hscroll' ); 2258 if ( opt ) { 2259 options['init_refresh'] = true; 2260 } 2261 return new PluginHScroller( $this, options ); 2262 } 2263 } 2264 } ); 2265 } else { 2266 return false; 2267 } 2268 } 2269} ).apply( this, [window.theme, jQuery] ); 2270 2271// Text Hover Image Floating - Ultimate Heading, Custom Heading for wpb 2272( function( theme, $ ) { 2273 theme = theme || {}; 2274 2275 var instanceName = '__textelfloating'; 2276 2277 var PluginTElFloaing = function( $el, opts ) { 2278 return this.initialize( $el, opts ); 2279 }; 2280 2281 PluginTElFloaing.defaults = { 2282 offset: 0, 2283 }; 2284 2285 PluginTElFloaing.prototype = { 2286 initialize: function( $el, opts ) { 2287 if ( $el.data( instanceName ) ) { 2288 return this; 2289 } 2290 this.$el = $el; 2291 2292 this 2293 .setData( opts ) 2294 .event(); 2295 2296 return this; 2297 }, 2298 setData: function( opts ) { 2299 this.options = $.extend( true, {}, PluginTElFloaing.defaults, opts ); 2300 this.$el.data( instanceName, this ); 2301 return this; 2302 }, 2303 event: function() { 2304 this.mouseEnterFunc = this.mouseEnter.bind( this ); 2305 this.$el.on( 'mouseenter', this.mouseEnterFunc ); 2306 this.mouseOutFunc = this.mouseOut.bind( this ); 2307 this.$el.on( 'mouseleave', this.mouseOutFunc ); 2308 }, 2309 mouseEnter: function( e ) { 2310 2311 $( '.thumb-info-floating-element-clone' ).remove(); 2312 var $thumbFloatingEl = $( '.thumb-info-floating-element', this.$el ); 2313 if ( $thumbFloatingEl.length ) { 2314 this.$elClone = $thumbFloatingEl.clone().addClass( 'thumb-info-floating-element-clone' ).removeClass( 'd-none' ).appendTo( document.body ); 2315 } else if ( this.$el.hasClass( 'tb-hover-content' ) && this.$el.children().length > 0 ) { 2316 if ( this.$el.hasClass( 'with-link' ) ) { 2317 $thumbFloatingEl = this.$el.children( ':nth-child(2)' ); 2318 } else { 2319 $thumbFloatingEl = this.$el.children( ':first' ); 2320 } 2321 this.$elClone = $thumbFloatingEl.clone().addClass( 'thumb-tb-floating-el' ).appendTo( document.body ).wrap( '<div class="thumb-info-floating-element-clone page-wrapper"></div>' ); 2322 } else { 2323 return; 2324 } 2325 2326 // Image LazyLoad
2327 $imgs = $( '.thumb-info-floating-element-clone' ).find( 'img.porto-lazyload' ); 2328 $imgs.each( function( index, img ) { 2329 var $img = $( img ); 2330 if ( $img.length && $img.data( 'oi' ) ) { 2331 $img.attr( 'src', $img.data( 'oi' ) ).addClass( 'lazy-load-loaded' ); 2332 } 2333 } ); 2334 2335 $( '.thumb-info-floating-element-clone' ).css( { 2336 left: e.clientX + parseInt( this.options.offset ), 2337 top: e.clientY + parseInt( this.options.offset ) 2338 } ).fadeIn( 300 ); 2339 2340 gsap.to( '.thumb-info-floating-element-clone', 1, { 2341 css: { 2342 scaleX: 1, 2343 scaleY: 1 2344 } 2345 } ); 2346 2347 this.mouseMoveFunc = this.mouseMove.bind( this ); 2348 $( document.body ).on( 'mousemove', this.mouseMoveFunc ); 2349 }, 2350 mouseMove: function( e ) { 2351 if ( this.$elClone.length && this.$elClone.closest( 'html' ).length ) { 2352 gsap.to( '.thumb-info-floating-element-clone', 0.5, { 2353 css: { 2354 left: e.clientX + parseInt( this.options.offset ), 2355 top: e.clientY + parseInt( this.options.offset ) 2356 } 2357 } ); 2358 } 2359 }, 2360 mouseOut: function( e ) { 2361 if ( this.$elClone.length && this.$elClone.closest( 'html' ).length ) { 2362 gsap.to( '.thumb-info-floating-element-clone', 0.5, { 2363 css: { 2364 scaleX: 0.5, 2365 scaleY: 0.5, 2366 opacity: 0 2367 } 2368 } ); 2369 } 2370 }, 2371 clearData: function( e ) { 2372 this.$elClone.remove(); 2373 this.$el.off( 'mouseenter', this.mouseEnterFunc ); 2374 this.$el.off( 'mouseout', this.mouseOutFunc ); 2375 $( document.body ).off( 'mousemove', this.mouseMoveFunc ); 2376 } 2377 } 2378 2379 $.extend( theme, { 2380 PluginTElFloaing: PluginTElFloaing 2381 } ); 2382 $.fn.themePluginTIFloating = function() { 2383 if ( typeof gsap !== 'undefined' ) { 2384 return this.map( function() { 2385 var $this = $( this ); 2386 if ( $this.data( instanceName ) ) { 2387 return $this.data( instanceName ); 2388 } else { 2389 return new PluginTElFloaing( $this, $this.data( 'plugin-tfloating' ) ); 2390 } 2391 } ); 2392 } else { 2393 return false; 2394 } 2395 } 2396} ).apply( this, [window.theme, jQuery] ); 2397 2398/* initialize */ 2399( function( theme, $ ) { 2400 theme.initAsync = function( $wrap, wrapObj ) { 2401 // Animate 2402 if ( $.fn.themeAnimate && typeof wrapObj != 'undefined' ) { 2403 2404 $( function() { 2405 var svgAnimates = wrapObj.querySelectorAll( 'svg [data-appear-animation]' ); 2406 if ( svgAnimates.length ) { 2407 $( svgAnimates ).closest( 'svg' ).attr( 'data-appear-animation-svg', '1' ); 2408 } 2409 var $animates = wrapObj.querySelectorAll( '[data-plugin-animate], [data-appear-animation], [data-appear-animation-svg]' ); 2410 if ( $animates.length ) { 2411 var animateResize = function() { 2412 if ( window.innerWidth < 768 ) { 2413 window.removeEventListener( 'resize', animateResize );
2414 $animates.forEach( function( o ) { 2415 o.classList.add( 'appear-animation-visible' ); 2416 } ); 2417 } 2418 }; 2419 if ( theme.animation_support ) { 2420 window.addEventListener( 'resize', animateResize ); 2421 theme.dynIntObsInit( $animates, 'themeAnimate', theme.Animate.defaults ); 2422 } else { 2423 $animates.forEach( function( o ) { 2424 o.classList.add( 'appear-animation-visible' ); 2425 } ); 2426 } 2427 } 2428 } ); 2429 } 2430 2431 // Animated Letters 2432 if ( $.fn.themePluginAnimatedLetters ) { 2433 if ( $( '[data-plugin-animated-letters]' ).length || $( '.animated-letters' ).length ) { 2434 theme.intObs( '[data-plugin-animated-letters]:not(.manual), .animated-letters', 'themePluginAnimatedLetters' ); 2435 } 2436 if ( $( '[data-plugin-animated-words]' ).length || $( '.animated-words' ).length ) { 2437 theme.intObs( '[data-plugin-animated-words]:not(.manual), .animated-words', 'themePluginAnimatedLetters' ); 2438 } 2439 } 2440 2441 // Carousel 2442 if ( $.fn.themeCarousel ) { 2443 2444 $( function() { 2445 2446 var portoImgNavMiddle = function ( $el ) { 2447 var $images = $el.find( '.owl-item img' ), 2448 height = 0; 2449 for ( var i = 0; i < $images.length; i++) { 2450 var imgHeight = $images.eq(i).height(); 2451 if ( height < imgHeight ) { 2452 height = imgHeight; 2453 } 2454 } 2455 if ( $el.hasClass( 'products-slider' ) ) { 2456 $el.children( '.owl-nav' ).css( 'top', ( 5 + height / 2 ) + 'px' ); 2457 } else { 2458 $el.children( '.owl-nav' ).css( 'top', height / 2 + 'px' ); 2459 } 2460 }; 2461 // Carousel Lazyload images 2462 var portoCarouselInit = function( e ) { 2463 var $this = $( e.currentTarget ); 2464 2465 $this.find( '[data-appear-animation]:not(.appear-animation)' ).addClass( 'appear-animation' ); 2466 if ( $this.find( '.owl-item.cloned' ).length ) { 2467 // compatibility with W3 Total Cache 2468 var $not_loaded = $this.find( 'img.lazy:not(.loaded)' ); 2469 if ( $not_loaded.length ) { 2470 if (typeof window.w3tc_lazyload == 'object') { 2471 window.w3tc_lazyload.update(); 2472 } else if (theme.w3tcLazyLoadInstance) { 2473 theme.w3tcLazyLoadInstance.update(); 2474 } 2475 } 2476 2477 $this.find( '.porto-lazyload:not(.lazy-load-loaded)' ).themePluginLazyLoad( { effect: 'fadeIn', effect_speed: 400 } ); 2478 var $animates = e.currentTarget.querySelectorAll( '.appear-animation' ); 2479 if ( $animates.length ) { 2480 if ( theme.animation_support ) { 2481 theme.dynIntObsInit( $animates, 'themeAnimate', theme.Animate.defaults ); 2482 } else {
2483 $animates.forEach( function( o ) { 2484 o.classList.add( 'appear-animation-visible' ); 2485 } ); 2486 } 2487 } 2488 if ( $.fn.themePluginAnimatedLetters && ( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ).length ) ) { 2489 theme.dynIntObsInit( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ), 'themePluginAnimatedLetters' ); 2490 } 2491 } 2492 2493 setTimeout( function() { 2494 var $hiddenItems = $this.find( '.owl-item:not(.active)' ); 2495 if ( theme.animation_support ) { 2496 $hiddenItems.find( '.appear-animation' ).removeClass( 'appear-animation-visible' ); 2497 $hiddenItems.find( '.appear-animation' ).each( function() { 2498 var $el = $( this ), 2499 delay = Math.abs( $el.data( 'appear-animation-delay' ) ? $el.data( 'appear-animation-delay' ) : 0 ); 2500 if ( delay > 1 ) { 2501 this.style.animationDelay = delay + 'ms'; 2502 } 2503 2504 var duration = Math.abs( $el.data( 'appear-animation-duration' ) ? $el.data( 'appear-animation-duration' ) : 1000 ); 2505 if ( 1000 != duration ) { 2506 this.style.animationDuration = duration + 'ms'; 2507 } 2508 } ); 2509 } 2510 if ( window.innerWidth >= 1200 ) { 2511 $hiddenItems.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' ); 2512 } 2513 // Position the navigation in the middle of the image 2514 if ( $this.hasClass( 'nav-center-images-only' ) ) { 2515 portoImgNavMiddle( $this ); 2516 } 2517 }, 300 ); 2518 }; 2519 var portoCarouselTranslated = function( e ) { 2520 var $this = $( e.currentTarget ); 2521 /*if ( window.innerWidth > 767 ) { 2522 if ( $this.find( '.owl-item.cloned' ).length && $this.find( '.appear-animation:not(.appear-animation-visible)' ).length ) { 2523 $( document.body ).trigger( 'appear_refresh' ); 2524 } 2525 }*/ 2526 2527 var $active = $this.find( '.owl-item.active' ); 2528 if ( $active.hasClass( 'translating' ) ) { 2529 $active.removeClass( 'translating' ); 2530 return; 2531 } 2532 $this.find( '.owl-item.translating' ).removeClass( 'translating' ); 2533 // Animated Letters 2534 $this.find( '[data-plugin-animated-letters]' ).removeClass( 'invisible' ); 2535 $this.find( '.owl-item.active [data-plugin-animated-letters]' ).trigger( 'animated.letters.initialize' ); 2536 2537 if ( window.innerWidth > 767 ) { 2538 // WPBakery 2539 $this.find( '.appear-animation' ).removeClass( 'appear-animation-visible' ); 2540 $active.find( '.appear-animation' ).each( function() { 2541 var $animation_item = $( this ), 2542 anim_name = $animation_item.data( 'appear-animation' ); 2543 $animation_item.addClass( anim_name + ' appear-animation-visible' ); 2544 } ); 2545 } 2546 2547 // sticky sidebar 2548 if ( window.innerWidth > 991 ) { 2549 if ( $this.closest( '[data-plugin-sticky]' ).length ) { 2550 theme.refreshStickySidebar( false, $this.closest( '[data-plugin-sticky]' ) ); 2551 } 2552 } 2553 2554 // Elementor 2555 $active.find( '.slide-animate' ).each( function() { 2556 var $animation_item = $( this ), 2557 settings = $animation_item.data( 'settings' ); 2558 if ( settings && ( settings._animation || settings.animation ) ) { 2559 var animation = settings._animation || settings.animation, 2560 delay = settings._animation_delay || settings.animation_delay || 0; 2561 theme.requestTimeout( function() { 2562 $animation_item.removeClass( 'elementor-invisible' ).addClass( 'animated ' + animation ); 2563 }, delay ); 2564 } 2565 } ); 2566 2567 // Visual Composer 2568 if ( window.innerWidth >= 1200 ) { 2569 $this.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' ).removeAttr( 'data-vcv-o-animated-fully' ); 2570 $active.find( '[data-vce-animate]' ).each( function() { 2571 var $animation_item = $( this ); 2572 if ( $animation_item.data( 'porto-origin-anim' ) ) { 2573 var anim_name = $animation_item.data( 'porto-origin-anim' ); 2574 $animation_item.attr( 'data-vce-animate', anim_name ).attr( 'data-vcv-o-animated', true ); 2575 var duration = parseFloat( window.getComputedStyle( this )['animationDuration'] ) * 1000,
2576 delay = parseFloat( window.getComputedStyle( this )['animationDelay'] ) * 1000; 2577 window.setTimeout( function() { 2578 $animation_item.attr( 'data-vcv-o-animated-fully', true ); 2579 }, delay + duration + 5 ); 2580 } 2581 } ); 2582 } 2583 }; 2584 var portoCarouselTranslateVC = function( e ) { 2585 var $this = $( e.currentTarget ); 2586 $this.find( '.owl-item.active' ).addClass( 'translating' ); 2587 2588 if ( window.innerWidth >= 1200 ) { 2589 $this.find( '[data-vce-animate]' ).each( function() { 2590 var $animation_item = $( this ); 2591 $animation_item.data( 'porto-origin-anim', $animation_item.data( 'vce-animate' ) ).attr( 'data-vce-animate', '' ); 2592 } ); 2593 } 2594 }; 2595 var portoCarouselTranslateElementor = function( e ) { 2596 var $this = $( e.currentTarget ); 2597 $this.find( '.owl-item.active' ).addClass( 'translating' ); 2598 $this.find( '.owl-item:not(.active) .slide-animate' ).addClass( 'elementor-invisible' ); 2599 $this.find( '.slide-animate' ).each( function() { 2600 var $animation_item = $( this ), 2601 settings = $animation_item.data( 'settings' ); 2602 if ( settings._animation || settings.animation ) { 2603 $animation_item.removeClass( settings._animation || settings.animation ); 2604 } 2605 } ); 2606 }; 2607 var portoCarouselTranslateWPB = function( e ) { 2608 if ( window.innerWidth > 767 ) { 2609 var $this = $( e.currentTarget ); 2610 $this.find( '.owl-item.active' ).addClass( 'translating' ); 2611 $this.find( '.appear-animation' ).each( function() { 2612 var $animation_item = $( this ); 2613 $animation_item.removeClass( $animation_item.data( 'appear-animation' ) ); 2614 } ); 2615 } 2616 }; 2617 2618 var carouselItems = $wrap.find( '.owl-carousel:not(.manual)' ); 2619 carouselItems.on( 'initialized.owl.carousel refreshed.owl.carousel', portoCarouselInit ).on( 'translated.owl.carousel', portoCarouselTranslated ); 2620 carouselItems.on( 'translate.owl.carousel', function() { 2621 // Hide elements inside carousel 2622 $( this ).find( '[data-plugin-animated-letters]' ).addClass( 'invisible' ); 2623 // Animated Letters 2624 $( this ).find( '[data-plugin-animated-letters]' ).trigger( 'animated.letters.destroy' ); 2625 } ); 2626 carouselItems.on( 'resized.owl.carousel', function () { 2627 var $this = $( this ); 2628 // Position the navigation in the middle of the image 2629 if ( $this.hasClass( 'nav-center-images-only' ) ) { 2630 portoImgNavMiddle( $this ); 2631 } 2632 } ) 2633 carouselItems.filter( function() { 2634 if ( $( this ).find( '[data-vce-animate]' ).length ) { 2635 return true; 2636 } 2637 return false; 2638 } ).on( 'translate.owl.carousel', portoCarouselTranslateVC ); 2639 carouselItems.filter( function() { 2640 var $anim_obj = $( this ).find( '.elementor-invisible' ); 2641 if ( $anim_obj.length ) { 2642 $anim_obj.addClass( 'slide-animate' ); 2643 return true; 2644 } 2645 return false; 2646 } ).on( 'translate.owl.carousel', portoCarouselTranslateElementor ); 2647 carouselItems.filter( function() { 2648 if ( $( this ).find( '.appear-animation, [data-appear-animation]' ).length ) { 2649 return true; 2650 } 2651 return false; 2652 } ).on( 'translate.owl.carousel', portoCarouselTranslateWPB ); 2653 2654 $wrap.find( '[data-plugin-carousel]:not(.manual), .porto-carousel:not(.manual)' ).each( function() { 2655 var $this = $( this ), 2656 opts; 2657 if ( $this.closest( '.tab-pane' ).length && ! $this.closest( '.tab-pane' ).hasClass( 'active' ) ) { 2658 return; 2659 } 2660 if ( $this.closest( '.e-n-tabs-content > .e-con' ).length && ! $this.closest( '.e-n-tabs-content > .e-con' ).hasClass( 'e-active' ) ) { 2661 return; 2662 } 2663 if ( $this.closest( '.sidebar-menu:not(.side-menu-accordion) .menu-block' ).length ) { 2664 return; 2665 } 2666 var pluginOptions = $this.data( 'plugin-options' ); 2667 if ( pluginOptions ) 2668 opts = pluginOptions; 2669 2670 setTimeout( function() { 2671 $this.themeCarousel( opts ); 2672 }, 0 ); 2673 } ); 2674 } ); 2675 2676 } 2677 2678 // Thumb Gallery
2679 $wrap.find( '.thumb-gallery-thumbs, .thumbnail-gallery' ).each( function() { 2680 var $thumbs = $( this ), 2681 $detail = $thumbs.parent().find( '.thumb-gallery-detail' ), 2682 flag = false, 2683 duration = 300; 2684 2685 if ( $thumbs.data( 'initThumbs' ) ) 2686 return; 2687 2688 $detail.on( 'changed.owl.carousel', function( e ) { 2689 if ( !flag ) { 2690 flag = true; 2691 var len = $detail.find( '.owl-item' ).length, 2692 cloned = $detail.find( '.cloned' ).length; 2693 if ( len ) { 2694 $thumbs.find( '.owl-item.selected' ).removeClass( 'selected' ); 2695 $thumbs.find( '.owl-item' ).eq( ( e.item.index - cloned / 2 ) % len ).addClass( 'selected' ); 2696 $thumbs.trigger( 'to.owl.carousel', [( e.item.index - cloned / 2 - 1 ) % len, duration, true] ); 2697 } 2698 flag = false; 2699 } 2700 } ); 2701 2702 $thumbs.on( 'changed.owl.carousel', function( e ) { 2703 if ( !flag ) { 2704 flag = true; 2705 var len = $thumbs.find( '.owl-item' ).length, 2706 cloned = $thumbs.find( '.cloned' ).length; 2707 if ( len ) { 2708 $thumbs.find( '.owl-item.selected' ).removeClass( 'selected' ); 2709 $thumbs.find( '.owl-item' ).eq( e.item.index ).addClass( 'selected' ); 2710 $detail.trigger( 'to.owl.carousel', [( e.item.index - cloned / 2 ) % len, duration, true] ); 2711 } 2712 flag = false; 2713 } 2714 } ).on( 'click', '.owl-item', function() { 2715 if ( !flag ) { 2716 flag = true; 2717 var len = $thumbs.find( '.owl-item' ).length, 2718 cloned = $thumbs.find( '.cloned' ).length; 2719 if ( len ) { 2720 $thumbs.find( '.owl-item.selected' ).removeClass( 'selected' ); 2721 $(this).addClass( 'selected' ); 2722 $detail.trigger( 'to.owl.carousel', [( $( this ).index() - cloned / 2 ) % len, duration, true] ); 2723 } 2724 flag = false; 2725 } 2726 } ).data( 'initThumbs', true ); 2727 } ); 2728 2729 // Fixed video 2730 $wrap.find( '.video-fixed' ).each( function() { 2731 var $this = $( this ), 2732 $video = $this.find( 'video, iframe' ); 2733 2734 if ( $video.length ) { 2735 window.addEventListener( 'scroll', function() { 2736 var offset = $( window ).scrollTop() - $this.position().top + theme.adminBarHeight(); 2737 $video.css( "cssText", "top: " + offset + "px !important;" ); 2738 }, { passive: true } ); 2739 } 2740 } ); 2741 2742 setTimeout( function() { 2743 // Search 2744 if ( typeof theme.Search !== 'undefined' ) { 2745 theme.Search.initialize(); 2746 } 2747 }, 0 ); 2748 2749 }; 2750 2751 $( document.body ).trigger( 'porto_async_init' ); 2752} ).apply( this, [window.theme, jQuery] ); 2753 2754jQuery( document ).ready( function( $ ) { 2755 'use strict'; 2756 2757 // Visual Composer Image Zoom 2758 if ( $.fn.themeVcImageZoom ) { 2759 2760 $( function() { 2761 var $galleryParent = null; 2762 $( '.porto-vc-zoom:not(.manual)' ).each( function() { 2763 var $this = $( this ), 2764 opts, 2765 gallery = $this.attr( 'data-gallery' ); 2766 2767 var pluginOptions = $this.data( 'plugin-options' ); 2768 if ( pluginOptions ) 2769 opts = pluginOptions; 2770 2771 if ( typeof opts == "undefined" ) { 2772 opts = {}; 2773 } 2774 opts.container = $this.parent(); 2775 2776 if ( gallery == 'true' ) { 2777 var container = 'vc_row'; 2778 2779 if ( $this.attr( 'data-container' ) ) 2780 container = $this.attr( 'data-container' ); 2781 2782 var $parent = $( $this.closest( '.' + container ).get( 0 ) ); 2783 if ( $parent.length > 0 && $galleryParent != null && $galleryParent.is( $parent ) ) { 2784 return; 2785 } else if ( $parent.length > 0 ) { 2786 $galleryParent = $parent; 2787 } 2788 if ( $galleryParent != null && $galleryParent.length > 0 ) { 2789 opts.container = $galleryParent; 2790 } 2791 } 2792 2793 $this.themeVcImageZoom( opts ); 2794 } ); 2795 } ); 2796 } 2797 2798 function porto_modal_open( $this ) { 2799 var trigger = $this.data( 'trigger-id' ), 2800 overlayClass = $this.data( 'overlay-class' ), 2801 extraClass = $this.data( 'extra-class' ) ? $this.data( 'extra-class' ) : '', 2802 type = $this.data( 'type' ); 2803 if ( typeof trigger != 'undefined'/* && $('#' + escape(trigger)).length > 0*/ ) { 2804 if ( typeof type == 'undefined' ) { 2805 type = 'inline'; 2806 } 2807 if ( type == 'inline' ) { 2808 trigger = '#' + escape( trigger ); 2809 } 2810 var args = { 2811 items: { 2812 src: trigger 2813 }, 2814 type: type, 2815 mainClass: extraClass, 2816 prependTo: $( '.page-wrapper' ) 2817 }; 2818 var $popupModal = $this; 2819 if ( $this.hasClass( 'porto-onload' ) || $this.hasClass( 'porto-exit-intent' ) ) { 2820 args['callbacks'] = { 2821 'beforeClose': function() { 2822 if ( $( '.mfp-wrap .porto-disable-modal-onload' ).length && ( $( '.mfp-wrap .porto-disable-modal-onload' ).is( ':checked' ) || $( '.mfp-wrap .porto-disable-modal-onload input[type="checkbox"]' ).is( ':checked' ) ) ) { 2823 $.cookie( 'porto_modal_disable_onload', 'true', { expires: 7 } ); 2824 } else if ( 'undefined' !== typeof $popupModal.data( 'expired' ) && 'undefined' !== typeof $popupModal.data( 'popup-id' ) ) { 2825 $.cookie( 'porto_modal_disable_period_onload_' + $popupModal.data( 'popup-id' ), $popupModal.data('expired'), { expires: $popupModal.data('expired') } ); 2826 } 2827 }, 2828 'afterClose': function() { 2829 // If minicart(cart, wishlist) opened, keep disabling mouse scrolling 2830 if ( $( '#header .minicart-opened' ).length ) { 2831 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', theme.getScrollbarWidth() ); 2832 $( 'html' ).css( 'overflow', 'hidden' ); 2833 } 2834 }, 2835 'open': function () { 2836 // Update bootstrap tooltip for Popup 2837 var $popup_builder = $( '.mfp-wrap .porto-block[data-bs-original-title]' ); 2838 if ( $popup_builder.length ) { 2839 bootstrap.Tooltip.getInstance( $popup_builder[0] ).update(); 2840 } 2841 if ( $( '.mfp-wrap .porto-block .owl-carousel' ) ) { 2842 $( '.mfp-wrap .porto-block .owl-carousel' ).trigger( 'refresh.owl.carousel' ); 2843 } 2844 } 2845 }; 2846 } 2847 if ( typeof overlayClass != "undefined" && overlayClass ) { 2848 args.mainClass += escape( overlayClass ); 2849 } 2850 setTimeout( () => { 2851 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, args ), 0 ); 2852 } ); 2853 2854 } 2855 } 2856 theme.porto_modal_open = porto_modal_open; 2857 function porto_init_magnific_popup_functions( $wrap ) { 2858 if ( typeof $wrap == 'undefined' || !$wrap.length ) { 2859 $wrap = $( document.body ); 2860 } 2861 $wrap.find( '.lightbox:not(.manual)' ).each( function() { 2862 var $this = $( this ), 2863 opts; 2864 if ( $this.find( '>.lb-dataContainer' ).length ) { 2865 return; 2866 } 2867 var pluginOptions = $this.data( 'lightbox-options' ); 2868 if ( pluginOptions ) { 2869 opts = pluginOptions; 2870 } else { 2871 pluginOptions = $this.data( 'plugin-options' ); 2872 if ( typeof pluginOptions != 'object' ) { 2873 pluginOptions = JSON.parse( pluginOptions ); 2874 } 2875 if ( pluginOptions ) { 2876 opts = pluginOptions; 2877 } 2878 } 2879 2880 $this.themeLightbox( opts ); 2881 } ); 2882 2883 // Popup with video or map 2884 $wrap.find( '.porto-popup-iframe' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 2885 disableOn: 700, 2886 type: 'iframe', 2887 mainClass: 'mfp-fade', 2888 removalDelay: 160, 2889 preloader: false,
2890 fixedContentPos: false 2891 } ) ); 2892 2893 // Popup with ajax 2894 $wrap.find( '.porto-popup-ajax' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 2895 type: 'ajax' 2896 } ) ); 2897 2898 // Popup with content 2899 $wrap.find( '.porto-popup-content' ).each( function() { 2900 var animation = $( this ).attr( 'data-animation' ); 2901 $( this ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 2902 type: 'inline', 2903 fixedContentPos: false, 2904 fixedBgPos: true, 2905 overflowY: 'auto', 2906 closeBtnInside: true, 2907 preloader: false, 2908 midClick: true, 2909 removalDelay: 300, 2910 mainClass: animation 2911 } ) ); 2912 } ); 2913 2914 // Porto Modal 2915 $wrap.find( '.popup-youtube, .popup-vimeo, .popup-gmaps' ).each( function( index ) { 2916 var overlayClass = $( this ).find( '.porto-modal-trigger' ).data( 'overlay-class' ), 2917 args = { 2918 type: 'iframe', 2919 removalDelay: 160, 2920 preloader: false, 2921 2922 fixedContentPos: false 2923 }; 2924 if ( typeof overlayClass != "undefined" && overlayClass ) { 2925 args.mainClass = escape( overlayClass ); 2926 } 2927 $( this ).magnificPopup( args ); 2928 } ); 2929 2930 if ( $wrap.find( '.porto-modal-trigger.porto-onload' ).length ) { 2931 var $obj = $wrap.find( '.porto-modal-trigger.porto-onload' ).eq( 0 ), 2932 timeout = 0; 2933 if ( $obj.data( 'timeout' ) ) { 2934 timeout = parseInt( $obj.data( 'timeout' ), 10 ); 2935 } 2936 setTimeout( function() { 2937 porto_modal_open( $obj ); 2938 }, timeout ); 2939 } 2940 $wrap.on( 'click', '.porto-modal-trigger', function( e ) { 2941 e.preventDefault(); 2942 porto_modal_open( $( this ) ); 2943 } ); 2944 2945 /* Woocommerce */ 2946 // login popup 2947 if ( $wrap.hasClass( 'login-popup' ) ) { 2948 $wrap.find( '.porto-link-login, .porto-link-register' ).magnificPopup( { 2949 items: { 2950 src: theme.ajax_url + ( -1 === theme.ajax_url.indexOf( '?' ) ? '?' : '&' ) + 'action=porto_account_login_popup&nonce=' + js_porto_vars.porto_nonce, 2951 type: 'ajax' 2952 }, 2953 tLoading: '<i class="porto-loading-icon"></i>', 2954 callbacks: { 2955 ajaxContentAdded: function() { 2956 $( window ).trigger( 'porto_login_popup_opened' ); 2957 } 2958 } 2959 } ); 2960 } 2961 2962 if ( typeof PhotoSwipe != 'undefined' ) { 2963 let _images = $wrap.find( '.product-images' ), links = [], i = 0; 2964 _images.find( 'img' ).each( function() { 2965 var slide = {}; 2966 2967 slide.src = $( this ).attr( 'href' ); 2968 slide.title = $( this ).attr( 'alt' ); 2969 slide.w = parseInt( $( this ).attr( 'data-large_image_width' ) ); 2970 slide.h = parseInt( $( this ).attr( 'data-large_image_height' ) ); 2971 2972 links[i] = slide; 2973 i++; 2974 } ); 2975 _images.data( 'links', links ); 2976 _images.on( 'click', '.img-thumbnail a.zoom', function( e ) { 2977 e.preventDefault(); 2978 var options = $.extend( { 2979 index: $( this ).closest( '.img-thumbnail' ).index(), 2980 addCaptionHTMLFn: function( item, captionEl ) { 2981 if ( ! item.title ) { 2982 captionEl.children[0].textContent = ''; 2983 return false; 2984 } 2985 captionEl.children[0].textContent = item.title; 2986 return true; 2987 } 2988 }, wc_single_product_params.photoswipe_options ); 2989 2990 // Initializes and opens PhotoSwipe. 2991 var photoswipe = new PhotoSwipe( $( '.pswp' )[0], PhotoSwipeUI_Default, _images.data( 'links' ), options ); 2992 photoswipe.init(); 2993 } ); 2994 2995 2996 } else { 2997 $wrap.find( '.product-images' ).magnificPopup( 2998 $.extend( true, {}, theme.mfpConfig, { 2999 delegate: '.img-thumbnail a.zoom', 3000 type: 'image', 3001 gallery: { enabled: true } 3002 } ) 3003 ); 3004 } 3005 $wrap.find( '.porto-posts-grid' ).each( function() { 3006 $( this ).magnificPopup( 3007 $.extend( true, {}, theme.mfpConfig, { 3008 delegate: '.porto-tb-featured-image span.zoom, .porto-tb-featured-image a.zoom, .post-image span.zoom', 3009 type: 'image', 3010 gallery: { enabled: true } 3011 } ) 3012 ); 3013 } ); 3014 $wrap.find( '.porto-posts-grid .tb-image-type-slider div.zoom' ).each( function() { 3015 var $this = $( this ), 3016 links = []; 3017 $this.find( 'a' ).each( function() { 3018 var slide = {}; 3019 slide.src = $( this ).attr( 'href' ); 3020 slide.title = $( this ).attr( 'title' ); 3021 links.push( slide ); 3022 } ); 3023 if ( links.length ) { 3024 $this.on( 'click', function() { 3025 var $slider = $this.siblings( '.porto-carousel' ); 3026 if ( $slider.length ) { 3027 var offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2; 3028 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 3029 items: links, 3030 gallery: { 3031 enabled: true 3032 }, 3033 type: 'image' 3034 } ), offset ); 3035 } 3036 } ); 3037 } 3038 } ); 3039 } 3040 3041 if ( $.fn.magnificPopup ) { 3042 porto_init_magnific_popup_functions(); 3043 } else { 3044 setTimeout( function() { 3045 if ( $.fn.magnificPopup ) { 3046 porto_init_magnific_popup_functions(); 3047 } 3048 }, 500 ); 3049 } 3050 $( document.body ).on( 'porto_load_posts_end', function( e, $posts_wrap ) { 3051 if ( $.fn.magnificPopup ) { 3052 porto_init_magnific_popup_functions( $posts_wrap ); 3053 } 3054 } ); 3055 3056 3057 // Post Filter
3058 if ( typeof theme.PostFilter !== 'undefined' ) { 3059 var $postFilterElements = $( 'ul[data-filter-type], .portfolio-filter, .member-filter, .faq-filter, .porto-ajax-filter.product-filter, .porto-ajax-filter.post-filter' ); 3060 if ( $postFilterElements.length ) { 3061 theme.PostFilter.initialize( $postFilterElements ); 3062 } 3063 } 3064 3065 // Post ajax pagination 3066 $( 'body' ).on( 'click', '.porto-ajax-load .pagination:not(.load-more) .page-numbers', function( e ) { 3067 var $this = $( this ); 3068 if ( $this.hasClass( 'current' ) || $this.hasClass( 'dots' ) ) { 3069 return; 3070 } 3071 e.preventDefault(); 3072 var $wrap = $this.closest( '.porto-ajax-load' ), 3073 post_type = $wrap.data( 'post_type' ), 3074 $obj = $wrap.find( '.' + post_type + 's-container' ); 3075 3076 if ( !$obj.length || $wrap.hasClass( 'loading' ) ) { 3077 return; 3078 } 3079 $wrap.addClass( 'loading' ); 3080 var $filter = $wrap.find( '.porto-ajax-filter' ), 3081 cat = $filter.length && $filter.children( '.active' ).length && $filter.children( '.active' ).data( 'filter' ); 3082 if ( '*' == cat ) { 3083 cat = ''; 3084 } 3085 var default_args = {}, 3086 page = $this.attr( 'href' ).match( /paged=(\d+)|page\/(\d+)/ ); 3087 3088 if ( page && Array.isArray( page ) && ( page[1] || page[2] ) ) { 3089 default_args['page'] = parseInt( page[1] || page[2] ); 3090 } else { 3091 if ( $this.hasClass( 'prev' ) ) { 3092 default_args['page'] = parseInt( $this.next().text() ); 3093 } else if ( $this.hasClass( 'next' ) ) { 3094 default_args['page'] = parseInt( $this.prev().text() ); 3095 } else { 3096 default_args['page'] = parseInt( $this.text() ); 3097 } 3098 } 3099 if ( cat == '' && $wrap.find( 'input[type=hidden].category' ).length ) { 3100 cat = $wrap.find( 'input[type=hidden].category' ).val(); 3101 default_args['taxonomy'] = $wrap.find( 'input[type=hidden].taxonomy' ).val(); 3102 } 3103 theme.PostFilter.load_posts( cat, $wrap.hasClass( 'load-infinite' ), $wrap, post_type, $obj, default_args, $this.attr( 'href' ) ); 3104 3105 } ); 3106 3107 3108 // Filter Zooms 3109 if ( typeof theme.FilterZoom !== 'undefined' ) { 3110 // Portfolio Filter Zoom 3111 theme.FilterZoom.initialize( $( '.page-portfolios' ) ); 3112 // Member Filter Zoom 3113 theme.FilterZoom.initialize( $( '.page-members' ) ); 3114 // Posts Related Style Filter Zoom 3115 theme.FilterZoom.initialize( $( '.blog-posts-related' ) ); 3116 } 3117 3118 // Image Hover Overlay on Posts Grid widget 3119 function portoSetHoverImage( $this, enter = true ) { 3120 var $item = $this.find( '[data-hoverlay-image]' ), 3121 $postsGrid = $this.closest( '.porto-posts-grid' ); 3122 if ( $item.length ) { 3123 var $target = $postsGrid.find( '#himg-' + $item.data( 'hoverlay-id' ) ); 3124 if ( enter ) { 3125 $target.addClass( 'active' ); 3126 $postsGrid.addClass( 'active' ); 3127 } else { 3128 $target.removeClass( 'active' ); 3129 $postsGrid.removeClass( 'active' ); 3130 } 3131 } 3132 } 3133 3134 function InsertHoverImage( $this ) { 3135 var $option = $this.data( 'hoverlay-image' ), 3136 $postsGrid = $this.closest( '.porto-posts-grid' ), 3137 $postsWrap = $this.closest( '.posts-wrap' ); 3138 3139 // Overlay Image 3140 $postsGrid.append( '<div class="thumb-info-full" style="background-image: url(' + $option.src + '); --porto-himg-height:' + $postsWrap.innerHeight() + 'px;" id="himg-' + $option.id + '"></div>' ); 3141 $postsGrid.addClass( 'image-hover-overlay' ); 3142 3143 3144 // Resize 3145 if ( $postsWrap.hasClass( 'owl-carousel' ) ) { 3146 $postsWrap.on( 'refreshed.owl.carousel resized.owl.carousel', function() { 3147 $postsGrid.find( '.thumb-info-full' ).css( '--porto-himg-height', ( $postsWrap.innerHeight() + 'px' ) ); 3148 } ) 3149 } else { 3150 $( window ).on( 'resize', function() { 3151 $postsGrid.find( '.thumb-info-full' ).css( '--porto-himg-height', ( $postsWrap.innerHeight() + 'px' ) ); 3152 } ); 3153 } 3154 3155 // Hover 3156 $( '.image-hover-overlay' ).on( 'mouseenter touchstart', '.porto-tb-item', function( e ) { 3157 portoSetHoverImage( $( this ) ); 3158 } ); 3159 $( '.image-hover-overlay' ).on( 'mouseleave touchend', '.porto-tb-item', function( e ) { 3160 portoSetHoverImage( $( this ), false ); 3161 } ); 3162 } 3163 3164 // expose to scope 3165 $.extend( theme, { 3166 InsertHoverImage: InsertHoverImage 3167 } ); 3168 3169 $( '.porto-posts-grid [data-hoverlay-image]' ).each( function() { 3170 theme.InsertHoverImage( $( this ) ); 3171 } ); 3172 3173 // close popup using esc key 3174 var $minicart_offcanvas = $( '.minicart-offcanvas' ), 3175 $wl_offcanvas = $( '.wishlist-offcanvas' ), 3176 $mobile_sidebar = $( '.mobile-sidebar' ), 3177 $mobile_panel = $( '#side-nav-panel' ), 3178 $overlay_search = $( '#header .btn-close-search-form' ), 3179 $html = $( 'html' ); 3180 if ( $minicart_offcanvas.length || $wl_offcanvas.length || $mobile_sidebar.length || $mobile_panel.length || $( '.skeleton-loading' ).length || $overlay_search.length ) { 3181 $( document.documentElement ).on( 'keyup', function( e ) { 3182 try { 3183 if ( e.keyCode == 27 ) { 3184 $minicart_offcanvas.removeClass( 'minicart-opened' ); 3185 $wl_offcanvas.removeClass( 'minicart-opened' ); 3186 if ( $mobile_sidebar.length ) { 3187 $html.removeClass( 'filter-sidebar-opened' ); 3188 $html.removeClass( 'sidebar-opened' ); 3189 $( '.sidebar-overlay' ).removeClass( 'active' ); 3190 $( 'html' ).css( 'overflow', '' ); 3191 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', '' ); 3192 } 3193 if ( $mobile_panel.length && $html.hasClass( 'panel-opened' ) ) { 3194 $html.removeClass( 'panel-opened' ); 3195 $( '.panel-overlay' ).removeClass( 'active' ); 3196 } 3197 if ( $overlay_search.length ) { 3198 $overlay_search.trigger( 'click' ); 3199 } 3200 } 3201 } catch ( err ) { } 3202 } ); 3203 $( '.skeleton-loading' ).on( 'skeleton-loaded', function() { 3204 $mobile_sidebar = $( '.mobile-sidebar' ); 3205 } ); 3206 } 3207 3208 // Mouse Parallax 3209 if ( $.fn.themeMouseparallax ) { 3210 $( function() { 3211 $( '[data-plugin="mouse-parallax"]' ).each( function() { 3212 var $this = $( this ), 3213 opts; 3214 if ( $this.data( 'parallax' ) ) { 3215 $this.parallax( 'disable' ); 3216 $this.removeData( 'parallax' ); 3217 $this.removeData( 'options' ); 3218 } 3219 if ( $this.hasClass( 'elementor-element' ) ) { 3220 $this.children( '.elementor-widget-container, .elementor-container, .elementor-widget-wrap, .elementor-column-wrap' ).addClass( 'layer' ).attr( 'data-depth', $this.attr( 'data-floating-depth' ) ); 3221 } else { 3222 $this.children( '.layer' ).attr( 'data-depth', $this.attr( 'data-floating-depth' ) ); 3223 } 3224 3225 var pluginOptions = $this.data( 'options' ); 3226 if ( pluginOptions ) 3227 opts = pluginOptions; 3228 3229 $this.themeMouseparallax( opts ); 3230 } ); 3231 } ); 3232 } 3233 3234 if ( $.fn['themePluginReadMore'] && $( '[data-plugin-readmore]' ).length ) { 3235 $( '[data-plugin-readmore]:not(.manual)' ).themePluginReadMore(); 3236 } 3237 3238 // Hover Split 3239 if ( $.fn.themePluginHoverSplit ) { 3240 $( '.mouse-hover-split' ).each( function() { 3241 var $this = $( this ), 3242 // Elmentor 3243 $splitSlide = $this.find( '>.split-slide' ); 3244 if ( $splitSlide.length >= 2 ) { 3245 $this.themePluginHoverSplit(); 3246 } 3247 } ); 3248 } 3249 3250 // Horizontal Scroller 3251 if ( $.fn.themePluginHScroller ) { 3252 // Horizontal Scroller 3253 $( '.horizontal-scroller-wrapper' ).each( function() { 3254 $( this ).themePluginHScroller( true ); 3255 } ); 3256 } 3257 3258 // Text Hover Floating Image 3259 if ( $.fn.themePluginTIFloating ) {
3260 $( '.thumb-info-floating-element-wrapper[data-plugin-tfloating]' ).each( function() { 3261 $( this ).themePluginTIFloating(); 3262 } ); 3263 } 3264} ); 3265 3266( function( theme, $ ) { 3267 // init wishlist off-canvas 3268 if ( $( '.wishlist-popup' ).length ) { 3269 var worker = null; 3270 3271 $( '.wishlist-offcanvas .my-wishlist' ).on( 'click', function( e ) { 3272 e.preventDefault(); 3273 var $this = $(this); 3274 $this.parent().toggleClass( 'minicart-opened' ); 3275 if ( $this.parent().hasClass( 'minicart-opened' ) ) { 3276 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', theme.getScrollbarWidth() ); 3277 $( 'html' ).css( 'overflow', 'hidden' ); 3278 } else { 3279 $( 'html' ).css( 'overflow', '' ); 3280 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', '' ); 3281 } 3282 } ); 3283 3284 $( '.wishlist-offcanvas .minicart-overlay' ).on( 'click', function() { 3285 $( this ).closest( '.wishlist-offcanvas' ).removeClass( 'minicart-opened' ); 3286 $( 'html' ).css( 'overflow', '' ); 3287 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', '' ); 3288 } ); 3289 3290 var init_wishlist = function() { 3291 worker = new Worker( js_porto_vars.ajax_loader_url.replace( '/images/[email protected]', '/js/woocommerce-worker.js' ) ); 3292 worker.onmessage = function( e ) { 3293 $( '.wishlist-popup' ).html( e.data ); 3294 }; 3295 worker.postMessage( { initWishlist: true, ajaxurl: theme.ajax_url, nonce: js_porto_vars.porto_nonce } ); 3296 }; 3297 3298 if ( theme && theme.isLoaded ) { 3299 setTimeout( function() { 3300 init_wishlist(); 3301 }, 100 ); 3302 } else { 3303 $( window ).on( 'load', function() { 3304 init_wishlist(); 3305 } ); 3306 } 3307 3308 // remove from wishlist 3309 $( '.wishlist-popup' ).on( 'click', '.remove_from_wishlist', function( e ) { 3310 e.preventDefault(); 3311 3312 var $this = $( this ), 3313 id = $this.attr( 'data-product_id' ), 3314 $table = $( '.wishlist_table #yith-wcwl-row-' + id + ' .remove_from_wishlist' ); 3315 3316 $this.closest( '.wishlist-item' ).find( '.ajax-loading' ).show(); 3317 3318 if ( $table.length ) { 3319 $table.trigger( 'click' ); 3320 } else { 3321 if ( typeof yith_wcwl_l10n !== 'undefined' ) { 3322 $.ajax( { 3323 url: yith_wcwl_l10n.ajax_url, 3324 data: { 3325 action: yith_wcwl_l10n.actions.remove_from_wishlist_action, 3326 remove_from_wishlist: id, 3327 nonce: typeof yith_wcwl_l10n.nonce !== 'undefined' ? yith_wcwl_l10n.nonce.remove_from_wishlist_nonce : '', 3328 from: 'theme' 3329 }, 3330 method: 'post', 3331 success: function( data ) { 3332 var $wcwlWrap = $( '.yith-wcwl-add-to-wishlist.add-to-wishlist-' + id ); 3333 if ( $wcwlWrap.length ) { 3334 var fragmentOptions = $wcwlWrap.data( 'fragment-options' ), 3335 $link = $wcwlWrap.find( 'a' ); 3336 if ( $link.length ) { 3337 if ( fragmentOptions.in_default_wishlist ) { 3338 delete fragmentOptions.in_default_wishlist; 3339 $wcwlWrap.attr( JSON.stringify( fragmentOptions ) ); 3340 } 3341 $wcwlWrap.removeClass( 'exists' ); 3342 $wcwlWrap.find( '.yith-wcwl-wishlistexistsbrowse' ).addClass( 'yith-wcwl-add-button' ).removeClass( 'yith-wcwl-wishlistexistsbrowse' ); 3343 $wcwlWrap.find( '.yith-wcwl-wishlistaddedbrowse' ).addClass( 'yith-wcwl-add-button' ).removeClass( 'yith-wcwl-wishlistaddedbrowse' ); 3344 $link.attr( 'href', location.href + ( -1 === location.href.indexOf( '?' ) ? '?' : '&' ) + 'post_type=product&add_to_wishlist=' + id ).attr( 'data-product-id', id ).attr( 'data-product-type', fragmentOptions.product_type ); 3345 var text = $( '.single_add_to_wishlist' ).data( 'title' ); 3346 if ( !text ) { 3347 text = 'Add to wishlist'; 3348 } 3349 $link.attr( 'title', text ).attr( 'data-title', text ).addClass( 'add_to_wishlist single_add_to_wishlist' ).html( '<span>' + text + '</span>' ); 3350 } 3351 } 3352 $( document.body ).trigger( 'removed_from_wishlist' ); 3353 //$this.closest('.wishlist-item').remove(); 3354 } 3355 } ); 3356 } 3357 } 3358 } ); 3359 3360 $( document.body ).on( 'added_to_wishlist removed_from_wishlist', function( e ) { 3361 if ( worker ) { 3362 worker.postMessage( { loadWishlist: true, ajaxurl: theme.ajax_url, nonce: js_porto_vars.porto_nonce } ); 3363 } 3364 } ); 3365 } 3366 3367 // Hide Tooltip before adding to wishlist 3368 $( document ).on( 'yith_wcwl_add_to_wishlist_data', function( e, $el ) { 3369 if ( $el.length ) { 3370 $el.tooltip( 'hide' ); 3371 } 3372 } ); 3373 3374 // Content Collapse 3375 $( document ).on( 'click', '.content-collapse-wrap .btn-read-more-wrap', function ( e ) { 3376 e.preventDefault(); 3377 var $wrap = $( this ).closest( '.content-collapse-wrap' ); 3378 if ( $wrap.hasClass( 'opened' ) ) { 3379 $wrap.removeClass( 'opened' ); 3380 } else { 3381 $wrap.addClass( 'opened' ); 3382 } 3383 } ); 3384} ).apply( this, [window.theme, jQuery] );
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.