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