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 $( document ).on( 'focus', '.searchform-popup .text input', function (e) { 158 let $this = $( this ); 159 $this.trigger( 'porto_sh_before_open' ); 160 if ( $this.closest( '.searchform-popup' ).find( '.search-list:not(.search-history-list)' ).length ) { 161 $this.closest( '.searchform-popup' ).find( '.search-lists' ).addClass( 'show' ); 162 } 163 }); 164 165 return this; 166 }, 167 168 events: function() { 169 var self = this; 170 171 $( 'body' ).on( 'click', '.searchform-popup', function( e ) { 172 e.stopPropagation(); 173 } ); 174 $( 'body' ).off( 'click', '.searchform-popup .search-toggle' ).on( 'click', '.searchform-popup .search-toggle', function( e ) { 175 var $this = $( this ), 176 $form = $this.next(); 177 $this.toggleClass( 'opened' ); 178 if ( 'overlay' == self.form_layout ) { 179 $this.siblings( '.search-layout-overlay' ).addClass( 'show' ); 180 $( 'html' ).addClass( 'porto-search-opened porto-search-overlay-wrap' ); 181 $this.closest( '.vc_row.vc_row-flex>.vc_column_container>.vc_column-inner' ).css( 'z-index', '999' ); 182 } else if ( 'reveal' == self.form_layout ) { 183 self.parents = []; 184 var $element = self.$popup; 185 while ( ! ( ( $element.hasClass( 'elementor-container' ) && ! $element.parent().hasClass( 'elementor-inner-container' ) ) || ( $element.hasClass( 'e-con-inner' ) && ! $element.parent().hasClass( 'e-child' ) ) || ( $element.parent().hasClass( 'vc_row' ) && ! $element.parent().hasClass( 'vc_inner' ) ) || 'header' == $element.parent().attr( 'id' ) || $element.parent().hasClass( 'header-main' ) || $element.parent().hasClass( 'header-top' ) || $element.parent().hasClass( 'header-bottom' ) ) ) { 186 $element = $element.parent(); 187 $element.addClass( 'position-static' ); 188 self.parents.push( $element ); 189 } 190 if ( 'static' == $element.parent().css( 'position' ) ) { 191 self.topParent = $element.parent(); 192 self.topParent.addClass( 'position-relative' ); 193 } 194 $form.toggle(); 195 window.setTimeout( function () { 196 $( 'body' ).addClass( 'porto-search-opened' ); 197 $form.find( '.text>input[name="s"]' ).focus(); 198 }, 100 ); 199 } else { 200 $form.toggle(); 201 } 202 if ( $this.hasClass( 'opened' ) ) { 203 $( '#mini-cart.open' ).removeClass( 'open' ); 204 $this.next().find( 'input[type="text"]' ).focus(); 205 if ( self.$popup.find( '.btn-close-search-form' ).length ) { 206 self.$popup.parent().addClass( 'position-static' ); 207 } 208 } else if ( 'reveal' == self.form_layout ) { 209 self.removeFormStyle(); 210 } 211 e.preventDefault(); 212 e.stopPropagation(); 213 } ); 214 215 $( 'html,body' ).on( 'click', function() { 216 self.removeFormStyle(); 217 $( '.search-lists' ).removeClass( 'show' ); 218 } ); 219 220 if ( !( 'ontouchstart' in document ) ) { 221 222 $( window ).on( 'resize', function() { 223 self.removeFormStyle(); 224 } ); 225 } 226 227 $( '.btn-close-search-form' ).on( 'click', function( e ) { 228 e.preventDefault(); 229 self.removeFormStyle(); 230 } ); 231 232 return self; 233 }, 234 235 removeFormStyle: function() { 236 this.$form.removeAttr( 'style' ); 237 var $searchToggle = this.$popup.find( '.search-toggle' ); 238 $searchToggle.removeClass( 'opened' ); 239 if ( 'overlay' == this.form_layout ) { 240 $( 'html' ).removeClass( 'porto-search-opened porto-search-overlay-wrap' ); 241 $searchToggle.siblings( '.search-layout-overlay' ).removeClass( 'show' ); 242 $searchToggle.closest( '.vc_row.vc_row-flex>.vc_column_container>.vc_column-inner' ).css( 'z-index', '' ); 243 } else if ( 'reveal' == this.form_layout && this.parents && this.parents.length >= 1 ) { 244 $( 'body' ).removeClass( 'porto-search-opened' );
245 this.parents.forEach( $element => { 246 $element.removeClass( 'position-static' ); 247 }); 248 if ( this.topParent ) { 249 this.topParent.removeClass( 'position-relative' ); 250 } 251 } 252 if ( this.$popup.find( '.btn-close-search-form' ).length ) { 253 this.$popup.parent().removeClass( 'position-static' ); 254 } 255 } 256 } 257 258 } ); 259 260} ).apply( this, [window.theme, jQuery] ); 261 262 263// Carousel 264 265( function( theme, $ ) { 266 'use strict'; 267 268 theme = theme || {}; 269 270 var instanceName = '__carousel'; 271 272 var Carousel = function( $el, opts ) { 273 return this.initialize( $el, opts ); 274 }; 275 276 Carousel.defaults = $.extend( {}, { 277 loop: true, 278 navText: [], 279 themeConfig: false, 280 lazyLoad: true, 281 lg: 0, 282 md: 0, 283 sm: 0, 284 xs: 0, 285 single: false, 286 rtl: theme.rtl 287 } ); 288 289 Carousel.prototype = { 290 initialize: function( $el, opts ) { 291 if ( $el.data( instanceName ) ) { 292 return this; 293 } 294 295 this.$el = $el; 296 297 this 298 .setData() 299 .setOptions( opts ) 300 .build(); 301 302 return this; 303 }, 304 305 setData: function() { 306 this.$el.data( instanceName, true ); 307 308 return this; 309 }, 310 311 setOptions: function( opts ) { 312 if ( ( opts && opts.themeConfig ) || !opts ) { 313 this.options = $.extend( true, {}, Carousel.defaults, theme.owlConfig, opts, { 314 wrapper: this.$el, 315 themeConfig: true 316 } ); 317 } else { 318 this.options = $.extend( true, {}, Carousel.defaults, opts, { 319 wrapper: this.$el 320 } ); 321 } 322 323 return this; 324 }, 325 326 calcOwlHeight: function( $el ) { 327 var h = 0; 328 $el.find( '.owl-item.active' ).each( function() { 329 if ( h < $( this ).height() ) 330 h = $( this ).height(); 331 } ); 332 $el.children( '.owl-stage-outer' ).height( h ); 333 }, 334 335 build: function() { 336 if ( !$.fn.owlCarousel ) { 337 return this; 338 } 339 340 var $el = this.options.wrapper, 341 loop = this.options.loop, 342 lg = this.options.lg, 343 md = this.options.md, 344 sm = this.options.sm, 345 xs = this.options.xs, 346 single = this.options.single, 347 zoom = $el.find( '.zoom' ).filter( function() { 348 if ( $( this ).closest( '.tb-image-type-slider' ).length ) { 349 return false; 350 } 351 return true; 352 } ).get( 0 ), 353 responsive = {}, 354 items, 355 count = $el.find( '.owl-item' ).length > 0 ? $el.find( '.owl-item:not(.cloned)' ).length : $el.find( '> *' ).length, 356 fullscreen = typeof this.options.fullscreen == 'undefined' ? false : this.options.fullscreen;
357 358 359 /*if (fullscreen) { 360 $el.children().width(window.innerWidth - theme.getScrollbarWidth()); 361 $el.children().height($el.closest('.fullscreen-carousel').length ? $el.closest('.fullscreen-carousel').height() : window.innerHeight); 362 $el.children().css('max-height', '100%'); 363 $(window).on('resize', function() { 364 $el.find('.owl-item').children().width(window.innerWidth - theme.getScrollbarWidth()); 365 $el.find('.owl-item').children().height($el.closest('.fullscreen-carousel').length ? $el.closest('.fullscreen-carousel').height() : window.innerHeight); 366 $el.find('.owl-item').children().css('max-height', '100%'); 367 }); 368 }*/ 369 370 if ( single ) { 371 items = 1; 372 } else if ( typeof this.options.responsive != 'undefined' ) { 373 for ( var w in this.options.responsive ) { 374 var number_items = Number( this.options.responsive[w] ); 375 responsive[Number( w )] = { items: number_items, loop: ( loop && count >= number_items ) ? true : false }; 376 } 377 } else { 378 items = this.options.items ? this.options.items : ( lg ? lg : 1 ); 379 var isResponsive = ( this.options.xxl || this.options.xl || lg || md || sm || xs ); 380 if ( isResponsive ) { 381 if ( this.options.xxl ) { 382 responsive[theme.screen_xxl] = { items: this.options.xxl, loop: ( loop && count > this.options.xxl ) ? true : false, mergeFit: this.options.mergeFit }; 383 } else if ( lg && items > lg + 1 ) { 384 responsive[theme.screen_xxl] = { items: items, loop: ( loop && count > items ) ? true : false, mergeFit: this.options.mergeFit }; 385 responsive[theme.screen_xl] = { items: lg + 1, loop: ( loop && count > lg + 1 ) ? true : false, mergeFit: this.options.mergeFit }; 386 } 387 if ( this.options.xl ) { 388 responsive[theme.screen_xl] = { items: this.options.xl, loop: ( loop && count > this.options.xl ) ? true : false, mergeFit: this.options.mergeFit }; 389 } else if ( typeof responsive[theme.screen_xl] == 'undefined' && ( ! lg || items != lg ) ) { 390 responsive[theme.screen_xl] = { items: items, loop: ( loop && count >= items ) ? true : false, mergeFit: this.options.mergeFit }; 391 } 392 if ( lg ) responsive[992] = { items: lg, loop: ( loop && count >= lg ) ? true : false, mergeFit: this.options.mergeFit_lg }; 393 if ( md ) responsive[768] = { items: md, loop: ( loop && count > md ) ? true : false, mergeFit: this.options.mergeFit_md }; 394 if ( sm ) { 395 responsive[576] = { items: sm, loop: ( loop && count > sm ) ? true : false, mergeFit: this.options.mergeFit_sm }; 396 } else { 397 if ( xs && xs > 1 ) { 398 responsive[576] = { items: xs, loop: ( loop && count > xs ) ? true : false, mergeFit: this.options.mergeFit_sm }; 399 } else { 400 responsive[576] = { items: 1, mergeFit: false }; 401 } 402 } 403 if ( xs ) { 404 responsive[0] = { items: xs, loop: ( loop && count > xs ) ? true : false, mergeFit: this.options.mergeFit_xs }; 405 } else { 406 responsive[0] = { items: 1 }; 407 } 408 } 409 } 410 411 if ( !$el.hasClass( 'show-nav-title' ) && this.options.themeConfig && theme.slider_nav && theme.slider_nav_hover ) { 412 $el.addClass( 'show-nav-hover' ); 413 } 414 415 this.options = $.extend( true, {}, this.options, { 416 items: items, 417 loop: ( loop && count > items ) ? true : false, 418 responsive: responsive, 419 onInitialized: function() { 420 if ( $el.hasClass( 'stage-margin' ) ) { 421 $el.find( '.owl-stage-outer' ).css( { 422 'margin-left': this.options.stagePadding, 423 'margin-right': this.options.stagePadding 424 } ); 425 } 426 var heading_cls = '.porto-u-heading, .vc_custom_heading, .slider-title, .elementor-widget-heading, .porto-heading'; 427 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 ) ) { 428 var $obj = $el.prev( heading_cls ); 429 if ( !$obj.length ) { 430 $obj = $el.closest( '.slider-wrapper' ).prev( heading_cls ); 431 } 432 if ( !$obj.length ) { 433 $obj = $el.closest( '.porto-recent-posts' ).prev( heading_cls ); 434 } 435 if ( !$obj.length ) { 436 $obj = $el.closest( '.elementor-widget-porto_recent_posts, .elementor-section' ).prev( heading_cls ); 437 } 438 try { 439 var innerWidth = $obj.addClass( 'w-auto' ).css( 'display', 'inline-block' ).width(); 440 $obj.removeClass( 'w-auto' ).css( 'display', '' ); 441 if ( innerWidth + 15 + $el.find( '.owl-dots' ).width() <= $obj.width() ) { 442 $el.find( '.owl-dots' ).css( ( $( 'body' ).hasClass( 'rtl' ) ? 'right' : 'left' ), innerWidth + 15 + ( $el.width() - $obj.width() ) / 2 );
443 $el.find( '.owl-dots' ).css( 'top', -1 * $obj.height() / 2 - parseInt( $obj.css( 'margin-bottom' ) ) - $el.find( '.owl-dots' ).height() / 2 + 2 ); 444 } else { 445 $el.find( '.owl-dots' ).css( 'position', 'static' ); 446 } 447 } catch ( e ) { } 448 } 449 } 450 } ); 451 452 // Auto Height Fixes 453 if ( this.options.autoHeight ) { 454 var thisobj = this; 455 $( window ).on( 'resize', function() { 456 thisobj.calcOwlHeight( $el ); 457 } ); 458 459 if ( theme.isLoaded ) { 460 setTimeout( function() { 461 thisobj.calcOwlHeight( $el ); 462 }, 100 ); 463 } else { 464 $( window ).on( 'load', function() { 465 thisobj.calcOwlHeight( $el ); 466 } ); 467 } 468 } 469 470 var links = false; 471 if ( zoom ) { 472 links = []; 473 var i = 0; 474 475 $el.find( '.zoom' ).each( function() { 476 var slide = {}, 477 $zoom = $( this ); 478 479 slide.src = $zoom.data( 'src' ) ? $zoom.data( 'src' ) : $zoom.data( 'mfp-src' ); 480 slide.title = $zoom.data( 'title' ); 481 links[i] = slide; 482 $zoom.data( 'index', i ); 483 i++; 484 } ); 485 } 486 487 if ( $el.hasClass( 'show-nav-title' ) ) { 488 this.options.stagePadding = 0; 489 } else { 490 if ( this.options.themeConfig && theme.slider_nav && theme.slider_nav_hover ) 491 $el.addClass( 'show-nav-hover' ); 492 if ( this.options.themeConfig && !theme.slider_nav_hover && theme.slider_margin ) 493 $el.addClass( 'stage-margin' ); 494 } 495 if ( $el.hasClass( 'has-ccols-spacing' ) ) { 496 $el.removeClass( 'has-ccols-spacing' ); 497 } 498 $el.owlCarousel( this.options ); 499 500 if ( zoom && links ) { 501 $el.on( 'click', '.zoom', function( e ) { 502 e.preventDefault(); 503 if ( $.fn.magnificPopup ) { 504 var image_index = $( this ).data( 'index' ); 505 if ( typeof image_index == 'undefined' ) { 506 image_index = ( $( this ).closest( '.owl-item' ).index() - $el.find( '.cloned' ).length / 2 ) % $el.data( 'owl.carousel' ).items().length; 507 } 508 $.magnificPopup.close(); 509 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 510 items: links, 511 gallery: { 512 enabled: true 513 }, 514 type: 'image' 515 } ), image_index ); 516 } 517 return false; 518 } ); 519 } 520 521 return this; 522 } 523 } 524 // expose to scope 525 $.extend( theme, { 526 Carousel: Carousel 527 } ); 528 529 // jquery plugin 530 $.fn.themeCarousel = function( opts, zoom ) { 531 if ( typeof $.fn.owlCarousel != 'function' ) { 532 return this; 533 } 534 return this.map( function() { 535 var $this = $( this ); 536 537 if ( $this.data( instanceName ) ) { 538 return $this; 539 } else { 540 return new theme.Carousel( $this, opts, zoom ); 541 } 542 543 } ); 544 } 545 546} ).apply( this, [window.theme, jQuery] ); 547 548// Lightbox 549( function( theme, $ ) { 550 'use strict'; 551 552 theme = theme || {}; 553 554 var instanceName = '__lightbox'; 555 556 var Lightbox = function( $el, opts ) { 557 return this.initialize( $el, opts ); 558 }; 559 560 Lightbox.defaults = { 561 callbacks: { 562 open: function() { 563 $( 'body' ).addClass( 'lightbox-opened' ); 564 }, 565 close: function() { 566 $( 'body' ).removeClass( 'lightbox-opened' ); 567 } 568 } 569 }; 570 571 Lightbox.prototype = { 572 initialize: function( $el, opts ) { 573 if ( $el.data( instanceName ) ) { 574 return this; 575 } 576 577 this.$el = $el; 578 579 this 580 .setData() 581 .setOptions( opts ) 582 .build(); 583 584 return this; 585 }, 586 587 setData: function() { 588 this.$el.data( instanceName, this ); 589 590 return this; 591 }, 592 593 setOptions: function( opts ) { 594 this.options = $.extend( true, {}, Lightbox.defaults, theme.mfpConfig, opts, { 595 wrapper: this.$el 596 } ); 597 598 return this; 599 }, 600 601 build: function() { 602 if ( !$.fn.magnificPopup ) { 603 return this; 604 } 605 606 this.options.wrapper.magnificPopup( this.options ); 607 608 return this; 609 } 610 }; 611 612 // expose to scope 613 $.extend( theme, { 614 Lightbox: Lightbox 615 } ); 616 617 // jquery plugin 618 $.fn.themeLightbox = function( opts ) { 619 return this.map( function() { 620 var $this = $( this ); 621 622 if ( $this.data( instanceName ) ) { 623 return $this.data( instanceName ); 624 } else { 625 return new theme.Lightbox( $this, opts ); 626 } 627 628 } ); 629 } 630 631} ).apply( this, [window.theme, jQuery] ); 632 633// Post Filter 634( function( theme, $ ) { 635 'use strict'; 636 637 theme = theme || {}; 638 639 $.extend( theme, { 640 641 PostFilter: { 642 643 cache: { 644 }, 645 646 defaults: { 647 elements: '.portfolio-filter' 648 }, 649 650 initialize: function( $elements, post_type ) { 651 this.$elements = ( $elements || $( this.defaults.elements ) ); 652 this.build( post_type ); 653 654 return this; 655 }, 656 657 filterFn: function( e ) { 658 if ( typeof e == 'undefined' || typeof e.data == 'undefined' || typeof e.data.elements == 'undefined' || !e.data.elements || !e.data.elements.length ) { 659 return; 660 } 661 var self = e.data.selfobj;
662 663 if ( self.isLoading ) { 664 return false; 665 } 666 var $this = e.data.thisobj, 667 $elements = e.data.elements, 668 position = e.data.position, 669 post_type = e.data.post_type, 670 $parent = e.data.parent, 671 $posts_wrap = e.data.posts_wrap, 672 use_ajax = e.data.use_ajax, 673 page_path = e.data.page_path, 674 infinite_load = e.data.infinite_load, 675 load_more = e.data.load_more; 676 e.preventDefault(); 677 if ( $( this ).hasClass( 'active' ) ) { 678 return; 679 } 680 681 self.isLoading = true; 682 var selector = $( this ).attr( 'data-filter' ); 683 if ( 'sidebar' == position ) { 684 $( '.sidebar-overlay' ).trigger( 'click' ); 685 } 686 687 $this.find( '.active' ).removeClass( 'active' ); 688 689 if ( use_ajax ) { 690 var current_cat = '*' == selector ? '' : selector; 691 if ( !page_path ) { 692 page_path = $posts_wrap.data( 'page_path' ); 693 } 694 if ( page_path ) { 695 $posts_wrap.data( 'page_path', page_path.replace( /&category=[^&]*&/, '&category=' + current_cat + '&' ) ); 696 } 697 698 $( this ).addClass( 'active' ); 699 self.load_posts( current_cat, infinite_load || load_more ? true : false, $parent, post_type, $posts_wrap, undefined, $( this ).children( 'a' ).attr( 'href' ) ); 700 } else if ( 'faq' == post_type ) { 701 $parent.find( '.faq' ).each( function() { 702 var $that = $( this ), easing = "easeInOutQuart", timeout = 300; 703 if ( selector == '*' ) { 704 if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() { 705 $( this ).attr( 'style', '' ).show(); 706 } ); 707 selected++; 708 } else { 709 if ( $that.hasClass( selector ) ) { 710 if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() { 711 $( this ).attr( 'style', '' ).show(); 712 } ); 713 selected++; 714 } else { 715 if ( $that.css( 'display' ) != 'none' ) $that.stop( true ).slideUp( timeout, easing, function() { 716 $( this ).attr( 'style', '' ).hide(); 717 } ); 718 } 719 } 720 } ); 721 722 if ( !selected && $parent.find( '.faqs-infinite' ).length && typeof ( $.fn.infinitescroll ) != 'undefined' ) { 723 $parent.find( '.faqs-infinite' ).infinitescroll( 'retrieve' ); 724 } 725 } else if ( $parent.hasClass( 'portfolios-timeline' ) ) { 726 var selected = 0; 727 $parent.find( '.portfolio' ).each( function() { 728 var $that = $( this ), easing = "easeInOutQuart", timeout = 300; 729 if ( selector == '*' ) { 730 if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() { 731 $( this ).attr( 'style', '' ).show(); 732 } ); 733 selected++; 734 } else { 735 if ( $that.hasClass( selector ) ) { 736 if ( $that.css( 'display' ) == 'none' ) $that.stop( true ).slideDown( timeout, easing, function() { 737 $( this ).attr( 'style', '' ).show(); 738 } ); 739 selected++; 740 } else { 741 if ( $that.css( 'display' ) != 'none' ) $that.stop( true ).slideUp( timeout, easing, function() { 742 $( this ).attr( 'style', '' ).hide(); 743 } ); 744 } 745 } 746 } ); 747 if ( !selected && $parent.find( '.portfolios-infinite' ).length && typeof ( $.fn.infinitescroll ) != 'undefined' ) { 748 $parent.find( '.portfolios-infinite' ).infinitescroll( 'retrieve' ); 749 } 750 setTimeout( function() { 751 theme.FilterZoom.initialize( $parent ); 752 }, 400 ); 753 } else { 754 $parent.find( '.' + post_type + '-row' ).isotope( { 755 filter: selector == '*' ? selector : '.' + selector 756 } ); 757 } 758 759 if ( !use_ajax ) { 760 $( this ).addClass( 'active' ); 761 self.isLoading = false; 762 } 763 764 if ( position == 'sidebar' ) { 765 self.$elements.each( function() { 766 var $that = $( this ); 767 768 if ( $that == $this && $that.data( 'position' ) != 'sidebar' ) return; 769 $that.find( 'li' ).removeClass( 'active' ); 770 $that.find( 'li[data-filter="' + selector + '"]' ).addClass( 'active' ); 771 } ); 772 } 773 774 if ( !use_ajax ) { 775 window.location.hash = '#' + selector; 776 } 777 theme.refreshVCContent(); 778 return false; 779 }, 780 781 build: function( post_type_param ) { 782 var self = this; 783 784 self.$elements.each( function() { 785 var $this = $( this ), 786 position = $this.data( 'position' ), 787 $parent, 788 post_type; 789 if ( typeof post_type_param == 'undefined' ) { 790 if ( $this.hasClass( 'member-filter' ) ) { 791 post_type = 'member'; 792 } else if ( $this.hasClass( 'faq-filter' ) ) { 793 post_type = 'faq'; 794 } else if ( $this.hasClass( 'product-filter' ) ) { 795 post_type = 'product'; 796 } else if ( $this.hasClass( 'post-filter' ) ) { 797 post_type = 'post'; 798 } else if ( $this.hasClass( 'portfolio-filter' ) ) { 799 post_type = 'portfolio'; 800 } else { 801 post_type = $this.attr( 'data-filter-type' ); 802 } 803 } else { 804 post_type = post_type_param; 805 } 806 807 if ( 'sidebar' == position ) { 808 $parent = $( '.main-content .page-' + post_type + 's' ); 809 //theme.scrolltoContainer($parent); 810 } else if ( 'global' == position ) { 811 $parent = $( '.main-content .page-' + post_type + 's' ); 812 } else { 813 $parent = $this.closest( '.page-' + post_type + 's' ); 814 } 815 if ( !$parent.length ) { 816 $parent = $this.closest( '.porto-posts-grid' ); 817 } 818 if ( !$parent || !$parent.length ) { 819 return; 820 } 821 var use_ajax = $this.hasClass( 'porto-ajax-filter' ), 822 infinite_load = $parent.hasClass( 'load-infinite' ), 823 load_more = $parent.hasClass( 'load-more' ); 824 825 var $posts_wrap = $parent.find( '.' + post_type + 's-container' ), 826 page_path; 827 if ( use_ajax && ( ( !infinite_load && !load_more ) || !$parent.data( 'ajax_load_options' ) ) ) { 828 var current_url = window.location.href; 829 if ( -1 !== current_url.indexOf( '#' ) ) { 830 current_url = current_url.split( '#' )[0]; 831 } 832 page_path = theme.ajax_url + ( -1 === theme.ajax_url.indexOf( '?' ) ? '?' : '&' ) + 'action=porto_ajax_posts&nonce=' + js_porto_vars.porto_nonce + '&post_type=' + post_type + '¤t_link=' + current_url + '&category=&page=%cur_page%'; 833 if ( $parent.data( 'post_layout' ) ) { 834 page_path += '&post_layout=' + $parent.data( 'post_layout' ); 835 } 836 $posts_wrap.data( 'page_path', page_path ); 837 } 838 839 $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 ); 840 } ); 841
842 $( window ).on( 'hashchange', { elements: self.$elements }, self.hashchange ); 843 self.hashchange( { data: { elements: self.$elements } } ); 844 845 return self; 846 }, 847 848 hashchange: function( e ) { 849 if ( typeof e == 'undefined' || typeof e.data == 'undefined' || typeof e.data.elements == 'undefined' || !e.data.elements || !e.data.elements.length ) { 850 return; 851 } 852 var $elements = e.data.elements, 853 $filter = $( $elements.get( 0 ) ), 854 hash = window.location.hash; 855 856 if ( hash ) { 857 var $o = $filter.find( 'li[data-filter="' + hash.replace( '#', '' ) + '"]' ); 858 if ( !$o.hasClass( 'active' ) ) { 859 $o.trigger( 'click' ); 860 } 861 } 862 }, 863 864 set_elements: function( $elements ) { 865 var self = this; 866 if ( typeof $elements == 'undefined' || !$elements || !$elements.length ) { 867 self.destroy( self.$elements ); 868 return; 869 } 870 self.$elements = $elements; 871 $( window ).off( 'hashchange', self.hashchange ).on( 'hashchange', { elements: $elements }, self.hashchange ); 872 }, 873 874 destroy: function( $elements ) { 875 if ( typeof $elements == 'undefined' || !$elements || !$elements.length ) { 876 return; 877 } 878 var self = this; 879 $elements.find( 'li' ).off( 'click', self.filterFn ); 880 $( window ).off( 'hashchange', self.hashchange ); 881 }, 882 883 load_posts: function( cat, is_infinite, $parent, post_type, $posts_wrap, default_args, page_url ) { 884 var _gridcookie = ''; 885 if ( $parent.hasClass( 'archive-products' ) ) { 886 _gridcookie = new URLSearchParams( location.search.substring( 1 ) ).get( 'gridcookie' ); 887 if ( ! ( _gridcookie == null || _gridcookie == '' || _gridcookie == 'grid' ) ) { 888 page_url = theme.addUrlParam( page_url, 'gridcookie', _gridcookie ); 889 } 890 } 891 var pid = $parent.attr( 'id' ), 892 self = this, 893 is_archive = $parent.hasClass( 'archive-posts' ), 894 successfn = function( res, directcall ) { 895 if ( !res ) { 896 return; 897 } 898 if ( ( typeof directcall == 'undefined' || true !== directcall ) && typeof default_args == 'undefined' && pid ) { 899 if ( !self.cache[pid] ) { 900 self.cache[pid] = {}; 901 } 902 self.cache[pid][cat + _gridcookie] = res; 903 } 904 var $res = $( res ), 905 is_shop = $parent.hasClass( 'archive-products' ), 906 $posts = $res.find( is_archive ? '.archive-posts .posts-wrap' : '.posts-wrap' ).children(); 907 908 if ( !$posts.length ) { 909 return; 910 } 911 912 if ( typeof $posts_wrap == 'undefined' || is_archive ) { 913 $posts_wrap = $parent.find( '.' + post_type + 's-container' ); 914 } 915 if ( !$posts_wrap.length ) { 916 return; 917 } 918 919 if ( $posts_wrap.data( 'isotope' ) ) { 920 $posts_wrap.isotope( 'remove', $posts_wrap.children() ); 921 } else { 922 $posts_wrap.children().remove(); 923 } 924 925 if ( $posts_wrap.hasClass( 'owl-loaded' ) ) { 926 $posts_wrap.removeClass( 'owl-loaded' ); 927 } 928 $posts.children().addClass( 'fadeInUp animated' ); 929 $posts_wrap.append( $posts ); 930 theme.refreshVCContent( $posts ); 931 932 // filter 933 var $old_filter = $parent.find( '.' + post_type + '-filter' ); 934 if ( $old_filter.length && !$old_filter.hasClass( 'porto-ajax-filter' ) && !$parent.hasClass( 'load-infinite' ) && !$parent.hasClass( 'load-more' ) ) { 935 var $new_filter = $res.find( ( is_archive ? '.archive-posts ' : '' ) + '.' + post_type + '-filter' ); 936 if ( $new_filter.length ) { 937 $old_filter.find( 'li:first-child' ).trigger( 'click' ); 938 theme.PostFilter.destroy( $old_filter ); 939 $old_filter.replaceWith( $new_filter ); 940 //$new_filter = $parent.find( '.' + post_type + '-filter' ); 941 theme.PostFilter.initialize( $new_filter, post_type ); 942 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' ) ); 943 } 944 } 945 946 porto_init( $parent ); 947 948 var behavior_action = ''; 949 if ( post_type != 'product' && post_type != 'member' && post_type != 'faq' && post_type != 'portfolio' && post_type != 'post' ) { 950 behavior_action = 'ptu'; 951 } else { 952 behavior_action = post_type; 953 } 954 theme.PostsInfinite[behavior_action + 'Behavior']( $posts, $posts_wrap ); 955 956 // init CountDown 957 $( document.body ).trigger( 'porto_init_countdown', [$posts_wrap] ); 958 959 // pagination 960 var $old_pagination = $parent.find( '.pagination-wrap' ), 961 $new_pagination = $res.find( ( is_archive ? '.archive-posts ' : '' ) + '.pagination-wrap' ).eq( 0 ), 962 has_pagination = false, 963 nst_pagination = false; 964 if ( $old_pagination.length ) { 965 if ( $new_pagination.length ) { 966 $old_pagination.replaceWith( $new_pagination ); 967 has_pagination = true; 968 nst_pagination = true; 969 } else { 970 $old_pagination.children().remove(); 971 } 972 } else if ( $new_pagination.length ) { 973 $parent.append( $new_pagination ); 974 has_pagination = true; 975 nst_pagination = true; 976 } 977 978 if ( is_shop ) { // shop builder with counter per page widget 979 let _paginationWrap = $( '.woocommerce-pagination' ); 980 var $old_pagination = _paginationWrap.find( 'ul.page-numbers' ), 981 $new_pagination = $res.find( '.woocommerce-pagination ul.page-numbers' ).eq( 0 ), 982 has_pagination = false; 983 if ( $old_pagination.length ) { 984 if ( $new_pagination.length ) { 985 $old_pagination.replaceWith( $new_pagination ); 986 has_pagination = true; 987 } else { 988 $old_pagination.children().remove(); 989 } 990 } else if ( $new_pagination.length ) { 991 _paginationWrap.append( $new_pagination ); 992 has_pagination = true; 993 } 994 } 995 996 997 if ( is_infinite ) { 998 var infinitescroll_ins = $posts_wrap.data( 'infinitescroll' ); 999 if ( has_pagination || ( is_shop && nst_pagination ) ) { 1000 var $new_posts_wrap = $res.find( is_archive ? '.archive-posts .posts-wrap' : '.posts-wrap' ); 1001 if ( $new_posts_wrap.data( 'cur_page' ) ) { 1002 $posts_wrap.data( 'cur_page', $new_posts_wrap.data( 'cur_page' ) ); 1003 $posts_wrap.data( 'max_page', $new_posts_wrap.data( 'max_page' ) ); 1004 } 1005 1006 var should_init_again = true; 1007 if ( infinitescroll_ins ) { 1008 if ( infinitescroll_ins.options.state.isDestroyed ) { 1009 $posts_wrap.removeData( 'infinitescroll' ); 1010 } else { 1011 should_init_again = false; 1012 if ( $new_posts_wrap.data( 'cur_page' ) ) { 1013 infinitescroll_ins.update( { 1014 maxPage: $new_posts_wrap.data( 'max_page' ), 1015 state: { 1016 currPage: $new_posts_wrap.data( 'cur_page' ) 1017 } 1018 } ); 1019 }
1020 if ( infinitescroll_ins.options.state.isPaused ) { 1021 infinitescroll_ins.resume(); 1022 } 1023 } 1024 } 1025 1026 if ( should_init_again ) { 1027 var ins = $posts_wrap.data( '__postsinfinite' ); 1028 if ( ins ) { 1029 ins.destroy(); 1030 } 1031 var selector_product = '.' + post_type + ', .timeline-date'; 1032 if ( is_shop ) { 1033 selector_product = '.archive-products .product'; 1034 if ( $( '.elementor-widget-wc-archive-products' ).length ) { 1035 selector_product = '.elementor-widget-wc-archive-products .product'; 1036 } 1037 } 1038 new theme.PostsInfinite( $posts_wrap, selector_product, $posts_wrap.data( 'infiniteoptions' ), post_type ); 1039 } 1040 1041 if ( is_archive ) { 1042 var page_path = $posts_wrap.siblings( '.pagination-wrap' ).find( '.next' ).attr( 'href' ); 1043 if ( page_path ) { 1044 page_path += ( -1 !== page_path.indexOf( '?' ) ? '&' : '?' ) + 'portoajax=1&load_posts_only=2'; 1045 page_path = page_path.replace( /(paged=)(\d+)|(page\/)(\d+)/, '$1$3%cur_page%' ); 1046 $posts_wrap.data( 'page_path', page_path ); 1047 } 1048 } 1049 var selector_product = '.' + post_type + ', .timeline-date'; 1050 if ( is_shop ) { 1051 selector_product = '.archive-products .product'; 1052 if ( $( '.elementor-widget-wc-archive-products' ).length ) { 1053 selector_product = '.elementor-widget-wc-archive-products .product'; 1054 } 1055 } 1056 new theme.PostsInfinite( $posts_wrap, selector_product, $posts_wrap.data( 'infiniteoptions' ), post_type ); 1057 } 1058 } 1059 1060 // in archive page 1061 if ( is_archive ) { 1062 // update widgets 1063 $( '.sidebar-content' ).each( function( index ) { 1064 var $this = $( this ), 1065 $that = $( $res.find( '.sidebar-content' ).get( index ) ); 1066 1067 $this.html( $that.html() ); 1068 1069 // in shop 1070 if ( is_shop ) { 1071 if ( typeof updateSelect2 != 'undefined' && updateSelect2 ) { 1072 // Use Select2 enhancement if possible 1073 if ( jQuery().selectWoo ) { 1074 var porto_wc_layered_nav_select = function() { 1075 $this.find( 'select.woocommerce-widget-layered-nav-dropdown' ).each( function() { 1076 $( this ).selectWoo( { 1077 placeholder: $( this ).find( 'option' ).eq( 0 ).text(), 1078 minimumResultsForSearch: 5, 1079 width: '100%', 1080 allowClear: typeof $( this ).attr( 'multiple' ) != 'undefined' && $( this ).attr( 'multiple' ) == 'multiple' ? 'false' : 'true' 1081 } ); 1082 } ); 1083 }; 1084 porto_wc_layered_nav_select(); 1085 } 1086 $( 'body' ).children( 'span.select2-container' ).remove(); 1087 } 1088 } 1089 } ); 1090 1091 // in shop 1092 if ( is_shop ) { 1093 var $script = $res.filter( 'script:contains("var woocommerce_price_slider_params")' ).first(); 1094 if ( $script && $script.length && $script.text().indexOf( '{' ) !== -1 && $script.text().indexOf( '}' ) !== -1 ) { 1095 var arrStr = $script.text().substring( $script.text().indexOf( '{' ), $script.text().indexOf( '}' ) + 1 ); 1096 window.woocommerce_price_slider_params = JSON.parse( arrStr ); 1097 } 1098 1099 // update entry title 1100 var $title = $( '.entry-title' ); 1101 if ( $title.length ) { 1102 var $newTitle = $res.find( '.entry-title' ).eq( 0 ); 1103 if ( $newTitle.length ) { 1104 $title.html( $newTitle.html() ); 1105 } 1106 } 1107 1108 // update entry description 1109 var $desc = $( '.entry-description' ); 1110 if ( $desc.length ) { 1111 var $newDesc = $res.find( '.entry-description' ).eq( 0 ); 1112 if ( $newDesc.length ) { 1113 $desc.html( $newDesc.html() ); 1114 } 1115 } 1116 1117 // top toolbar 1118 var shop_before = '.shop-loop-before', 1119 $shop_before = $( shop_before ); 1120 if ( $shop_before.length ) { 1121 if ( $res.find( shop_before ).length ) { 1122 $shop_before.each( function( index ) { 1123 var $res_shop_before = $res.find( shop_before ).eq( index ); 1124 if ( $res_shop_before.length ) { 1125 $( this ).html( $res_shop_before.html() ).show(); 1126 } 1127 } ); 1128 } else { 1129 $shop_before.empty(); 1130 } 1131 } 1132 1133 // update result count 1134 var $count = $( '.woocommerce-result-count' ); 1135 if ( $count.length ) { 1136 var $newCount = $res.find( '.woocommerce-result-count' ).eq( 0 ); 1137 if ( $newCount.length ) { 1138 $count[0].outerHTML = $newCount.length ? $newCount[0].outerHTML : ''; 1139 } 1140 } 1141 1142 // trigger ready event 1143 $( document ).trigger( 'yith_wcan_init_shortcodes' ); 1144 $( document ).trigger( 'yith-wcan-ajax-filtered' ); 1145 } 1146 1147 // update browser history (IE doesn't support it) 1148 if ( page_url && !navigator.userAgent.match( /msie/i ) ) { 1149 window.history.pushState( { 'pageTitle': ( res && res.pageTitle ) || '' }, '', page_url ); 1150 } 1151 } 1152 1153 $( document.body ).trigger( 'porto_load_posts_end', [$parent.parent()] ); 1154 }; 1155 1156 if ( typeof default_args == 'undefined' && typeof self.cache[pid] != 'undefined' && typeof self.cache[pid][cat+ _gridcookie] != 'undefined' && self.cache[pid][cat+ _gridcookie] ) { 1157 successfn( self.cache[pid][cat+ _gridcookie], true ); 1158 self.isLoading = false; 1159 $parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove(); 1160 return; 1161 } 1162 1163 var ajax_load_options = $parent.data( 'ajax_load_options' ); 1164 if ( ( $parent.hasClass( 'archive-products' ) && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'shop' ) ) || 1165 ( is_archive && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'blog' ) ) ) { // skeleton
1165screen in archive builder 1166 $posts_wrap = $parent.find( '.' + post_type + 's-container' ); 1167 if ( ajax_load_options ) { 1168 var tag_name = 'div'; 1169 if ( 'product' == post_type && 'ul' == $posts_wrap.get( 0 ).tagName.toLowerCase() ) { 1170 tag_name = 'li'; 1171 } 1172 $posts_wrap.addClass( 'skeleton-body' ).empty(); 1173 for ( var i = 0; i < Number( ajax_load_options.count || ( ajax_load_options.columns && ajax_load_options.columns * 3 ) || 12 ); i++ ) { 1174 $posts_wrap.append( '<' + tag_name + ' class="porto-tb-item post ' + post_type + ( 'product' == post_type ? ' product-col' : '' ) + '"></' + tag_name + '>' ); 1175 } 1176 } else { 1177 $posts_wrap.addClass( 'skeleton-body' ).children().empty(); 1178 } 1179 } else { 1180 if ( !$parent.children( '.porto-loading-icon' ).length ) { 1181 $parent.append( '<i class="porto-loading-icon"></i>' ); 1182 } 1183 $parent.addClass( 'porto-ajax-loading' ); 1184 } 1185 1186 var current_url = window.location.href; 1187 if ( -1 !== current_url.indexOf( '#' ) ) { 1188 current_url = current_url.split( '#' )[0]; 1189 } 1190 1191 var args, load_url = theme.ajax_url; 1192 if ( $parent.hasClass( 'archive-posts' ) ) { // archive builder 1193 args = { 1194 portoajax: true, 1195 load_posts_only: true 1196 }; 1197 if ( $parent.closest( '.porto-block' ).length ) { 1198 args['builder_id'] = $parent.closest( '.porto-block' ).data( 'id' ); 1199 } 1200 load_url = typeof page_url != 'undefined' ? page_url : current_url; 1201 } else { 1202 args = { 1203 action: 'porto_ajax_posts', 1204 nonce: js_porto_vars.porto_nonce, 1205 post_type: post_type, 1206 current_link: current_url 1207 }; 1208 if ( $parent.data( 'post_layout' ) ) { 1209 args['post_layout'] = $parent.data( 'post_layout' ); 1210 } 1211 if ( ajax_load_options ) { 1212 args['extra'] = ajax_load_options; 1213 } 1214 if ( typeof default_args != 'undefined' ) { 1215 args = $.extend( args, default_args ); 1216 } 1217 } 1218 if ( cat ) { 1219 args['category'] = cat; 1220 } 1221 1222 $.ajax( { 1223 url: load_url, 1224 type: 'post', 1225 data: args, 1226 success: successfn, 1227 complete: function() { 1228 self.isLoading = false; 1229 $posts_wrap.removeClass( 'skeleton-body' ); 1230 $parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove(); 1231 } 1232 } ); 1233 1234 } 1235 } 1236 1237 } ); 1238 1239} ).apply( this, [window.theme, jQuery] ); 1240 1241// Filter Zoom 1242( function( theme, $ ) { 1243 'use strict'; 1244 1245 theme = theme || {}; 1246 1247 $.extend( theme, { 1248 1249 FilterZoom: { 1250 1251 defaults: { 1252 elements: null 1253 }, 1254 1255 initialize: function( $elements ) { 1256 this.$elements = ( $elements || this.defaults.elements ); 1257 1258 this.build(); 1259 1260 return this; 1261 }, 1262 1263 build: function() { 1264 var self = this; 1265 1266 self.$elements.each( function() { 1267 var $this = $( this ), 1268 zoom = $this.find( '.zoom, .thumb-info-zoom' ).get( 0 ); 1269 1270 if ( !zoom ) return; 1271 1272 $this.find( '.zoom, .thumb-info-zoom' ).off( 'click' ); 1273 var links = []; 1274 var i = 0; 1275 $this.find( 'article' ).each( function() { 1276 var $that = $( this ); 1277 if ( $that.css( 'display' ) != 'none' ) { 1278 var $zoom = $that.find( '.zoom, .thumb-info-zoom' ), 1279 slide, 1280 src = $zoom.data( 'src' ), 1281 title = $zoom.data( 'title' ); 1282 1283 $zoom.data( 'index', i ); 1284 if ( Array.isArray( src ) ) { 1285 $.each( src, function( index, value ) { 1286 slide = {}; 1287 slide.src = value; 1288 slide.title = title[index]; 1289 links[i] = slide; 1290 i++; 1291 } ); 1292 } else { 1293 slide = {}; 1294 slide.src = src; 1295 slide.title = title; 1296 links[i] = slide; 1297 i++; 1298 } 1299 } 1300 } ); 1301 $this.find( 'article' ).each( function() { 1302 var $that = $( this ); 1303 if ( $that.css( 'display' ) != 'none' ) { 1304 $that.off( 'click', '.zoom, .thumb-info-zoom' ).on( 'click', '.zoom, .thumb-info-zoom', function( e ) {
1305 var $zoom = $( this ), $parent = $zoom.parents( '.thumb-info' ), offset = 0; 1306 if ( $parent.get( 0 ) ) { 1307 var $slider = $parent.find( '.porto-carousel' ); 1308 if ( $slider.get( 0 ) ) { 1309 offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2; 1310 } 1311 } 1312 e.preventDefault(); 1313 if ( $.fn.magnificPopup ) { 1314 $.magnificPopup.close(); 1315 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 1316 items: links, 1317 gallery: { 1318 enabled: true 1319 }, 1320 type: 'image' 1321 } ), $zoom.data( 'index' ) + offset ); 1322 } 1323 return false; 1324 } ); 1325 } 1326 } ); 1327 } ); 1328 1329 return self; 1330 } 1331 } 1332 1333 } ); 1334 1335} ).apply( this, [window.theme, jQuery] ); 1336 1337/* initialize */ 1338( function( theme, $ ) { 1339 theme.initAsync = function( $wrap, wrapObj ) { 1340 // Carousel 1341 if ( $.fn.themeCarousel ) { 1342 1343 $( function() { 1344 1345 var portoImgNavMiddle = function ( $el ) { 1346 var $images = $el.find( '.owl-item img' ), 1347 height = 0; 1348 for ( var i = 0; i < $images.length; i++) { 1349 var imgHeight = $images.eq(i).height(); 1350 if ( height < imgHeight ) { 1351 height = imgHeight; 1352 } 1353 } 1354 if ( $el.hasClass( 'products-slider' ) ) { 1355 $el.children( '.owl-nav' ).css( 'top', ( 5 + height / 2 ) + 'px' ); 1356 } else { 1357 $el.children( '.owl-nav' ).css( 'top', height / 2 + 'px' ); 1358 } 1359 }; 1360 // Carousel Lazyload images 1361 var portoCarouselInit = function( e ) { 1362 var $this = $( e.currentTarget ); 1363 1364 $this.find( '[data-appear-animation]:not(.appear-animation)' ).addClass( 'appear-animation' ); 1365 if ( $this.find( '.owl-item.cloned' ).length ) { 1366 // compatibility with W3 Total Cache 1367 var $not_loaded = $this.find( 'img.lazy:not(.loaded)' ); 1368 if ( $not_loaded.length ) { 1369 if (typeof window.w3tc_lazyload == 'object') { 1370 window.w3tc_lazyload.update(); 1371 } else if (theme.w3tcLazyLoadInstance) { 1372 theme.w3tcLazyLoadInstance.update(); 1373 } 1374 } 1375 1376 if ( $.fn.themePluginLazyLoad ) { 1377 $this.find( '.porto-lazyload:not(.lazy-load-loaded)' ).themePluginLazyLoad( { effect: 'fadeIn', effect_speed: 400 } ); 1378 } 1379 var $animates = e.currentTarget.querySelectorAll( '.appear-animation' ); 1380 if ( $animates.length ) { 1381 if ( theme.animation_support ) { 1382 // theme.dynIntObsInit( $animates, 'themeAnimate', theme.Animate.defaults ); 1383 } else {
1384 $animates.forEach( function( o ) { 1385 o.classList.add( 'appear-animation-visible' ); 1386 } ); 1387 } 1388 } 1389 if ( $.fn.themePluginAnimatedLetters && ( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ).length ) ) { 1390 theme.dynIntObsInit( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ), 'themePluginAnimatedLetters' ); 1391 } 1392 } 1393 1394 setTimeout( function() { 1395 var $hiddenItems = $this.find( '.owl-item:not(.active)' ); 1396 if ( theme.animation_support ) { 1397 $hiddenItems.find( '.appear-animation' ).removeClass( 'appear-animation-visible' ); 1398 $hiddenItems.find( '.appear-animation' ).each( function() { 1399 var $el = $( this ), 1400 delay = Math.abs( $el.data( 'appear-animation-delay' ) ? $el.data( 'appear-animation-delay' ) : 0 ); 1401 if ( delay > 1 ) { 1402 this.style.animationDelay = delay + 'ms'; 1403 } 1404 1405 var duration = Math.abs( $el.data( 'appear-animation-duration' ) ? $el.data( 'appear-animation-duration' ) : 1000 ); 1406 if ( 1000 != duration ) { 1407 this.style.animationDuration = duration + 'ms'; 1408 } 1409 } ); 1410 } 1411 if ( window.innerWidth >= 1200 ) { 1412 $hiddenItems.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' ); 1413 } 1414 // Position the navigation in the middle of the image 1415 if ( $this.hasClass( 'nav-center-images-only' ) ) { 1416 portoImgNavMiddle( $this ); 1417 } 1418 }, 300 ); 1419 }; 1420 var portoCarouselTranslated = function( e ) { 1421 var $this = $( e.currentTarget ); 1422 /*if ( window.innerWidth > 767 ) { 1423 if ( $this.find( '.owl-item.cloned' ).length && $this.find( '.appear-animation:not(.appear-animation-visible)' ).length ) { 1424 $( document.body ).trigger( 'appear_refresh' ); 1425 } 1426 }*/ 1427 1428 var $active = $this.find( '.owl-item.active' ); 1429 if ( $active.hasClass( 'translating' ) ) { 1430 $active.removeClass( 'translating' ); 1431 return; 1432 } 1433 $this.find( '.owl-item.translating' ).removeClass( 'translating' ); 1434 // Animated Letters 1435 $this.find( '[data-plugin-animated-letters]' ).removeClass( 'invisible' ); 1436 $this.find( '.owl-item.active [data-plugin-animated-letters]' ).trigger( 'animated.letters.initialize' ); 1437 1438 if ( window.innerWidth > 767 ) { 1439 // WPBakery 1440 $this.find( '.appear-animation' ).removeClass( 'appear-animation-visible' ); 1441 $active.find( '.appear-animation' ).each( function() { 1442 var $animation_item = $( this ), 1443 anim_name = $animation_item.data( 'appear-animation' ); 1444 $animation_item.addClass( anim_name + ' appear-animation-visible' ); 1445 } ); 1446 } 1447 1448 // sticky sidebar 1449 if ( window.innerWidth > 991 ) { 1450 if ( $this.closest( '[data-plugin-sticky]' ).length ) { 1451 theme.refreshStickySidebar( false, $this.closest( '[data-plugin-sticky]' ) ); 1452 } 1453 } 1454 1455 // Elementor 1456 $active.find( '.slide-animate' ).each( function() { 1457 var $animation_item = $( this ), 1458 settings = $animation_item.data( 'settings' ); 1459 if ( settings && ( settings._animation || settings.animation ) ) { 1460 var animation = settings._animation || settings.animation, 1461 delay = settings._animation_delay || settings.animation_delay || 0; 1462 theme.requestTimeout( function() { 1463 $animation_item.removeClass( 'elementor-invisible' ).addClass( 'animated ' + animation ); 1464 }, delay ); 1465 } 1466 } ); 1467 1468 // Visual Composer 1469 if ( window.innerWidth >= 1200 ) { 1470 $this.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' ).removeAttr( 'data-vcv-o-animated-fully' ); 1471 $active.find( '[data-vce-animate]' ).each( function() { 1472 var $animation_item = $( this ); 1473 if ( $animation_item.data( 'porto-origin-anim' ) ) { 1474 var anim_name = $animation_item.data( 'porto-origin-anim' ); 1475 $animation_item.attr( 'data-vce-animate', anim_name ).attr( 'data-vcv-o-animated', true ); 1476 var duration = parseFloat( window.getComputedStyle( this )['animationDuration'] ) * 1000,
1477 delay = parseFloat( window.getComputedStyle( this )['animationDelay'] ) * 1000; 1478 window.setTimeout( function() { 1479 $animation_item.attr( 'data-vcv-o-animated-fully', true ); 1480 }, delay + duration + 5 ); 1481 } 1482 } ); 1483 } 1484 }; 1485 var portoCarouselTranslateVC = function( e ) { 1486 var $this = $( e.currentTarget ); 1487 $this.find( '.owl-item.active' ).addClass( 'translating' ); 1488 1489 if ( window.innerWidth >= 1200 ) { 1490 $this.find( '[data-vce-animate]' ).each( function() { 1491 var $animation_item = $( this ); 1492 $animation_item.data( 'porto-origin-anim', $animation_item.data( 'vce-animate' ) ).attr( 'data-vce-animate', '' ); 1493 } ); 1494 } 1495 }; 1496 var portoCarouselTranslateElementor = function( e ) { 1497 var $this = $( e.currentTarget ); 1498 $this.find( '.owl-item.active' ).addClass( 'translating' ); 1499 $this.find( '.owl-item:not(.active) .slide-animate' ).addClass( 'elementor-invisible' ); 1500 $this.find( '.slide-animate' ).each( function() { 1501 var $animation_item = $( this ), 1502 settings = $animation_item.data( 'settings' ); 1503 if ( settings._animation || settings.animation ) { 1504 $animation_item.removeClass( settings._animation || settings.animation ); 1505 } 1506 } ); 1507 }; 1508 var portoCarouselTranslateWPB = function( e ) { 1509 if ( window.innerWidth > 767 ) { 1510 var $this = $( e.currentTarget ); 1511 $this.find( '.owl-item.active' ).addClass( 'translating' ); 1512 $this.find( '.appear-animation' ).each( function() { 1513 var $animation_item = $( this ); 1514 $animation_item.removeClass( $animation_item.data( 'appear-animation' ) ); 1515 } ); 1516 } 1517 }; 1518 1519 var carouselItems = $wrap.find( '.owl-carousel:not(.manual)' ); 1520 carouselItems.on( 'initialized.owl.carousel refreshed.owl.carousel', portoCarouselInit ).on( 'translated.owl.carousel', portoCarouselTranslated ); 1521 carouselItems.on( 'translate.owl.carousel', function() { 1522 // Hide elements inside carousel 1523 $( this ).find( '[data-plugin-animated-letters]' ).addClass( 'invisible' ); 1524 // Animated Letters 1525 $( this ).find( '[data-plugin-animated-letters]' ).trigger( 'animated.letters.destroy' ); 1526 } ); 1527 carouselItems.on( 'resized.owl.carousel', function () { 1528 var $this = $( this ); 1529 // Position the navigation in the middle of the image 1530 if ( $this.hasClass( 'nav-center-images-only' ) ) { 1531 portoImgNavMiddle( $this ); 1532 } 1533 } ) 1534 carouselItems.filter( function() { 1535 if ( $( this ).find( '[data-vce-animate]' ).length ) { 1536 return true; 1537 } 1538 return false; 1539 } ).on( 'translate.owl.carousel', portoCarouselTranslateVC ); 1540 carouselItems.filter( function() { 1541 var $anim_obj = $( this ).find( '.elementor-invisible' ); 1542 if ( $anim_obj.length ) { 1543 $anim_obj.addClass( 'slide-animate' ); 1544 return true; 1545 } 1546 return false; 1547 } ).on( 'translate.owl.carousel', portoCarouselTranslateElementor ); 1548 carouselItems.filter( function() { 1549 if ( $( this ).find( '.appear-animation, [data-appear-animation]' ).length ) { 1550 return true; 1551 } 1552 return false; 1553 } ).on( 'translate.owl.carousel', portoCarouselTranslateWPB ); 1554 1555 $wrap.find( '[data-plugin-carousel]:not(.manual), .porto-carousel:not(.manual)' ).each( function() { 1556 var $this = $( this ), 1557 opts; 1558 if ( $this.closest( '.tab-pane' ).length && ! $this.closest( '.tab-pane' ).hasClass( 'active' ) ) { 1559 return; 1560 } 1561 if ( $this.closest( '.e-n-tabs-content > .e-con' ).length && ! $this.closest( '.e-n-tabs-content > .e-con' ).hasClass( 'e-active' ) ) { 1562 return; 1563 } 1564 if ( $this.closest( '.sidebar-menu:not(.side-menu-accordion) .menu-block' ).length ) { 1565 return; 1566 } 1567 if ( $this.closest( '.mega-menu .menu-block' ).length ) { 1568 return; 1569 } 1570 var pluginOptions = $this.data( 'plugin-options' ); 1571 if ( pluginOptions ) 1572 opts = pluginOptions; 1573 1574 setTimeout( function() { 1575 $this.themeCarousel( opts ); 1576 }, 0 ); 1577 } ); 1578 } ); 1579 1580 } 1581 // Fixed video 1582 $wrap.find( '.video-fixed' ).each( function() { 1583 var $this = $( this ), 1584 $video = $this.find( 'video, iframe' ); 1585 1586 if ( $video.length ) { 1587 window.addEventListener( 'scroll', function() { 1588 var offset = $( window ).scrollTop() - $this.position().top + theme.adminBarHeight(); 1589 $video.css( "cssText", "top: " + offset + "px !important;" ); 1590 }, { passive: true } ); 1591 } 1592 } ); 1593 setTimeout( function() { 1594 // Search 1595 if ( typeof theme.Search !== 'undefined' ) { 1596 theme.Search.initialize(); 1597 } 1598 }, 0 ); 1599 if ( typeof theme.isAsyncInit == 'undefined' ) { 1600 theme.isAsyncInit = -1; //initial 1601 } 1602 $( document.body ).trigger( 'porto_after_async_init', [ $wrap, wrapObj ] ); 1603 theme.isAsyncInit = 1; 1604 }; 1605 1606 $( document.body ).trigger( 'porto_async_init' ); 1607} ).apply( this, [window.theme, jQuery] ); 1608 1609jQuery( document ).ready( function( $ ) { 1610 'use strict'; 1611 1612 function porto_modal_open( $this ) { 1613 var trigger = $this.data( 'trigger-id' ), 1614 overlayClass = $this.data( 'overlay-class' ), 1615 disableOverlay = $this.data( 'disable-overlay' ), 1616 extraClass = $this.data( 'extra-class' ) ? $this.data( 'extra-class' ) : '', 1617 type = $this.data( 'type' ), 1618 buttonPopup = false, 1619 isExist = 0; 1620 if ( typeof trigger != 'undefined'/* && $('#' + escape(trigger)).length > 0*/ ) { 1621 if ( typeof type == 'undefined' ) { 1622 type = 'inline'; 1623 } 1624 if ( type == 'inline' ) { 1625 trigger = '#' + escape( trigger ); 1626 } 1627 if ( typeof $.magnificPopup.instance != 'undefined' && $.magnificPopup.instance.isOpen ) { 1628 isExist = 350; 1629 $.magnificPopup.close(); // Destroy before init 1630 } 1631 1632 try { 1633 if ( document.querySelector( trigger ) ) { 1634 if ( 'script' == document.querySelector( trigger ).nodeName.toLowerCase() ) { // Dynamic Popup Click 1635 trigger = $( trigger ).html(); 1636 disableOverlay = $( trigger ).data( 'disable-overlay' ); 1637 overlayClass = $( trigger ).data( 'overlay-class' ); 1638 extraClass = 'button-popup '; 1639 buttonPopup = true; 1640 } 1641 } 1642 } catch( e ) { 1643 1644 } 1645 1646 var args = { 1647 items: { 1648 src: trigger 1649 }, 1650 type: type, 1651 mainClass: extraClass + ( disableOverlay ? ' popup-builder-disable-overlay ' : '' ), 1652 prependTo: $( '.page-wrapper' ) 1653 }; 1654 if ( trigger == '#popup-builder' ) { 1655 args['fixedContentPos'] = true; 1656 } 1657 var $popupModal = $this; 1658 if ( buttonPopup ) { 1659 args['fixedContentPos'] = true; 1660 if ( disableOverlay ) { 1661 args['closeOnBgClick'] = false; 1662 args['fixedContentPos'] = false; 1663 args['focus'] = '.bb-none'; // random selector 1664 } 1665 args['callbacks'] = { 1666 'open': function () { 1667 if ( disableOverlay ) { 1668 $( '.button-popup.mfp-bg' ).remove(); 1669 1670 } 1671 // Update bootstrap tooltip for Popup 1672 var $popup_builder = $( '.button-popup.mfp-wrap' ); 1673 if ( typeof theme.porto_init_builder_tooltip == 'function' ) { 1674 theme.porto_init_builder_tooltip( $popup_builder.get(0) ); 1675 } 1676 porto_init( $popup_builder ); 1677 1678 if ( $popup_builder.find( '.wpcf7' ).length ) { 1679 var $wpcf7 = $popup_builder.find( '.wpcf7 .wpcf7-form' ); 1680 if ( typeof wpcf7 == 'object' ) { 1681 if ( typeof wpcf7.initForm == 'function' ) { 1682 wpcf7.initForm( $wpcf7 ); 1683 } else if ( typeof wpcf7.init == 'function' ) { 1684 wpcf7.init( $wpcf7.get( 0 ) );
1685 $wpcf7.get( 0 ).classList.replace( "no-js", "js" ); 1686 } 1687 } 1688 } 1689 if ( $popup_builder.find( '.wpforms-container' ).length ) { 1690 if ( typeof wpforms == 'object' && typeof wpforms.init == 'function' ) { 1691 wpforms.init(); 1692 } 1693 } 1694 } 1695 }; 1696 } 1697 if ( $this.hasClass( 'porto-onload' ) || $this.hasClass( 'porto-exit-intent' ) ) { 1698 if ( disableOverlay ) { 1699 args['closeOnBgClick'] = false; 1700 args['fixedContentPos'] = false; 1701 args['focus'] = '.bb-none'; // random selector 1702 } 1703 args['callbacks'] = { 1704 'beforeClose': function() { 1705 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' ) ) ) { 1706 $.cookie( 'porto_modal_disable_onload', 'true', { expires: 7 } ); 1707 } else if ( 'undefined' !== typeof $popupModal.data( 'expired' ) && 'undefined' !== typeof $popupModal.data( 'popup-id' ) ) { 1708 $.cookie( 'porto_modal_disable_period_onload_' + $popupModal.data( 'popup-id' ), $popupModal.data('expired'), { expires: $popupModal.data('expired') } ); 1709 } 1710 }, 1711 'afterClose': function() { 1712 // If minicart(cart, wishlist) opened, keep disabling mouse scrolling 1713 if ( $( '#header .minicart-opened' ).length ) { 1714 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', theme.getScrollbarWidth() ); 1715 $( 'html' ).css( 'overflow', 'hidden' ); 1716 } 1717 }, 1718 'open': function () { 1719 if ( disableOverlay ) { 1720 $( '.popup-builder.mfp-bg' ).remove(); 1721 } 1722 // Update bootstrap tooltip for Popup 1723 var $popup_builder = $( '.mfp-wrap .porto-block[data-bs-original-title]' ); 1724 if ( $popup_builder.length ) { 1725 bootstrap.Tooltip.getInstance( $popup_builder[0] ).update(); 1726 } 1727 if ( $popup_builder.find( '.marquee' ).length && $.isFunction( $.fn.marquee ) ) { 1728 $popup_builder.find( '.marquee' ).marquee( { 1729 duration: 5000, 1730 gap: 0, 1731 delayBeforeStart: 0, 1732 direction: 'left', 1733 duplicated: true 1734 } ); 1735 } 1736 if ( $( '.mfp-wrap .porto-block .owl-carousel' ) ) { 1737 $( '.mfp-wrap .porto-block .owl-carousel' ).trigger( 'refresh.owl.carousel' ); 1738 } 1739 } 1740 }; 1741 } 1742 if ( typeof overlayClass != "undefined" && overlayClass ) { 1743 args.mainClass += escape( overlayClass ); 1744 } 1745 setTimeout( () => { 1746 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, args ), 0 ); 1747 }, isExist ); 1748 1749 } 1750 } 1751 theme.porto_modal_open = porto_modal_open; 1752 function porto_init_magnific_popup_functions( $wrap ) { 1753 if ( typeof $wrap == 'undefined' || !$wrap.length ) { 1754 $wrap = $( document.body ); 1755 } 1756 $wrap.find( '.lightbox:not(.manual)' ).each( function() { 1757 var $this = $( this ), 1758 opts; 1759 if ( $this.find( '>.lb-dataContainer' ).length ) { 1760 return; 1761 } 1762 var pluginOptions = $this.data( 'lightbox-options' ); 1763 if ( pluginOptions ) { 1764 opts = pluginOptions; 1765 } else { 1766 pluginOptions = $this.data( 'plugin-options' ); 1767 if ( typeof pluginOptions != 'object' ) { 1768 pluginOptions = JSON.parse( pluginOptions ); 1769 } 1770 if ( pluginOptions ) { 1771 opts = pluginOptions; 1772 } 1773 } 1774 1775 $this.themeLightbox( opts ); 1776 } ); 1777 1778 // Popup with video or map 1779 $wrap.find( '.porto-popup-iframe' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 1780 disableOn: 700, 1781 type: 'iframe', 1782 mainClass: 'mfp-fade', 1783 removalDelay: 160, 1784 preloader: false, 1785 fixedContentPos: false 1786 } ) ); 1787 1788 // Popup with ajax 1789 $wrap.find( '.porto-popup-ajax' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 1790 type: 'ajax' 1791 } ) ); 1792 1793 // Popup with content 1794 $wrap.find( '.porto-popup-content' ).each( function() { 1795 var animation = $( this ).attr( 'data-animation' ); 1796 $( this ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 1797 type: 'inline', 1798 fixedContentPos: false, 1799 fixedBgPos: true, 1800 overflowY: 'auto', 1801 closeBtnInside: true, 1802 preloader: false, 1803 midClick: true, 1804 removalDelay: 300, 1805 mainClass: animation 1806 } ) ); 1807 } ); 1808 1809 // Porto Modal 1810 $wrap.find( '.popup-youtube, .popup-vimeo, .popup-gmaps' ).each( function( index ) { 1811 var overlayClass = $( this ).find( '.porto-modal-trigger' ).data( 'overlay-class' ), 1812 args = { 1813 type: 'iframe', 1814 removalDelay: 160, 1815 preloader: false, 1816
1817 fixedContentPos: false 1818 }; 1819 if ( typeof overlayClass != "undefined" && overlayClass ) { 1820 args.mainClass = escape( overlayClass ); 1821 } 1822 $( this ).magnificPopup( args ); 1823 } ); 1824 1825 $wrap.find( '[href*=porto-action_popup-id-]' ).each( function() { 1826 var $this = $( this ), popupId = $this.attr( 'href' ); 1827 if ( popupId = popupId.match(/#porto-action_popup-id-(\d+)/)[1] ) { 1828 $this.attr( 'data-trigger-id', 'popup-id-' + popupId ); 1829 $this.addClass( 'porto-modal-trigger' ); 1830 } 1831 } ); 1832 1833 if ( $wrap.find( '.porto-modal-trigger.porto-onload' ).length ) { 1834 var $obj = $wrap.find( '.porto-modal-trigger.porto-onload' ).eq( 0 ), 1835 timeout = 0; 1836 if ( $obj.data( 'timeout' ) ) { 1837 timeout = parseInt( $obj.data( 'timeout' ), 10 ); 1838 } 1839 setTimeout( function() { 1840 porto_modal_open( $obj ); 1841 }, timeout ); 1842 } 1843 $wrap.on( 'click', '.porto-modal-trigger', function( e ) { 1844 e.preventDefault(); 1845 porto_modal_open( $( this ) ); 1846 } ); 1847 1848 /* Woocommerce */ 1849 // login popup 1850 if ( $wrap.hasClass( 'login-popup' ) ) { 1851 $wrap.find( '.porto-link-login, .porto-link-register' ).magnificPopup( { 1852 items: { 1853 src: theme.ajax_url + ( -1 === theme.ajax_url.indexOf( '?' ) ? '?' : '&' ) + 'action=porto_account_login_popup&nonce=' + js_porto_vars.porto_nonce, 1854 type: 'ajax' 1855 }, 1856 tLoading: '<i class="porto-loading-icon"></i>', 1857 callbacks: { 1858 ajaxContentAdded: function() { 1859 $( window ).trigger( 'porto_login_popup_opened' ); 1860 } 1861 } 1862 } ); 1863 } 1864 1865 if ( typeof PhotoSwipe != 'undefined' ) { 1866 let _images = $wrap.find( '.product-images' ), links = [], i = 0; 1867 _images.find( 'img' ).each( function() { 1868 var slide = {}; 1869 1870 slide.src = $( this ).attr( 'href' ); 1871 slide.title = $( this ).attr( 'alt' ); 1872 slide.w = parseInt( $( this ).attr( 'data-large_image_width' ) ); 1873 slide.h = parseInt( $( this ).attr( 'data-large_image_height' ) ); 1874 1875 links[i] = slide; 1876 i++; 1877 } ); 1878 _images.data( 'links', links ); 1879 _images.on( 'click', '.img-thumbnail a.zoom', function( e ) { 1880 e.preventDefault(); 1881 var options = $.extend( { 1882 index: $( this ).closest( '.img-thumbnail' ).index(), 1883 addCaptionHTMLFn: function( item, captionEl ) { 1884 if ( ! item.title ) { 1885 captionEl.children[0].textContent = ''; 1886 return false; 1887 } 1888 captionEl.children[0].textContent = item.title; 1889 return true; 1890 } 1891 }, wc_single_product_params.photoswipe_options ); 1892 1893 // Initializes and opens PhotoSwipe. 1894 var photoswipe = new PhotoSwipe( $( '.pswp' )[0], PhotoSwipeUI_Default, _images.data( 'links' ), options ); 1895 photoswipe.init(); 1896 } ); 1897 1898 1899 } else { 1900 $wrap.find( '.product-images' ).magnificPopup( 1901 $.extend( true, {}, theme.mfpConfig, { 1902 delegate: '.img-thumbnail a.zoom', 1903 type: 'image', 1904 gallery: { enabled: true } 1905 } ) 1906 ); 1907 } 1908 $wrap.find( '.porto-posts-grid' ).each( function() { 1909 $( this ).magnificPopup( 1910 $.extend( true, {}, theme.mfpConfig, { 1911 delegate: '.porto-tb-featured-image span.zoom, .porto-tb-featured-image a.zoom, .post-image span.zoom', 1912 type: 'image', 1913 gallery: { enabled: true } 1914 } ) 1915 ); 1916 } ); 1917 $wrap.find( '.porto-posts-grid .tb-image-type-slider div.zoom' ).each( function() { 1918 var $this = $( this ), 1919 links = []; 1920 $this.find( 'a' ).each( function() { 1921 var slide = {}; 1922 slide.src = $( this ).attr( 'href' ); 1923 slide.title = $( this ).attr( 'title' ); 1924 links.push( slide ); 1925 } ); 1926 if ( links.length ) { 1927 $this.on( 'click', function() { 1928 var $slider = $this.siblings( '.porto-carousel' ); 1929 if ( $slider.length ) { 1930 var offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2; 1931 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 1932 items: links, 1933 gallery: { 1934 enabled: true 1935 }, 1936 type: 'image' 1937 } ), offset ); 1938 } 1939 } ); 1940 } 1941 } ); 1942 } 1943 1944 if ( $.fn.magnificPopup ) { 1945 porto_init_magnific_popup_functions(); 1946 } else { 1947 setTimeout( function() { 1948 if ( $.fn.magnificPopup ) { 1949 porto_init_magnific_popup_functions(); 1950 } 1951 }, 500 ); 1952 } 1953 $( document.body ).on( 'porto_load_posts_end', function( e, $posts_wrap ) { 1954 if ( $.fn.magnificPopup ) { 1955 porto_init_magnific_popup_functions( $posts_wrap ); 1956 } 1957 } ); 1958 1959 // Post Filter
1960 if ( typeof theme.PostFilter !== 'undefined' ) { 1961 var $postFilterElements = $( 'ul[data-filter-type], .portfolio-filter, .member-filter, .faq-filter, .porto-ajax-filter.product-filter, .porto-ajax-filter.post-filter' ); 1962 if ( $postFilterElements.length ) { 1963 theme.PostFilter.initialize( $postFilterElements ); 1964 } 1965 } 1966 1967 // Post ajax pagination 1968 $( 'body' ).on( 'click', '.porto-ajax-load .pagination:not(.load-more) .page-numbers', function( e ) { 1969 var $this = $( this ); 1970 if ( $this.hasClass( 'current' ) || $this.hasClass( 'dots' ) ) { 1971 return; 1972 } 1973 e.preventDefault(); 1974 var $wrap = $this.closest( '.porto-ajax-load' ), 1975 post_type = $wrap.data( 'post_type' ), 1976 $obj = $wrap.find( '.' + post_type + 's-container' ); 1977 1978 if ( !$obj.length || $wrap.hasClass( 'loading' ) ) { 1979 return; 1980 } 1981 $wrap.addClass( 'loading' ); 1982 var $filter = $wrap.find( '.porto-ajax-filter' ), 1983 cat = $filter.length && $filter.children( '.active' ).length && $filter.children( '.active' ).data( 'filter' ); 1984 if ( '*' == cat ) { 1985 cat = ''; 1986 } 1987 var default_args = {}, 1988 page = $this.attr( 'href' ).match( /paged=(\d+)|page\/(\d+)/ ); 1989 1990 if ( page && Array.isArray( page ) && ( page[1] || page[2] ) ) { 1991 default_args['page'] = parseInt( page[1] || page[2] ); 1992 } else { 1993 if ( $this.hasClass( 'prev' ) ) { 1994 default_args['page'] = parseInt( $this.next().text() ); 1995 } else if ( $this.hasClass( 'next' ) ) { 1996 default_args['page'] = parseInt( $this.prev().text() ); 1997 } else { 1998 default_args['page'] = parseInt( $this.text() ); 1999 } 2000 } 2001 if ( cat == '' && $wrap.find( 'input[type=hidden].category' ).length ) { 2002 cat = $wrap.find( 'input[type=hidden].category' ).val(); 2003 default_args['taxonomy'] = $wrap.find( 'input[type=hidden].taxonomy' ).val(); 2004 } 2005 theme.PostFilter.load_posts( cat, $wrap.hasClass( 'load-infinite' ), $wrap, post_type, $obj, default_args, $this.attr( 'href' ) ); 2006 2007 } ); 2008 2009 // Filter Zooms 2010 if ( typeof theme.FilterZoom !== 'undefined' ) { 2011 // Portfolio Filter Zoom 2012 theme.FilterZoom.initialize( $( '.page-portfolios' ) ); 2013 // Member Filter Zoom 2014 theme.FilterZoom.initialize( $( '.page-members' ) ); 2015 // Posts Related Style Filter Zoom 2016 theme.FilterZoom.initialize( $( '.blog-posts-related' ) ); 2017 } 2018 2019 // close popup using esc key 2020 var $minicart_offcanvas = $( '.minicart-offcanvas' ), 2021 $wl_offcanvas = $( '.wishlist-offcanvas' ), 2022 $mobile_sidebar = $( '.mobile-sidebar' ), 2023 $mobile_panel = $( '#side-nav-panel' ), 2024 $overlay_search = $( '#header .btn-close-search-form' ), 2025 $html = $( 'html' ); 2026 if ( $minicart_offcanvas.length || $wl_offcanvas.length || $mobile_sidebar.length || $mobile_panel.length || $( '.skeleton-loading' ).length || $overlay_search.length ) { 2027 $( document.documentElement ).on( 'keyup', function( e ) { 2028 try { 2029 if ( e.keyCode == 27 ) { 2030 $minicart_offcanvas.removeClass( 'minicart-opened' ); 2031 $wl_offcanvas.removeClass( 'minicart-opened' ); 2032 if ( $mobile_sidebar.length ) { 2033 $html.removeClass( 'filter-sidebar-opened' ); 2034 $html.removeClass( 'sidebar-opened' ); 2035 $( '.sidebar-overlay' ).removeClass( 'active' ); 2036 $( 'html' ).css( 'overflow', '' ); 2037 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', '' ); 2038 } 2039 if ( $mobile_panel.length && $html.hasClass( 'panel-opened' ) ) { 2040 $html.removeClass( 'panel-opened' ); 2041 $( '.panel-overlay' ).removeClass( 'active' ); 2042 } 2043 if ( $overlay_search.length ) { 2044 $overlay_search.trigger( 'click' ); 2045 } 2046 } 2047 } catch ( err ) { } 2048 } ); 2049 $( '.skeleton-loading' ).on( 'skeleton-loaded', function() { 2050 $mobile_sidebar = $( '.mobile-sidebar' ); 2051 } ); 2052 } 2053} );
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.