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