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-ajax-filtered' ); 1560 } 1561 1562 // update browser history (IE doesn't support it) 1563 if ( page_url && !navigator.userAgent.match( /msie/i ) ) { 1564 window.history.pushState( { 'pageTitle': ( res && res.pageTitle ) || '' }, '', page_url ); 1565 } 1566 } 1567 1568 $( document.body ).trigger( 'porto_load_posts_end', [$parent.parent()] ); 1569 }; 1570 1571 if ( typeof default_args == 'undefined' && typeof self.cache[pid] != 'undefined' && typeof self.cache[pid][cat+ _gridcookie] != 'undefined' && self.cache[pid][cat+ _gridcookie] ) { 1572 successfn( self.cache[pid][cat+ _gridcookie], true ); 1573 self.isLoading = false; 1574 $parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove(); 1575 return; 1576 } 1577 1578 var ajax_load_options = $parent.data( 'ajax_load_options' ); 1579 if ( ( $parent.hasClass( 'archive-products' ) && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'shop' ) ) || 1580 ( is_archive && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'blog' ) ) ) { // skeleton
1580screen in archive builder 1581 $posts_wrap = $parent.find( '.' + post_type + 's-container' ); 1582 if ( ajax_load_options ) { 1583 var tag_name = 'div'; 1584 if ( 'product' == post_type && 'ul' == $posts_wrap.get( 0 ).tagName.toLowerCase() ) { 1585 tag_name = 'li'; 1586 } 1587 $posts_wrap.addClass( 'skeleton-body' ).empty(); 1588 for ( var i = 0; i < Number( ajax_load_options.count || ( ajax_load_options.columns && ajax_load_options.columns * 3 ) || 12 ); i++ ) { 1589 $posts_wrap.append( '<' + tag_name + ' class="porto-tb-item post ' + post_type + ( 'product' == post_type ? ' product-col' : '' ) + '"></' + tag_name + '>' ); 1590 } 1591 } else { 1592 $posts_wrap.addClass( 'skeleton-body' ).children().empty(); 1593 } 1594 } else { 1595 if ( !$parent.children( '.porto-loading-icon' ).length ) { 1596 $parent.append( '<i class="porto-loading-icon"></i>' ); 1597 } 1598 $parent.addClass( 'porto-ajax-loading' ); 1599 } 1600 1601 var current_url = window.location.href; 1602 if ( -1 !== current_url.indexOf( '#' ) ) { 1603 current_url = current_url.split( '#' )[0]; 1604 } 1605 1606 var args, load_url = theme.ajax_url; 1607 if ( $parent.hasClass( 'archive-posts' ) ) { // archive builder 1608 args = { 1609 portoajax: true, 1610 load_posts_only: true 1611 }; 1612 if ( $parent.closest( '.porto-block' ).length ) { 1613 args['builder_id'] = $parent.closest( '.porto-block' ).data( 'id' ); 1614 } 1615 load_url = typeof page_url != 'undefined' ? page_url : current_url; 1616 } else { 1617 args = { 1618 action: 'porto_ajax_posts', 1619 nonce: js_porto_vars.porto_nonce, 1620 post_type: post_type, 1621 current_link: current_url 1622 }; 1623 if ( $parent.data( 'post_layout' ) ) { 1624 args['post_layout'] = $parent.data( 'post_layout' ); 1625 } 1626 if ( ajax_load_options ) { 1627 args['extra'] = ajax_load_options; 1628 } 1629 if ( typeof default_args != 'undefined' ) { 1630 args = $.extend( args, default_args ); 1631 } 1632 } 1633 if ( cat ) { 1634 args['category'] = cat; 1635 } 1636 1637 $.ajax( { 1638 url: load_url, 1639 type: 'post', 1640 data: args, 1641 success: successfn, 1642 complete: function() { 1643 self.isLoading = false; 1644 $posts_wrap.removeClass( 'skeleton-body' ); 1645 $parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove(); 1646 } 1647 } ); 1648 1649 } 1650 } 1651 1652 } ); 1653 1654} ).apply( this, [window.theme, jQuery] ); 1655 1656// Filter Zoom 1657( function( theme, $ ) { 1658 'use strict'; 1659 1660 theme = theme || {}; 1661 1662 $.extend( theme, { 1663 1664 FilterZoom: { 1665 1666 defaults: { 1667 elements: null 1668 }, 1669 1670 initialize: function( $elements ) { 1671 this.$elements = ( $elements || this.defaults.elements ); 1672 1673 this.build(); 1674 1675 return this; 1676 }, 1677 1678 build: function() { 1679 var self = this; 1680 1681 self.$elements.each( function() { 1682 var $this = $( this ), 1683 zoom = $this.find( '.zoom, .thumb-info-zoom' ).get( 0 ); 1684 1685 if ( !zoom ) return; 1686 1687 $this.find( '.zoom, .thumb-info-zoom' ).off( 'click' ); 1688 var links = []; 1689 var i = 0; 1690 $this.find( 'article' ).each( function() { 1691 var $that = $( this ); 1692 if ( $that.css( 'display' ) != 'none' ) { 1693 var $zoom = $that.find( '.zoom, .thumb-info-zoom' ), 1694 slide, 1695 src = $zoom.data( 'src' ), 1696 title = $zoom.data( 'title' ); 1697 1698 $zoom.data( 'index', i ); 1699 if ( Array.isArray( src ) ) { 1700 $.each( src, function( index, value ) { 1701 slide = {}; 1702 slide.src = value; 1703 slide.title = title[index]; 1704 links[i] = slide; 1705 i++; 1706 } ); 1707 } else { 1708 slide = {}; 1709 slide.src = src; 1710 slide.title = title; 1711 links[i] = slide; 1712 i++; 1713 } 1714 } 1715 } ); 1716 $this.find( 'article' ).each( function() { 1717 var $that = $( this ); 1718 if ( $that.css( 'display' ) != 'none' ) { 1719 $that.off( 'click', '.zoom, .thumb-info-zoom' ).on( 'click', '.zoom, .thumb-info-zoom', function( e ) {
1720 var $zoom = $( this ), $parent = $zoom.parents( '.thumb-info' ), offset = 0; 1721 if ( $parent.get( 0 ) ) { 1722 var $slider = $parent.find( '.porto-carousel' ); 1723 if ( $slider.get( 0 ) ) { 1724 offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2; 1725 } 1726 } 1727 e.preventDefault(); 1728 if ( $.fn.magnificPopup ) { 1729 $.magnificPopup.close(); 1730 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 1731 items: links, 1732 gallery: { 1733 enabled: true 1734 }, 1735 type: 'image' 1736 } ), $zoom.data( 'index' ) + offset ); 1737 } 1738 return false; 1739 } ); 1740 } 1741 } ); 1742 } ); 1743 1744 return self; 1745 } 1746 } 1747 1748 } ); 1749 1750} ).apply( this, [window.theme, jQuery] ); 1751 1752// Mouse Parallax 1753( function( theme, $ ) { 1754 'use strict'; 1755 1756 theme = theme || {}; 1757 1758 var instanceName = '__parallax'; 1759 1760 var Mouseparallax = function( $el, opts ) { 1761 return this.initialize( $el, opts ); 1762 }; 1763 1764 Mouseparallax.prototype = { 1765 initialize: function( $el, opts ) { 1766 this.$el = $el; 1767 1768 this 1769 .setData() 1770 .setOptions( opts ) 1771 .build(); 1772 1773 return this; 1774 }, 1775 1776 setData: function() { 1777 this.$el.data( instanceName, this ); 1778 return this; 1779 }, 1780 1781 setOptions: function( opts ) { 1782 this.options = $.extend( true, {}, { 1783 wrapper: this.$el, 1784 opts: opts 1785 } ); 1786 return this; 1787 }, 1788 1789 build: function() { 1790 if ( !$.fn.parallax ) { 1791 return this; 1792 } 1793 1794 var $el = this.options.wrapper, 1795 opts = this.options.opts 1796 1797 $el.parallax( opts ); 1798 } 1799 }; 1800 1801 //expose to scope 1802 $.extend( theme, { 1803 Mouseparallax: Mouseparallax 1804 } ); 1805 1806 // jquery plugin 1807 $.fn.themeMouseparallax = function( opts ) { 1808 var obj = this.map( function() { 1809 var $this = $( this ); 1810 1811 if ( $this.data( instanceName ) ) { 1812 return $this.data( instanceName ); 1813 } else { 1814 return new theme.Mouseparallax( $this, opts ); 1815 } 1816 } ); 1817 return obj; 1818 } 1819} ).apply( this, [window.theme, jQuery] ); 1820 1821// Read More 1822( function( theme, $ ) { 1823 1824 theme = theme || {}; 1825 1826 var instanceName = '__readmore'; 1827 1828 var PluginReadMore = function( $el, opts ) { 1829 return this.initialize( $el, opts ); 1830 }; 1831 1832 PluginReadMore.defaults = { 1833 buttonOpenLabel: 'Read More <i class="fas fa-chevron-down text-2 ms-1"></i>', 1834 buttonCloseLabel: 'Read Less <i class="fas fa-chevron-up text-2 ms-1"></i>', 1835 enableToggle: true, 1836 maxHeight: 300, 1837 overlayColor: '#43a6a3', 1838 overlayHeight: 100, 1839 startOpened: false, 1840 align: 'left' 1841 }; 1842 1843 PluginReadMore.prototype = { 1844 initialize: function( $el, opts ) { 1845 var self = this; 1846 1847 this.$el = $el; 1848 1849 this 1850 .setData() 1851 .setOptions( opts ) 1852 .build() 1853 .events() 1854 .resize(); 1855 1856 if ( self.options.startOpened ) { 1857 self.options.wrapper.find( '.readmore-button-wrapper > button' ).trigger( 'click' ); 1858 } 1859 1860 return this; 1861 }, 1862 1863 setData: function() { 1864 this.$el.data( instanceName, this ); 1865 1866 return this; 1867 }, 1868 1869 setOptions: function( opts ) { 1870 this.options = $.extend( true, {}, PluginReadMore.defaults, opts, { 1871 wrapper: this.$el 1872 } ); 1873 1874 return this; 1875 }, 1876 1877 build: function() { 1878 var self = this; 1879 1880 self.options.wrapper.addClass( 'position-relative' ); 1881 1882 // Overlay 1883 self.options.wrapper.append( '<div class="readmore-overlay"></div>' ); 1884 1885 // Check if is Safari 1886 var backgroundCssValue = 'linear-gradient(180deg, rgba(2, 0, 36, 0) 0%, ' + self.options.overlayColor + ' 100%)'; 1887 if ( $( 'html' ).hasClass( 'safari' ) ) { 1888 backgroundCssValue = '-webkit-linear-gradient(top, rgba(2, 0, 36, 0) 0%, ' + self.options.overlayColor + ' 100%)' 1889 } 1890 1891 self.options.wrapper.find( '.readmore-overlay' ).css( { 1892 background: backgroundCssValue, 1893 position: 'absolute', 1894 bottom: 0, 1895 left: 0, 1896 width: '100%', 1897 height: self.options.overlayHeight, 1898 'z-index': 1 1899 } ); 1900 1901 // Read More Button 1902 self.options.wrapper.find( '.readmore-button-wrapper' ).removeClass( 'd-none' ).css( { 1903 position: 'absolute', 1904 bottom: 0, 1905 left: 0, 1906 width: '100%', 1907 'z-index': 2 1908 } ); 1909 1910 // Button Label 1911 self.options.wrapper.find( '.readmore-button-wrapper > button' ).html( self.options.buttonOpenLabel ); 1912 1913 self.options.wrapper.css( { 1914 'height': self.options.maxHeight, 1915 'overflow-y': 'hidden' 1916 } ); 1917 1918 // Alignment 1919 switch ( self.options.align ) { 1920 case 'center': 1921 self.options.wrapper.find( '.readmore-button-wrapper' ).addClass( 'text-center' ); 1922 break; 1923 1924 case 'right': 1925 self.options.wrapper.find( '.readmore-button-wrapper' ).addClass( 'text-end' ); 1926 break; 1927 1928 case 'left': 1929 default: 1930 self.options.wrapper.find( '.readmore-button-wrapper' ).addClass( 'text-start' ); 1931 break; 1932 } 1933 1934 return this; 1935 1936 }, 1937 1938 events: function() { 1939 var self = this; 1940 1941 // Read More 1942 self.readMore = function() { 1943 self.options.wrapper.find( '.readmore-button-wrapper > button:not(.readless)' ).on( 'click', function( e ) { 1944 e.preventDefault(); 1945 self.options.wrapper.addClass( 'opened' ); 1946 1947 var $this = $( this ); 1948 1949 setTimeout( function() { 1950 self.options.wrapper.animate( { 1951 'height': self.options.wrapper[0].scrollHeight 1952 }, function() { 1953 if ( !self.options.enableToggle ) { 1954 $this.fadeOut(); 1955 } 1956
1957 $this.html( self.options.buttonCloseLabel ).addClass( 'readless' ).off( 'click' ); 1958 1959 self.readLess(); 1960 1961 self.options.wrapper.find( '.readmore-overlay' ).fadeOut(); 1962 self.options.wrapper.css( { 1963 'max-height': 'none', 1964 'overflow': 'visible' 1965 } ); 1966 1967 self.options.wrapper.find( '.readmore-button-wrapper' ).animate( { 1968 bottom: -20 1969 } ); 1970 } ); 1971 }, 200 ); 1972 } ); 1973 } 1974 1975 // Read Less 1976 self.readLess = function() { 1977 self.options.wrapper.find( '.readmore-button-wrapper > button.readless' ).on( 'click', function( e ) { 1978 e.preventDefault(); 1979 self.options.wrapper.removeClass( 'opened' ); 1980 1981 var $this = $( this ); 1982 1983 // Button 1984 self.options.wrapper.find( '.readmore-button-wrapper' ).animate( { 1985 bottom: 0 1986 } ); 1987 1988 // Overlay 1989 self.options.wrapper.find( '.readmore-overlay' ).fadeIn(); 1990 1991 setTimeout( function() { 1992 self.options.wrapper.height( self.options.wrapper[0].scrollHeight ).animate( { 1993 'height': self.options.maxHeight 1994 }, function() { 1995 $this.html( self.options.buttonOpenLabel ).removeClass( 'readless' ).off( 'click' ); 1996 1997 self.readMore(); 1998 1999 self.options.wrapper.css( { 2000 'overflow': 'hidden' 2001 } ); 2002 } ); 2003 }, 200 ); 2004 } ); 2005 } 2006 2007 // First Load 2008 self.readMore(); 2009 2010 return this; 2011 }, 2012 2013 resize: function() { 2014 var self = this; 2015 window.addEventListener( 'resize', function() { 2016 self.options.wrapper.hasClass( 'opened' ) ? self.options.wrapper.css( { 'height': 'auto' } ) : self.options.wrapper.css( { 'height': self.options.maxHeight } ); 2017 } ) 2018 } 2019 }; 2020 2021 // expose to scope 2022 $.extend( theme, { 2023 PluginReadMore: PluginReadMore 2024 } ); 2025 2026 // jquery plugin 2027 $.fn.themePluginReadMore = function( opts ) { 2028 return this.map( function() { 2029 var $this = $( this ); 2030 2031 if ( $this.data( instanceName ) ) { 2032 return $this.data( instanceName ); 2033 } else { 2034 return new PluginReadMore( $this, $this.data( 'plugin-options' ) ); 2035 } 2036 2037 } ); 2038 } 2039 2040} ).apply( this, [window.theme, jQuery] ); 2041 2042// Mouse Hover Split 2043( function( theme, $ ) { 2044 2045 theme = theme || {}; 2046 2047 var instanceName = '__mousehoversplit'; 2048 2049 var PluginHoverSplit = function( $el ) { 2050 return this.initialize( $el ); 2051 } 2052 2053 PluginHoverSplit.prototype = { 2054 initialize: function( $el ) { 2055 if ( $el.data( instanceName ) ) { 2056 return this; 2057 } 2058 this.$el = $el.addClass( 'slide-wrapper' ); 2059 2060 this 2061 .setData() 2062 .event(); 2063 2064 return this; 2065 }, 2066 2067 setData: function() { 2068 this.$el.data( instanceName, this ); 2069 this.$el.addClass( 'initialized' ); 2070 var $columns = this.$el.find( '>.split-slide' ); 2071 for ( var index = 0; index < $columns.length; index++ ) { 2072 var column = $columns[index]; 2073 if ( index == 0 ) { 2074 column.classList.add( 'slide-left' ); 2075 this.left = column; 2076 } else if ( index == 1 ) { 2077 column.classList.add( 'slide-right' ); 2078 break; 2079 } 2080 } 2081 2082 return this; 2083 }, 2084 2085 event: function() { 2086 // Refresh 2087 this.refresh(); 2088 this.refreshFunc = this.refresh.bind( this ); 2089 $( window ).on( 'resize', this.refreshFunc ); 2090 2091 //Hover 2092 this.handleMoveFunc = this.handleMove.bind( this ); 2093 $( document.body ).on( 'mousemove', this.handleMoveFunc ); 2094 }, 2095 handleMove: function( e ) { 2096 if ( e.clientX < this.$el.offset().left ) { 2097 this.left.style.width = '0'; 2098 } else { 2099 this.left.style.width = `calc( ${ ( e.clientX - this.$el.offset().left ) / ( this.$el.innerWidth() ) * 100 }% - 3px ) `; 2100 } 2101 }, 2102 refresh: function( e ) { 2103 if ( e && e.type == 'resize' ) { 2104 this.$el.css( 'min-height', $( this.left ).height() ); 2105 } 2106 this.$el.find( '>.split-slide>*' ).css( 'width', this.$el.innerWidth() ); 2107 }, 2108 clearData: function() { 2109 // Remove class and instance 2110 this.$el.removeClass( 'slide-wrapper' ).removeData( instanceName ).css( 'min-height', '' ); 2111 this.$el.find( '>*' ).removeClass( 'slide-left slide-right' ).css( 'width', '' ); 2112 2113 // Clear Event 2114 $( window ).off( 'resize', this.refreshFunc ); 2115 $( document.body ).off( 'mousemove', this.handleMoveFunc ); 2116 } 2117 } 2118 2119 // expose to scope 2120 $.extend( theme, { 2121 PluginHoverSplit: PluginHoverSplit 2122 } ); 2123 2124 $.fn.themePluginHoverSplit = function() { 2125 return this.map( function() { 2126 var $this = $( this ), 2127 $splitColumns = $this.find( '>.split-slide' ); 2128 if ( $splitColumns.length >= 2 ) { 2129 if ( $this.data( instanceName ) ) { 2130 return $this.data( instanceName ); 2131 } else { 2132 return new PluginHoverSplit( $this ); 2133 } 2134 } 2135 } ); 2136 } 2137} ).apply( this, [window.theme, jQuery] ); 2138 2139// Horizontal Scroller 2140( function( theme, $ ) { 2141 theme = theme || {}; 2142 2143 var instanceName = '__horizontalscroller'; 2144 2145 var PluginHScroller = function( $el, opts ) { 2146 return this.initialize( $el, opts ); 2147 } 2148 2149 PluginHScroller.defaults = { 2150 lg: 3, 2151 md: 1, 2152 init_refresh: false, 2153 }; 2154 2155 PluginHScroller.prototype = { 2156 initialize: function( $el, opts ) { 2157 if ( $el.data( instanceName ) ) { 2158 return this; 2159 } 2160 this.$el = $el; 2161 2162 this 2163 .setData( opts ) 2164 .build() 2165 .event(); 2166 2167 return this; 2168 }, 2169 setData: function( opts ) { 2170 this.$el.data( instanceName, this ); 2171 this.options = $.extend( true, {}, PluginHScroller.defaults, opts ); 2172 this.$hScroller = this.$el.find( '.horizontal-scroller' ); 2173 this.$hScrollerItems = this.$hScroller.find( '.horizontal-scroller-items' ); 2174 this.$hScrollerItems.find( '>*' ).addClass( 'horizontal-scroller-item' ); 2175 return this; 2176 }, 2177 build: function() { 2178 // Copy Original HTML to clone on Resize.
2179 this.originalScrollHTML = this.$hScroller.html(); 2180 this.scrollerInitialized = false; 2181 2182 return this; 2183 }, 2184 // Generate Scroller 2185 generateScroller: function() { 2186 var items = gsap.utils.toArray( this.$hScrollerItems.find( '.horizontal-scroller-item' ) ); 2187 gsap.to( items, { 2188 xPercent: -100 * ( items.length - ( $( window ).width() > 991 ? this.options.lg : this.options.md ) ), 2189 ease: 'none', 2190 scrollTrigger: { 2191 trigger: '.horizontal-scroller', 2192 pin: true, 2193 scrub: 1, 2194 snap: 1 / ( items.length - 1 ), 2195 end: () => '+=' + this.$hScrollerItems.width(), 2196 el: this.$el, 2197 } 2198 } ); 2199 2200 this.scrollerInitialized = true; 2201 }, 2202 event: function() { 2203 if ( this.options.init_refresh ) { 2204 this.generateScroller(); 2205 } 2206 // Scroll Event to initialize when visible 2207 this.scrollFunc = this.scroll.bind( this ); 2208 $( window ).on( 'scroll', this.scrollFunc ); 2209 2210 // Resize Event removing and restarting 2211 this.afterResizeFunc = this.afterResize.bind( this ); 2212 $( window ).on( 'afterResize', this.afterResizeFunc ); 2213 }, 2214 scroll: function() { 2215 if ( !this.scrollerInitialized ) { 2216 2217 var position = this.$el[0].getBoundingClientRect(); 2218 2219 if ( position.top >= 0 && position.top < window.innerHeight && position.bottom >= 0 ) { 2220 this.generateScroller(); 2221 } 2222 } 2223 }, 2224 afterResize: function() { 2225 2226 this.scrollerInitialized = false; 2227 var Alltrigger = ScrollTrigger.getAll(); 2228 2229 for ( var i = 0; i < Alltrigger.length; i++ ) { 2230 if ( Alltrigger[i]['vars'] && typeof Alltrigger[i]['vars']['el'] != 'undefined' && Alltrigger[i]['vars']['el'] == this.$el ) { 2231 Alltrigger[i].kill( true ); 2232 this.$el.empty().html( '<div class="horizontal-scroller">' + this.originalScrollHTML + '</div>' ); 2233 this.$hScrollerItems = this.$el.find( '.horizontal-scroller-items' ); 2234 break; 2235 } 2236 } 2237 }, 2238 clearData: function() { 2239 this.$el.removeData( instanceName ); 2240 $( window ).off( 'scroll', this.scrollFunc ); 2241 $( window ).off( 'afterResize', this.afterResizeFunc ); 2242 } 2243 }; 2244 // expose to scope 2245 $.extend( theme, { 2246 PluginHScroller: PluginHScroller 2247 } ); 2248 $.fn.themePluginHScroller = function( opt = false ) { 2249 if ( typeof gsap !== 'undefined' && typeof ScrollTrigger !== 'undefined' ) { 2250 return this.map( function() { 2251 var $this = $( this ); 2252 if ( $this.data( instanceName ) ) { 2253 return $this.data( instanceName ); 2254 } else { 2255 if ( $this.find( '.horizontal-scroller-items>*' ).length ) { 2256 options = $this.data( 'plugin-hscroll' ); 2257 if ( opt ) { 2258 options['init_refresh'] = true; 2259 } 2260 return new PluginHScroller( $this, options ); 2261 } 2262 } 2263 } ); 2264 } else { 2265 return false; 2266 } 2267 } 2268} ).apply( this, [window.theme, jQuery] ); 2269 2270// Text Hover Image Floating - Ultimate Heading, Custom Heading for wpb 2271( function( theme, $ ) { 2272 theme = theme || {}; 2273 2274 var instanceName = '__textelfloating'; 2275 2276 var PluginTElFloaing = function( $el, opts ) { 2277 return this.initialize( $el, opts ); 2278 }; 2279 2280 PluginTElFloaing.defaults = { 2281 offset: 0, 2282 }; 2283 2284 PluginTElFloaing.prototype = { 2285 initialize: function( $el, opts ) { 2286 if ( $el.data( instanceName ) ) { 2287 return this; 2288 } 2289 this.$el = $el; 2290 2291 this 2292 .setData( opts ) 2293 .event(); 2294 2295 return this; 2296 }, 2297 setData: function( opts ) { 2298 this.options = $.extend( true, {}, PluginTElFloaing.defaults, opts ); 2299 this.$el.data( instanceName, this ); 2300 return this; 2301 }, 2302 event: function() { 2303 this.mouseEnterFunc = this.mouseEnter.bind( this ); 2304 this.$el.on( 'mouseenter', this.mouseEnterFunc ); 2305 this.mouseOutFunc = this.mouseOut.bind( this ); 2306 this.$el.on( 'mouseleave', this.mouseOutFunc ); 2307 }, 2308 mouseEnter: function( e ) { 2309 2310 $( '.thumb-info-floating-element-clone' ).remove(); 2311 var $thumbFloatingEl = $( '.thumb-info-floating-element', this.$el ); 2312 if ( $thumbFloatingEl.length ) { 2313 this.$elClone = $thumbFloatingEl.clone().addClass( 'thumb-info-floating-element-clone' ).removeClass( 'd-none' ).appendTo( document.body ); 2314 } else if ( this.$el.hasClass( 'tb-hover-content' ) && this.$el.children().length > 0 ) { 2315 if ( this.$el.hasClass( 'with-link' ) ) { 2316 $thumbFloatingEl = this.$el.children( ':nth-child(2)' ); 2317 } else { 2318 $thumbFloatingEl = this.$el.children( ':first' ); 2319 } 2320 this.$elClone = $thumbFloatingEl.clone().addClass( 'thumb-tb-floating-el' ).appendTo( document.body ).wrap( '<div class="thumb-info-floating-element-clone page-wrapper"></div>' ); 2321 } else { 2322 return; 2323 } 2324 2325 // Image LazyLoad
2326 $imgs = $( '.thumb-info-floating-element-clone' ).find( 'img.porto-lazyload' ); 2327 $imgs.each( function( index, img ) { 2328 var $img = $( img ); 2329 if ( $img.length && $img.data( 'oi' ) ) { 2330 $img.attr( 'src', $img.data( 'oi' ) ).addClass( 'lazy-load-loaded' ); 2331 } 2332 } ); 2333 2334 $( '.thumb-info-floating-element-clone' ).css( { 2335 left: e.clientX + parseInt( this.options.offset ), 2336 top: e.clientY + parseInt( this.options.offset ) 2337 } ).fadeIn( 300 ); 2338 2339 gsap.to( '.thumb-info-floating-element-clone', 1, { 2340 css: { 2341 scaleX: 1, 2342 scaleY: 1 2343 } 2344 } ); 2345 2346 this.mouseMoveFunc = this.mouseMove.bind( this ); 2347 $( document.body ).on( 'mousemove', this.mouseMoveFunc ); 2348 }, 2349 mouseMove: function( e ) { 2350 if ( this.$elClone.length && this.$elClone.closest( 'html' ).length ) { 2351 gsap.to( '.thumb-info-floating-element-clone', 0.5, { 2352 css: { 2353 left: e.clientX + parseInt( this.options.offset ), 2354 top: e.clientY + parseInt( this.options.offset ) 2355 } 2356 } ); 2357 } 2358 }, 2359 mouseOut: function( e ) { 2360 if ( this.$elClone.length && this.$elClone.closest( 'html' ).length ) { 2361 gsap.to( '.thumb-info-floating-element-clone', 0.5, { 2362 css: { 2363 scaleX: 0.5, 2364 scaleY: 0.5, 2365 opacity: 0 2366 } 2367 } ); 2368 } 2369 }, 2370 clearData: function( e ) { 2371 this.$elClone.remove(); 2372 this.$el.off( 'mouseenter', this.mouseEnterFunc ); 2373 this.$el.off( 'mouseout', this.mouseOutFunc ); 2374 $( document.body ).off( 'mousemove', this.mouseMoveFunc ); 2375 } 2376 } 2377 2378 $.extend( theme, { 2379 PluginTElFloaing: PluginTElFloaing 2380 } ); 2381 $.fn.themePluginTIFloating = function() { 2382 if ( typeof gsap !== 'undefined' ) { 2383 return this.map( function() { 2384 var $this = $( this ); 2385 if ( $this.data( instanceName ) ) { 2386 return $this.data( instanceName ); 2387 } else { 2388 return new PluginTElFloaing( $this, $this.data( 'plugin-tfloating' ) ); 2389 } 2390 } ); 2391 } else { 2392 return false; 2393 } 2394 } 2395} ).apply( this, [window.theme, jQuery] ); 2396 2397/* initialize */ 2398( function( theme, $ ) { 2399 theme.initAsync = function( $wrap, wrapObj ) { 2400 // Animate 2401 if ( $.fn.themeAnimate && typeof wrapObj != 'undefined' ) { 2402 2403 $( function() { 2404 var svgAnimates = wrapObj.querySelectorAll( 'svg [data-appear-animation]' ); 2405 if ( svgAnimates.length ) { 2406 $( svgAnimates ).closest( 'svg' ).attr( 'data-appear-animation-svg', '1' ); 2407 } 2408 var $animates = wrapObj.querySelectorAll( '[data-plugin-animate], [data-appear-animation], [data-appear-animation-svg]' ); 2409 if ( $animates.length ) { 2410 var animateResize = function() { 2411 if ( window.innerWidth < 768 ) { 2412 window.removeEventListener( 'resize', animateResize );
2413 $animates.forEach( function( o ) { 2414 o.classList.add( 'appear-animation-visible' ); 2415 } ); 2416 } 2417 }; 2418 if ( theme.animation_support ) { 2419 window.addEventListener( 'resize', animateResize ); 2420 theme.dynIntObsInit( $animates, 'themeAnimate', theme.Animate.defaults ); 2421 } else { 2422 $animates.forEach( function( o ) { 2423 o.classList.add( 'appear-animation-visible' ); 2424 } ); 2425 } 2426 } 2427 } ); 2428 } 2429 2430 // Animated Letters 2431 if ( $.fn.themePluginAnimatedLetters ) { 2432 if ( $( '[data-plugin-animated-letters]' ).length || $( '.animated-letters' ).length ) { 2433 theme.intObs( '[data-plugin-animated-letters]:not(.manual), .animated-letters', 'themePluginAnimatedLetters' ); 2434 } 2435 if ( $( '[data-plugin-animated-words]' ).length || $( '.animated-words' ).length ) { 2436 theme.intObs( '[data-plugin-animated-words]:not(.manual), .animated-words', 'themePluginAnimatedLetters' ); 2437 } 2438 } 2439 2440 // Carousel 2441 if ( $.fn.themeCarousel ) { 2442 2443 $( function() { 2444 2445 var portoImgNavMiddle = function ( $el ) { 2446 var $images = $el.find( '.owl-item img' ), 2447 height = 0; 2448 for ( var i = 0; i < $images.length; i++) { 2449 var imgHeight = $images.eq(i).height(); 2450 if ( height < imgHeight ) { 2451 height = imgHeight; 2452 } 2453 } 2454 if ( $el.hasClass( 'products-slider' ) ) { 2455 $el.children( '.owl-nav' ).css( 'top', ( 5 + height / 2 ) + 'px' ); 2456 } else { 2457 $el.children( '.owl-nav' ).css( 'top', height / 2 + 'px' ); 2458 } 2459 }; 2460 // Carousel Lazyload images 2461 var portoCarouselInit = function( e ) { 2462 var $this = $( e.currentTarget ); 2463 2464 $this.find( '[data-appear-animation]:not(.appear-animation)' ).addClass( 'appear-animation' ); 2465 if ( $this.find( '.owl-item.cloned' ).length ) { 2466 // compatibility with W3 Total Cache 2467 var $not_loaded = $this.find( 'img.lazy:not(.loaded)' ); 2468 if ( $not_loaded.length ) { 2469 if (typeof window.w3tc_lazyload == 'object') { 2470 window.w3tc_lazyload.update(); 2471 } else if (theme.w3tcLazyLoadInstance) { 2472 theme.w3tcLazyLoadInstance.update(); 2473 } 2474 } 2475 2476 $this.find( '.porto-lazyload:not(.lazy-load-loaded)' ).themePluginLazyLoad( { effect: 'fadeIn', effect_speed: 400 } ); 2477 var $animates = e.currentTarget.querySelectorAll( '.appear-animation' ); 2478 if ( $animates.length ) { 2479 if ( theme.animation_support ) { 2480 theme.dynIntObsInit( $animates, 'themeAnimate', theme.Animate.defaults ); 2481 } else {
2482 $animates.forEach( function( o ) { 2483 o.classList.add( 'appear-animation-visible' ); 2484 } ); 2485 } 2486 } 2487 if ( $.fn.themePluginAnimatedLetters && ( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ).length ) ) { 2488 theme.dynIntObsInit( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ), 'themePluginAnimatedLetters' ); 2489 } 2490 } 2491 2492 setTimeout( function() { 2493 var $hiddenItems = $this.find( '.owl-item:not(.active)' ); 2494 if ( theme.animation_support ) { 2495 $hiddenItems.find( '.appear-animation' ).removeClass( 'appear-animation-visible' ); 2496 $hiddenItems.find( '.appear-animation' ).each( function() { 2497 var $el = $( this ), 2498 delay = Math.abs( $el.data( 'appear-animation-delay' ) ? $el.data( 'appear-animation-delay' ) : 0 ); 2499 if ( delay > 1 ) { 2500 this.style.animationDelay = delay + 'ms'; 2501 } 2502 2503 var duration = Math.abs( $el.data( 'appear-animation-duration' ) ? $el.data( 'appear-animation-duration' ) : 1000 ); 2504 if ( 1000 != duration ) { 2505 this.style.animationDuration = duration + 'ms'; 2506 } 2507 } ); 2508 } 2509 if ( window.innerWidth >= 1200 ) { 2510 $hiddenItems.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' ); 2511 } 2512 // Position the navigation in the middle of the image 2513 if ( $this.hasClass( 'nav-center-images-only' ) ) { 2514 portoImgNavMiddle( $this ); 2515 } 2516 }, 300 ); 2517 }; 2518 var portoCarouselTranslated = function( e ) { 2519 var $this = $( e.currentTarget ); 2520 /*if ( window.innerWidth > 767 ) { 2521 if ( $this.find( '.owl-item.cloned' ).length && $this.find( '.appear-animation:not(.appear-animation-visible)' ).length ) { 2522 $( document.body ).trigger( 'appear_refresh' ); 2523 } 2524 }*/ 2525 2526 var $active = $this.find( '.owl-item.active' ); 2527 if ( $active.hasClass( 'translating' ) ) { 2528 $active.removeClass( 'translating' ); 2529 return; 2530 } 2531 $this.find( '.owl-item.translating' ).removeClass( 'translating' ); 2532 // Animated Letters 2533 $this.find( '[data-plugin-animated-letters]' ).removeClass( 'invisible' ); 2534 $this.find( '.owl-item.active [data-plugin-animated-letters]' ).trigger( 'animated.letters.initialize' ); 2535 2536 if ( window.innerWidth > 767 ) { 2537 // WPBakery 2538 $this.find( '.appear-animation' ).removeClass( 'appear-animation-visible' ); 2539 $active.find( '.appear-animation' ).each( function() { 2540 var $animation_item = $( this ), 2541 anim_name = $animation_item.data( 'appear-animation' ); 2542 $animation_item.addClass( anim_name + ' appear-animation-visible' ); 2543 } ); 2544 } 2545 2546 // sticky sidebar 2547 if ( window.innerWidth > 991 ) { 2548 if ( $this.closest( '[data-plugin-sticky]' ).length ) { 2549 theme.refreshStickySidebar( false, $this.closest( '[data-plugin-sticky]' ) ); 2550 } 2551 } 2552 2553 // Elementor 2554 $active.find( '.slide-animate' ).each( function() { 2555 var $animation_item = $( this ), 2556 settings = $animation_item.data( 'settings' ); 2557 if ( settings && ( settings._animation || settings.animation ) ) { 2558 var animation = settings._animation || settings.animation, 2559 delay = settings._animation_delay || settings.animation_delay || 0; 2560 theme.requestTimeout( function() { 2561 $animation_item.removeClass( 'elementor-invisible' ).addClass( 'animated ' + animation ); 2562 }, delay ); 2563 } 2564 } ); 2565 2566 // Visual Composer 2567 if ( window.innerWidth >= 1200 ) { 2568 $this.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' ).removeAttr( 'data-vcv-o-animated-fully' ); 2569 $active.find( '[data-vce-animate]' ).each( function() { 2570 var $animation_item = $( this ); 2571 if ( $animation_item.data( 'porto-origin-anim' ) ) { 2572 var anim_name = $animation_item.data( 'porto-origin-anim' ); 2573 $animation_item.attr( 'data-vce-animate', anim_name ).attr( 'data-vcv-o-animated', true ); 2574 var duration = parseFloat( window.getComputedStyle( this )['animationDuration'] ) * 1000,
2575 delay = parseFloat( window.getComputedStyle( this )['animationDelay'] ) * 1000; 2576 window.setTimeout( function() { 2577 $animation_item.attr( 'data-vcv-o-animated-fully', true ); 2578 }, delay + duration + 5 ); 2579 } 2580 } ); 2581 } 2582 }; 2583 var portoCarouselTranslateVC = function( e ) { 2584 var $this = $( e.currentTarget ); 2585 $this.find( '.owl-item.active' ).addClass( 'translating' ); 2586 2587 if ( window.innerWidth >= 1200 ) { 2588 $this.find( '[data-vce-animate]' ).each( function() { 2589 var $animation_item = $( this ); 2590 $animation_item.data( 'porto-origin-anim', $animation_item.data( 'vce-animate' ) ).attr( 'data-vce-animate', '' ); 2591 } ); 2592 } 2593 }; 2594 var portoCarouselTranslateElementor = function( e ) { 2595 var $this = $( e.currentTarget ); 2596 $this.find( '.owl-item.active' ).addClass( 'translating' ); 2597 $this.find( '.owl-item:not(.active) .slide-animate' ).addClass( 'elementor-invisible' ); 2598 $this.find( '.slide-animate' ).each( function() { 2599 var $animation_item = $( this ), 2600 settings = $animation_item.data( 'settings' ); 2601 if ( settings._animation || settings.animation ) { 2602 $animation_item.removeClass( settings._animation || settings.animation ); 2603 } 2604 } ); 2605 }; 2606 var portoCarouselTranslateWPB = function( e ) { 2607 if ( window.innerWidth > 767 ) { 2608 var $this = $( e.currentTarget ); 2609 $this.find( '.owl-item.active' ).addClass( 'translating' ); 2610 $this.find( '.appear-animation' ).each( function() { 2611 var $animation_item = $( this ); 2612 $animation_item.removeClass( $animation_item.data( 'appear-animation' ) ); 2613 } ); 2614 } 2615 }; 2616 2617 var carouselItems = $wrap.find( '.owl-carousel:not(.manual)' ); 2618 carouselItems.on( 'initialized.owl.carousel refreshed.owl.carousel', portoCarouselInit ).on( 'translated.owl.carousel', portoCarouselTranslated ); 2619 carouselItems.on( 'translate.owl.carousel', function() { 2620 // Hide elements inside carousel 2621 $( this ).find( '[data-plugin-animated-letters]' ).addClass( 'invisible' ); 2622 // Animated Letters 2623 $( this ).find( '[data-plugin-animated-letters]' ).trigger( 'animated.letters.destroy' ); 2624 } ); 2625 carouselItems.on( 'resized.owl.carousel', function () { 2626 var $this = $( this ); 2627 // Position the navigation in the middle of the image 2628 if ( $this.hasClass( 'nav-center-images-only' ) ) { 2629 portoImgNavMiddle( $this ); 2630 } 2631 } ) 2632 carouselItems.filter( function() { 2633 if ( $( this ).find( '[data-vce-animate]' ).length ) { 2634 return true; 2635 } 2636 return false; 2637 } ).on( 'translate.owl.carousel', portoCarouselTranslateVC ); 2638 carouselItems.filter( function() { 2639 var $anim_obj = $( this ).find( '.elementor-invisible' ); 2640 if ( $anim_obj.length ) { 2641 $anim_obj.addClass( 'slide-animate' ); 2642 return true; 2643 } 2644 return false; 2645 } ).on( 'translate.owl.carousel', portoCarouselTranslateElementor ); 2646 carouselItems.filter( function() { 2647 if ( $( this ).find( '.appear-animation, [data-appear-animation]' ).length ) { 2648 return true; 2649 } 2650 return false; 2651 } ).on( 'translate.owl.carousel', portoCarouselTranslateWPB ); 2652 2653 $wrap.find( '[data-plugin-carousel]:not(.manual), .porto-carousel:not(.manual)' ).each( function() { 2654 var $this = $( this ), 2655 opts; 2656 if ( $this.closest( '.tab-pane' ).length && ! $this.closest( '.tab-pane' ).hasClass( 'active' ) ) { 2657 return; 2658 } 2659 if ( $this.closest( '.e-n-tabs-content > .e-con' ).length && ! $this.closest( '.e-n-tabs-content > .e-con' ).hasClass( 'e-active' ) ) { 2660 return; 2661 } 2662 if ( $this.closest( '.sidebar-menu:not(.side-menu-accordion) .menu-block' ).length ) { 2663 return; 2664 } 2665 var pluginOptions = $this.data( 'plugin-options' ); 2666 if ( pluginOptions ) 2667 opts = pluginOptions; 2668 2669 setTimeout( function() { 2670 $this.themeCarousel( opts ); 2671 }, 0 ); 2672 } ); 2673 } ); 2674 2675 } 2676 2677 // Thumb Gallery
2678 $wrap.find( '.thumb-gallery-thumbs, .thumbnail-gallery' ).each( function() { 2679 var $thumbs = $( this ), 2680 $detail = $thumbs.parent().find( '.thumb-gallery-detail' ), 2681 flag = false, 2682 duration = 300; 2683 2684 if ( $thumbs.data( 'initThumbs' ) ) 2685 return; 2686 2687 $detail.on( 'changed.owl.carousel', function( e ) { 2688 if ( !flag ) { 2689 flag = true; 2690 var len = $detail.find( '.owl-item' ).length, 2691 cloned = $detail.find( '.cloned' ).length; 2692 if ( len ) { 2693 $thumbs.find( '.owl-item.selected' ).removeClass( 'selected' ); 2694 $thumbs.find( '.owl-item' ).eq( ( e.item.index - cloned / 2 ) % len ).addClass( 'selected' ); 2695 $thumbs.trigger( 'to.owl.carousel', [( e.item.index - cloned / 2 - 1 ) % len, duration, true] ); 2696 } 2697 flag = false; 2698 } 2699 } ); 2700 2701 $thumbs.on( 'changed.owl.carousel', function( e ) { 2702 if ( !flag ) { 2703 flag = true; 2704 var len = $thumbs.find( '.owl-item' ).length, 2705 cloned = $thumbs.find( '.cloned' ).length; 2706 if ( len ) { 2707 $thumbs.find( '.owl-item.selected' ).removeClass( 'selected' ); 2708 $thumbs.find( '.owl-item' ).eq( e.item.index ).addClass( 'selected' ); 2709 $detail.trigger( 'to.owl.carousel', [( e.item.index - cloned / 2 ) % len, duration, true] ); 2710 } 2711 flag = false; 2712 } 2713 } ).on( 'click', '.owl-item', function() { 2714 if ( !flag ) { 2715 flag = true; 2716 var len = $thumbs.find( '.owl-item' ).length, 2717 cloned = $thumbs.find( '.cloned' ).length; 2718 if ( len ) { 2719 $thumbs.find( '.owl-item.selected' ).removeClass( 'selected' ); 2720 $(this).addClass( 'selected' ); 2721 $detail.trigger( 'to.owl.carousel', [( $( this ).index() - cloned / 2 ) % len, duration, true] ); 2722 } 2723 flag = false; 2724 } 2725 } ).data( 'initThumbs', true ); 2726 } ); 2727 2728 // Fixed video 2729 $wrap.find( '.video-fixed' ).each( function() { 2730 var $this = $( this ), 2731 $video = $this.find( 'video, iframe' ); 2732 2733 if ( $video.length ) { 2734 window.addEventListener( 'scroll', function() { 2735 var offset = $( window ).scrollTop() - $this.position().top + theme.adminBarHeight(); 2736 $video.css( "cssText", "top: " + offset + "px !important;" ); 2737 }, { passive: true } ); 2738 } 2739 } ); 2740 2741 setTimeout( function() { 2742 // Search 2743 if ( typeof theme.Search !== 'undefined' ) { 2744 theme.Search.initialize(); 2745 } 2746 }, 0 ); 2747 2748 }; 2749 2750 $( document.body ).trigger( 'porto_async_init' ); 2751} ).apply( this, [window.theme, jQuery] ); 2752 2753jQuery( document ).ready( function( $ ) { 2754 'use strict'; 2755 2756 // Visual Composer Image Zoom 2757 if ( $.fn.themeVcImageZoom ) { 2758 2759 $( function() { 2760 var $galleryParent = null; 2761 $( '.porto-vc-zoom:not(.manual)' ).each( function() { 2762 var $this = $( this ), 2763 opts, 2764 gallery = $this.attr( 'data-gallery' ); 2765 2766 var pluginOptions = $this.data( 'plugin-options' ); 2767 if ( pluginOptions ) 2768 opts = pluginOptions; 2769 2770 if ( typeof opts == "undefined" ) { 2771 opts = {}; 2772 } 2773 opts.container = $this.parent(); 2774 2775 if ( gallery == 'true' ) { 2776 var container = 'vc_row'; 2777 2778 if ( $this.attr( 'data-container' ) ) 2779 container = $this.attr( 'data-container' ); 2780 2781 var $parent = $( $this.closest( '.' + container ).get( 0 ) ); 2782 if ( $parent.length > 0 && $galleryParent != null && $galleryParent.is( $parent ) ) { 2783 return; 2784 } else if ( $parent.length > 0 ) { 2785 $galleryParent = $parent; 2786 } 2787 if ( $galleryParent != null && $galleryParent.length > 0 ) { 2788 opts.container = $galleryParent; 2789 } 2790 } 2791 2792 $this.themeVcImageZoom( opts ); 2793 } ); 2794 } ); 2795 } 2796 2797 function porto_modal_open( $this ) { 2798 var trigger = $this.data( 'trigger-id' ), 2799 overlayClass = $this.data( 'overlay-class' ), 2800 extraClass = $this.data( 'extra-class' ) ? $this.data( 'extra-class' ) : '', 2801 type = $this.data( 'type' ); 2802 if ( typeof trigger != 'undefined'/* && $('#' + escape(trigger)).length > 0*/ ) { 2803 if ( typeof type == 'undefined' ) { 2804 type = 'inline'; 2805 } 2806 if ( type == 'inline' ) { 2807 trigger = '#' + escape( trigger ); 2808 } 2809 var args = { 2810 items: { 2811 src: trigger 2812 }, 2813 type: type, 2814 mainClass: extraClass, 2815 prependTo: $( '.page-wrapper' ) 2816 }; 2817 var $popupModal = $this; 2818 if ( $this.hasClass( 'porto-onload' ) || $this.hasClass( 'porto-exit-intent' ) ) { 2819 args['callbacks'] = { 2820 'beforeClose': function() { 2821 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' ) ) ) { 2822 $.cookie( 'porto_modal_disable_onload', 'true', { expires: 7 } ); 2823 } else if ( 'undefined' !== typeof $popupModal.data( 'expired' ) && 'undefined' !== typeof $popupModal.data( 'popup-id' ) ) { 2824 $.cookie( 'porto_modal_disable_period_onload_' + $popupModal.data( 'popup-id' ), $popupModal.data('expired'), { expires: $popupModal.data('expired') } ); 2825 } 2826 }, 2827 'afterClose': function() { 2828 // If minicart(cart, wishlist) opened, keep disabling mouse scrolling 2829 if ( $( '#header .minicart-opened' ).length ) { 2830 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', theme.getScrollbarWidth() ); 2831 $( 'html' ).css( 'overflow', 'hidden' ); 2832 } 2833 }, 2834 'open': function () { 2835 // Update bootstrap tooltip for Popup 2836 var $popup_builder = $( '.mfp-wrap .porto-block[data-bs-original-title]' ); 2837 if ( $popup_builder.length ) { 2838 bootstrap.Tooltip.getInstance( $popup_builder[0] ).update(); 2839 } 2840 if ( $( '.mfp-wrap .porto-block .owl-carousel' ) ) { 2841 $( '.mfp-wrap .porto-block .owl-carousel' ).trigger( 'refresh.owl.carousel' ); 2842 } 2843 } 2844 }; 2845 } 2846 if ( typeof overlayClass != "undefined" && overlayClass ) { 2847 args.mainClass += escape( overlayClass ); 2848 } 2849 setTimeout( () => { 2850 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, args ), 0 ); 2851 } ); 2852 2853 } 2854 } 2855 theme.porto_modal_open = porto_modal_open; 2856 function porto_init_magnific_popup_functions( $wrap ) { 2857 if ( typeof $wrap == 'undefined' || !$wrap.length ) { 2858 $wrap = $( document.body ); 2859 } 2860 $wrap.find( '.lightbox:not(.manual)' ).each( function() { 2861 var $this = $( this ), 2862 opts; 2863 if ( $this.find( '>.lb-dataContainer' ).length ) { 2864 return; 2865 } 2866 var pluginOptions = $this.data( 'lightbox-options' ); 2867 if ( pluginOptions ) { 2868 opts = pluginOptions; 2869 } else { 2870 pluginOptions = $this.data( 'plugin-options' ); 2871 if ( typeof pluginOptions != 'object' ) { 2872 pluginOptions = JSON.parse( pluginOptions ); 2873 } 2874 if ( pluginOptions ) { 2875 opts = pluginOptions; 2876 } 2877 } 2878 2879 $this.themeLightbox( opts ); 2880 } ); 2881 2882 // Popup with video or map 2883 $wrap.find( '.porto-popup-iframe' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 2884 disableOn: 700, 2885 type: 'iframe', 2886 mainClass: 'mfp-fade', 2887 removalDelay: 160, 2888 preloader: false,
2889 fixedContentPos: false 2890 } ) ); 2891 2892 // Popup with ajax 2893 $wrap.find( '.porto-popup-ajax' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 2894 type: 'ajax' 2895 } ) ); 2896 2897 // Popup with content 2898 $wrap.find( '.porto-popup-content' ).each( function() { 2899 var animation = $( this ).attr( 'data-animation' ); 2900 $( this ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 2901 type: 'inline', 2902 fixedContentPos: false, 2903 fixedBgPos: true, 2904 overflowY: 'auto', 2905 closeBtnInside: true, 2906 preloader: false, 2907 midClick: true, 2908 removalDelay: 300, 2909 mainClass: animation 2910 } ) ); 2911 } ); 2912 2913 // Porto Modal 2914 $wrap.find( '.popup-youtube, .popup-vimeo, .popup-gmaps' ).each( function( index ) { 2915 var overlayClass = $( this ).find( '.porto-modal-trigger' ).data( 'overlay-class' ), 2916 args = { 2917 type: 'iframe', 2918 removalDelay: 160, 2919 preloader: false, 2920 2921 fixedContentPos: false 2922 }; 2923 if ( typeof overlayClass != "undefined" && overlayClass ) { 2924 args.mainClass = escape( overlayClass ); 2925 } 2926 $( this ).magnificPopup( args ); 2927 } ); 2928 2929 if ( $wrap.find( '.porto-modal-trigger.porto-onload' ).length ) { 2930 var $obj = $wrap.find( '.porto-modal-trigger.porto-onload' ).eq( 0 ), 2931 timeout = 0; 2932 if ( $obj.data( 'timeout' ) ) { 2933 timeout = parseInt( $obj.data( 'timeout' ), 10 ); 2934 } 2935 setTimeout( function() { 2936 porto_modal_open( $obj ); 2937 }, timeout ); 2938 } 2939 $wrap.on( 'click', '.porto-modal-trigger', function( e ) { 2940 e.preventDefault(); 2941 porto_modal_open( $( this ) ); 2942 } ); 2943 2944 /* Woocommerce */ 2945 // login popup 2946 if ( $wrap.hasClass( 'login-popup' ) ) { 2947 $wrap.find( '.porto-link-login, .porto-link-register' ).magnificPopup( { 2948 items: { 2949 src: theme.ajax_url + ( -1 === theme.ajax_url.indexOf( '?' ) ? '?' : '&' ) + 'action=porto_account_login_popup&nonce=' + js_porto_vars.porto_nonce, 2950 type: 'ajax' 2951 }, 2952 tLoading: '<i class="porto-loading-icon"></i>', 2953 callbacks: { 2954 ajaxContentAdded: function() { 2955 $( window ).trigger( 'porto_login_popup_opened' ); 2956 } 2957 } 2958 } ); 2959 } 2960 2961 if ( typeof PhotoSwipe != 'undefined' ) { 2962 let _images = $wrap.find( '.product-images' ), links = [], i = 0; 2963 _images.find( 'img' ).each( function() { 2964 var slide = {}; 2965 2966 slide.src = $( this ).attr( 'href' ); 2967 slide.title = $( this ).attr( 'alt' ); 2968 slide.w = parseInt( $( this ).attr( 'data-large_image_width' ) ); 2969 slide.h = parseInt( $( this ).attr( 'data-large_image_height' ) ); 2970 2971 links[i] = slide; 2972 i++; 2973 } ); 2974 _images.data( 'links', links ); 2975 _images.on( 'click', '.img-thumbnail a.zoom', function( e ) { 2976 e.preventDefault(); 2977 var options = $.extend( { 2978 index: $( this ).closest( '.img-thumbnail' ).index(), 2979 addCaptionHTMLFn: function( item, captionEl ) { 2980 if ( ! item.title ) { 2981 captionEl.children[0].textContent = ''; 2982 return false; 2983 } 2984 captionEl.children[0].textContent = item.title; 2985 return true; 2986 } 2987 }, wc_single_product_params.photoswipe_options ); 2988 2989 // Initializes and opens PhotoSwipe. 2990 var photoswipe = new PhotoSwipe( $( '.pswp' )[0], PhotoSwipeUI_Default, _images.data( 'links' ), options ); 2991 photoswipe.init(); 2992 } ); 2993 2994 2995 } else { 2996 $wrap.find( '.product-images' ).magnificPopup( 2997 $.extend( true, {}, theme.mfpConfig, { 2998 delegate: '.img-thumbnail a.zoom', 2999 type: 'image', 3000 gallery: { enabled: true } 3001 } ) 3002 ); 3003 } 3004 $wrap.find( '.porto-posts-grid' ).each( function() { 3005 $( this ).magnificPopup( 3006 $.extend( true, {}, theme.mfpConfig, { 3007 delegate: '.porto-tb-featured-image span.zoom, .porto-tb-featured-image a.zoom, .post-image span.zoom', 3008 type: 'image', 3009 gallery: { enabled: true } 3010 } ) 3011 ); 3012 } ); 3013 $wrap.find( '.porto-posts-grid .tb-image-type-slider div.zoom' ).each( function() { 3014 var $this = $( this ), 3015 links = []; 3016 $this.find( 'a' ).each( function() { 3017 var slide = {}; 3018 slide.src = $( this ).attr( 'href' ); 3019 slide.title = $( this ).attr( 'title' ); 3020 links.push( slide ); 3021 } ); 3022 if ( links.length ) { 3023 $this.on( 'click', function() { 3024 var $slider = $this.siblings( '.porto-carousel' ); 3025 if ( $slider.length ) { 3026 var offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2; 3027 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 3028 items: links, 3029 gallery: { 3030 enabled: true 3031 }, 3032 type: 'image' 3033 } ), offset ); 3034 } 3035 } ); 3036 } 3037 } ); 3038 } 3039 3040 if ( $.fn.magnificPopup ) { 3041 porto_init_magnific_popup_functions(); 3042 } else { 3043 setTimeout( function() { 3044 if ( $.fn.magnificPopup ) { 3045 porto_init_magnific_popup_functions(); 3046 } 3047 }, 500 ); 3048 } 3049 $( document.body ).on( 'porto_load_posts_end', function( e, $posts_wrap ) { 3050 if ( $.fn.magnificPopup ) { 3051 porto_init_magnific_popup_functions( $posts_wrap ); 3052 } 3053 } ); 3054 3055 3056 // Post Filter
3057 if ( typeof theme.PostFilter !== 'undefined' ) { 3058 var $postFilterElements = $( 'ul[data-filter-type], .portfolio-filter, .member-filter, .faq-filter, .porto-ajax-filter.product-filter, .porto-ajax-filter.post-filter' ); 3059 if ( $postFilterElements.length ) { 3060 theme.PostFilter.initialize( $postFilterElements ); 3061 } 3062 } 3063 3064 // Post ajax pagination 3065 $( 'body' ).on( 'click', '.porto-ajax-load .pagination:not(.load-more) .page-numbers', function( e ) { 3066 var $this = $( this ); 3067 if ( $this.hasClass( 'current' ) || $this.hasClass( 'dots' ) ) { 3068 return; 3069 } 3070 e.preventDefault(); 3071 var $wrap = $this.closest( '.porto-ajax-load' ), 3072 post_type = $wrap.data( 'post_type' ), 3073 $obj = $wrap.find( '.' + post_type + 's-container' ); 3074 3075 if ( !$obj.length || $wrap.hasClass( 'loading' ) ) { 3076 return; 3077 } 3078 $wrap.addClass( 'loading' ); 3079 var $filter = $wrap.find( '.porto-ajax-filter' ), 3080 cat = $filter.length && $filter.children( '.active' ).length && $filter.children( '.active' ).data( 'filter' ); 3081 if ( '*' == cat ) { 3082 cat = ''; 3083 } 3084 var default_args = {}, 3085 page = $this.attr( 'href' ).match( /paged=(\d+)|page\/(\d+)/ ); 3086 3087 if ( page && Array.isArray( page ) && ( page[1] || page[2] ) ) { 3088 default_args['page'] = parseInt( page[1] || page[2] ); 3089 } else { 3090 if ( $this.hasClass( 'prev' ) ) { 3091 default_args['page'] = parseInt( $this.next().text() ); 3092 } else if ( $this.hasClass( 'next' ) ) { 3093 default_args['page'] = parseInt( $this.prev().text() ); 3094 } else { 3095 default_args['page'] = parseInt( $this.text() ); 3096 } 3097 } 3098 if ( cat == '' && $wrap.find( 'input[type=hidden].category' ).length ) { 3099 cat = $wrap.find( 'input[type=hidden].category' ).val(); 3100 default_args['taxonomy'] = $wrap.find( 'input[type=hidden].taxonomy' ).val(); 3101 } 3102 theme.PostFilter.load_posts( cat, $wrap.hasClass( 'load-infinite' ), $wrap, post_type, $obj, default_args, $this.attr( 'href' ) ); 3103 3104 } ); 3105 3106 3107 // Filter Zooms 3108 if ( typeof theme.FilterZoom !== 'undefined' ) { 3109 // Portfolio Filter Zoom 3110 theme.FilterZoom.initialize( $( '.page-portfolios' ) ); 3111 // Member Filter Zoom 3112 theme.FilterZoom.initialize( $( '.page-members' ) ); 3113 // Posts Related Style Filter Zoom 3114 theme.FilterZoom.initialize( $( '.blog-posts-related' ) ); 3115 } 3116 3117 // Image Hover Overlay on Posts Grid widget 3118 function portoSetHoverImage( $this, enter = true ) { 3119 var $item = $this.find( '[data-hoverlay-image]' ), 3120 $postsGrid = $this.closest( '.porto-posts-grid' ); 3121 if ( $item.length ) { 3122 var $target = $postsGrid.find( '#himg-' + $item.data( 'hoverlay-id' ) ); 3123 if ( enter ) { 3124 $target.addClass( 'active' ); 3125 $postsGrid.addClass( 'active' ); 3126 } else { 3127 $target.removeClass( 'active' ); 3128 $postsGrid.removeClass( 'active' ); 3129 } 3130 } 3131 } 3132 3133 function InsertHoverImage( $this ) { 3134 var $option = $this.data( 'hoverlay-image' ), 3135 $postsGrid = $this.closest( '.porto-posts-grid' ), 3136 $postsWrap = $this.closest( '.posts-wrap' ); 3137 3138 // Overlay Image 3139 $postsGrid.append( '<div class="thumb-info-full" style="background-image: url(' + $option.src + '); --porto-himg-height:' + $postsWrap.innerHeight() + 'px;" id="himg-' + $option.id + '"></div>' ); 3140 $postsGrid.addClass( 'image-hover-overlay' ); 3141 3142 3143 // Resize 3144 if ( $postsWrap.hasClass( 'owl-carousel' ) ) { 3145 $postsWrap.on( 'refreshed.owl.carousel resized.owl.carousel', function() { 3146 $postsGrid.find( '.thumb-info-full' ).css( '--porto-himg-height', ( $postsWrap.innerHeight() + 'px' ) ); 3147 } ) 3148 } else { 3149 $( window ).on( 'resize', function() { 3150 $postsGrid.find( '.thumb-info-full' ).css( '--porto-himg-height', ( $postsWrap.innerHeight() + 'px' ) ); 3151 } ); 3152 } 3153 3154 // Hover 3155 $( '.image-hover-overlay' ).on( 'mouseenter touchstart', '.porto-tb-item', function( e ) { 3156 portoSetHoverImage( $( this ) ); 3157 } ); 3158 $( '.image-hover-overlay' ).on( 'mouseleave touchend', '.porto-tb-item', function( e ) { 3159 portoSetHoverImage( $( this ), false ); 3160 } ); 3161 } 3162 3163 // expose to scope 3164 $.extend( theme, { 3165 InsertHoverImage: InsertHoverImage 3166 } ); 3167 3168 $( '.porto-posts-grid [data-hoverlay-image]' ).each( function() { 3169 theme.InsertHoverImage( $( this ) ); 3170 } ); 3171 3172 // close popup using esc key 3173 var $minicart_offcanvas = $( '.minicart-offcanvas' ), 3174 $wl_offcanvas = $( '.wishlist-offcanvas' ), 3175 $mobile_sidebar = $( '.mobile-sidebar' ), 3176 $mobile_panel = $( '#side-nav-panel' ), 3177 $overlay_search = $( '#header .btn-close-search-form' ), 3178 $html = $( 'html' ); 3179 if ( $minicart_offcanvas.length || $wl_offcanvas.length || $mobile_sidebar.length || $mobile_panel.length || $( '.skeleton-loading' ).length || $overlay_search.length ) { 3180 $( document.documentElement ).on( 'keyup', function( e ) { 3181 try { 3182 if ( e.keyCode == 27 ) { 3183 $minicart_offcanvas.removeClass( 'minicart-opened' ); 3184 $wl_offcanvas.removeClass( 'minicart-opened' ); 3185 if ( $mobile_sidebar.length ) { 3186 $html.removeClass( 'filter-sidebar-opened' ); 3187 $html.removeClass( 'sidebar-opened' ); 3188 $( '.sidebar-overlay' ).removeClass( 'active' ); 3189 $( 'html' ).css( 'overflow', '' ); 3190 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', '' ); 3191 } 3192 if ( $mobile_panel.length && $html.hasClass( 'panel-opened' ) ) { 3193 $html.removeClass( 'panel-opened' ); 3194 $( '.panel-overlay' ).removeClass( 'active' ); 3195 } 3196 if ( $overlay_search.length ) { 3197 $overlay_search.trigger( 'click' ); 3198 } 3199 } 3200 } catch ( err ) { } 3201 } ); 3202 $( '.skeleton-loading' ).on( 'skeleton-loaded', function() { 3203 $mobile_sidebar = $( '.mobile-sidebar' ); 3204 } ); 3205 } 3206 3207 // Mouse Parallax 3208 if ( $.fn.themeMouseparallax ) { 3209 $( function() { 3210 $( '[data-plugin="mouse-parallax"]' ).each( function() { 3211 var $this = $( this ), 3212 opts; 3213 if ( $this.data( 'parallax' ) ) { 3214 $this.parallax( 'disable' ); 3215 $this.removeData( 'parallax' ); 3216 $this.removeData( 'options' ); 3217 } 3218 if ( $this.hasClass( 'elementor-element' ) ) { 3219 $this.children( '.elementor-widget-container, .elementor-container, .elementor-widget-wrap, .elementor-column-wrap' ).addClass( 'layer' ).attr( 'data-depth', $this.attr( 'data-floating-depth' ) ); 3220 } else { 3221 $this.children( '.layer' ).attr( 'data-depth', $this.attr( 'data-floating-depth' ) ); 3222 } 3223 3224 var pluginOptions = $this.data( 'options' ); 3225 if ( pluginOptions ) 3226 opts = pluginOptions; 3227 3228 $this.themeMouseparallax( opts ); 3229 } ); 3230 } ); 3231 } 3232 3233 if ( $.fn['themePluginReadMore'] && $( '[data-plugin-readmore]' ).length ) { 3234 $( '[data-plugin-readmore]:not(.manual)' ).themePluginReadMore(); 3235 } 3236 3237 // Hover Split 3238 if ( $.fn.themePluginHoverSplit ) { 3239 $( '.mouse-hover-split' ).each( function() { 3240 var $this = $( this ), 3241 // Elmentor 3242 $splitSlide = $this.find( '>.split-slide' ); 3243 if ( $splitSlide.length >= 2 ) { 3244 $this.themePluginHoverSplit(); 3245 } 3246 } ); 3247 } 3248 3249 // Horizontal Scroller 3250 if ( $.fn.themePluginHScroller ) { 3251 // Horizontal Scroller 3252 $( '.horizontal-scroller-wrapper' ).each( function() { 3253 $( this ).themePluginHScroller( true ); 3254 } ); 3255 } 3256 3257 // Text Hover Floating Image 3258 if ( $.fn.themePluginTIFloating ) {
3259 $( '.thumb-info-floating-element-wrapper[data-plugin-tfloating]' ).each( function() { 3260 $( this ).themePluginTIFloating(); 3261 } ); 3262 } 3263} ); 3264 3265( function( theme, $ ) { 3266 // init wishlist off-canvas 3267 if ( $( '.wishlist-popup' ).length ) { 3268 var worker = null; 3269 3270 $( '.wishlist-offcanvas .my-wishlist' ).on( 'click', function( e ) { 3271 e.preventDefault(); 3272 var $this = $(this); 3273 $this.parent().toggleClass( 'minicart-opened' ); 3274 if ( $this.parent().hasClass( 'minicart-opened' ) ) { 3275 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', theme.getScrollbarWidth() ); 3276 $( 'html' ).css( 'overflow', 'hidden' ); 3277 } else { 3278 $( 'html' ).css( 'overflow', '' ); 3279 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', '' ); 3280 } 3281 } ); 3282 3283 $( '.wishlist-offcanvas .minicart-overlay' ).on( 'click', function() { 3284 $( this ).closest( '.wishlist-offcanvas' ).removeClass( 'minicart-opened' ); 3285 $( 'html' ).css( 'overflow', '' ); 3286 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', '' ); 3287 } ); 3288 3289 var init_wishlist = function() { 3290 worker = new Worker( js_porto_vars.ajax_loader_url.replace( '/images/[email protected]', '/js/woocommerce-worker.js' ) ); 3291 worker.onmessage = function( e ) { 3292 $( '.wishlist-popup' ).html( e.data ); 3293 }; 3294 worker.postMessage( { initWishlist: true, ajaxurl: theme.ajax_url, nonce: js_porto_vars.porto_nonce } ); 3295 }; 3296 3297 if ( theme && theme.isLoaded ) { 3298 setTimeout( function() { 3299 init_wishlist(); 3300 }, 100 ); 3301 } else { 3302 $( window ).on( 'load', function() { 3303 init_wishlist(); 3304 } ); 3305 } 3306 3307 // remove from wishlist 3308 $( '.wishlist-popup' ).on( 'click', '.remove_from_wishlist', function( e ) { 3309 e.preventDefault(); 3310 3311 var $this = $( this ), 3312 id = $this.attr( 'data-product_id' ), 3313 $table = $( '.wishlist_table #yith-wcwl-row-' + id + ' .remove_from_wishlist' ); 3314 3315 $this.closest( '.wishlist-item' ).find( '.ajax-loading' ).show(); 3316 3317 if ( $table.length ) { 3318 $table.trigger( 'click' ); 3319 } else { 3320 if ( typeof yith_wcwl_l10n !== 'undefined' ) { 3321 $.ajax( { 3322 url: yith_wcwl_l10n.ajax_url, 3323 data: { 3324 action: yith_wcwl_l10n.actions.remove_from_wishlist_action, 3325 remove_from_wishlist: id, 3326 nonce: typeof yith_wcwl_l10n.nonce !== 'undefined' ? yith_wcwl_l10n.nonce.remove_from_wishlist_nonce : '', 3327 from: 'theme' 3328 }, 3329 method: 'post', 3330 success: function( data ) { 3331 var $wcwlWrap = $( '.yith-wcwl-add-to-wishlist.add-to-wishlist-' + id ); 3332 if ( $wcwlWrap.length ) { 3333 var fragmentOptions = $wcwlWrap.data( 'fragment-options' ), 3334 $link = $wcwlWrap.find( 'a' ); 3335 if ( $link.length ) { 3336 if ( fragmentOptions.in_default_wishlist ) { 3337 delete fragmentOptions.in_default_wishlist; 3338 $wcwlWrap.attr( JSON.stringify( fragmentOptions ) ); 3339 } 3340 $wcwlWrap.removeClass( 'exists' ); 3341 $wcwlWrap.find( '.yith-wcwl-wishlistexistsbrowse' ).addClass( 'yith-wcwl-add-button' ).removeClass( 'yith-wcwl-wishlistexistsbrowse' ); 3342 $wcwlWrap.find( '.yith-wcwl-wishlistaddedbrowse' ).addClass( 'yith-wcwl-add-button' ).removeClass( 'yith-wcwl-wishlistaddedbrowse' ); 3343 $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 ); 3344 var text = $( '.single_add_to_wishlist' ).data( 'title' ); 3345 if ( !text ) { 3346 text = 'Add to wishlist'; 3347 } 3348 $link.attr( 'title', text ).attr( 'data-title', text ).addClass( 'add_to_wishlist single_add_to_wishlist' ).html( '<span>' + text + '</span>' ); 3349 } 3350 } 3351 $( document.body ).trigger( 'removed_from_wishlist' ); 3352 //$this.closest('.wishlist-item').remove(); 3353 } 3354 } ); 3355 } 3356 } 3357 } ); 3358 3359 $( document.body ).on( 'added_to_wishlist removed_from_wishlist', function( e ) { 3360 if ( worker ) { 3361 worker.postMessage( { loadWishlist: true, ajaxurl: theme.ajax_url, nonce: js_porto_vars.porto_nonce } ); 3362 } 3363 } ); 3364 } 3365 3366 // Hide Tooltip before adding to wishlist 3367 $( document ).on( 'yith_wcwl_add_to_wishlist_data', function( e, $el ) { 3368 if ( $el.length ) { 3369 $el.tooltip( 'hide' ); 3370 } 3371 } ); 3372 3373 // Content Collapse 3374 $( document ).on( 'click', '.content-collapse-wrap .btn-read-more-wrap', function ( e ) { 3375 e.preventDefault(); 3376 var $wrap = $( this ).closest( '.content-collapse-wrap' ); 3377 if ( $wrap.hasClass( 'opened' ) ) { 3378 $wrap.removeClass( 'opened' ); 3379 } else { 3380 $wrap.addClass( 'opened' ); 3381 } 3382 } ); 3383} ).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.