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' ) || $parent.data( 'pid' ), 892 self = this, 893 is_archive = $parent.hasClass( 'archive-posts' ); 894 if ( ! pid ) { 895 if ( typeof theme.PostFilter.load_posts.pid == 'undefined' ) { 896 theme.PostFilter.load_posts.pid = 0; 897 } 898 theme.PostFilter.load_posts.pid += 1; 899 pid = 'porto_posts_grid_cache_' + theme.PostFilter.load_posts.pid; 900 $parent.data('pid', pid); 901 } 902 var successfn = function( res, directcall ) { 903 if ( !res ) { 904 return; 905 } 906 if ( ( typeof directcall == 'undefined' || true !== directcall ) && typeof default_args == 'undefined' && pid ) { 907 if ( !self.cache[pid] ) { 908 self.cache[pid] = {}; 909 } 910 self.cache[pid][cat + _gridcookie] = res; 911 } 912 var $res = $( res ), 913 is_shop = $parent.hasClass( 'archive-products' ), 914 $posts = $res.find( is_archive ? '.archive-posts .posts-wrap' : '.posts-wrap' ).children(); 915 916 if ( !$posts.length ) { 917 return; 918 } 919 920 if ( typeof $posts_wrap == 'undefined' || is_archive ) { 921 $posts_wrap = $parent.find( '.' + post_type + 's-container' ); 922 } 923 if ( !$posts_wrap.length ) { 924 return; 925 } 926 927 if ( $posts_wrap.data( 'isotope' ) ) { 928 $posts_wrap.isotope( 'remove', $posts_wrap.children() ); 929 } else { 930 $posts_wrap.children().remove(); 931 } 932 933 if ( $posts_wrap.hasClass( 'owl-loaded' ) ) { 934 $posts_wrap.removeClass( 'owl-loaded' ); 935 } 936 $posts.children().addClass( 'fadeInUp animated' ); 937 $posts_wrap.append( $posts ); 938 theme.refreshVCContent( $posts ); 939 940 // filter 941 var $old_filter = $parent.find( '.' + post_type + '-filter' ); 942 if ( $old_filter.length && !$old_filter.hasClass( 'porto-ajax-filter' ) && !$parent.hasClass( 'load-infinite' ) && !$parent.hasClass( 'load-more' ) ) { 943 var $new_filter = $res.find( ( is_archive ? '.archive-posts ' : '' ) + '.' + post_type + '-filter' ); 944 if ( $new_filter.length ) { 945 $old_filter.find( 'li:first-child' ).trigger( 'click' ); 946 theme.PostFilter.destroy( $old_filter ); 947 $old_filter.replaceWith( $new_filter ); 948 //$new_filter = $parent.find( '.' + post_type + '-filter' ); 949 theme.PostFilter.initialize( $new_filter, post_type ); 950 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' ) ); 951 } 952 } 953 954 porto_init( $parent ); 955 956 var behavior_action = ''; 957 if ( post_type != 'product' && post_type != 'member' && post_type != 'faq' && post_type != 'portfolio' && post_type != 'post' ) { 958 behavior_action = 'ptu'; 959 } else { 960 behavior_action = post_type; 961 } 962 theme.PostsInfinite[behavior_action + 'Behavior']( $posts, $posts_wrap ); 963 964 // init CountDown 965 $( document.body ).trigger( 'porto_init_countdown', [$posts_wrap] ); 966 967 // pagination 968 var $old_pagination = $parent.find( '.pagination-wrap' ), 969 $new_pagination = $res.find( ( is_archive ? '.archive-posts ' : '' ) + '.pagination-wrap' ).eq( 0 ), 970 has_pagination = false, 971 nst_pagination = false; 972 if ( $old_pagination.length ) { 973 if ( $new_pagination.length ) { 974 $old_pagination.replaceWith( $new_pagination ); 975 has_pagination = true; 976 nst_pagination = true; 977 } else { 978 $old_pagination.children().remove(); 979 } 980 } else if ( $new_pagination.length ) { 981 $parent.append( $new_pagination ); 982 has_pagination = true; 983 nst_pagination = true; 984 } 985 986 if ( is_shop ) { // shop builder with counter per page widget 987 let _paginationWrap = $( '.woocommerce-pagination' ); 988 var $old_pagination = _paginationWrap.find( 'ul.page-numbers' ), 989 $new_pagination = $res.find( '.woocommerce-pagination ul.page-numbers' ).eq( 0 ), 990 has_pagination = false; 991 if ( $old_pagination.length ) { 992 if ( $new_pagination.length ) { 993 $old_pagination.replaceWith( $new_pagination ); 994 has_pagination = true; 995 } else { 996 $old_pagination.children().remove(); 997 } 998 } else if ( $new_pagination.length ) { 999 _paginationWrap.append( $new_pagination ); 1000 has_pagination = true; 1001 } 1002 } 1003 1004 1005 if ( is_infinite ) { 1006 var infinitescroll_ins = $posts_wrap.data( 'infinitescroll' ); 1007 if ( has_pagination || ( is_shop && nst_pagination ) ) { 1008 var $new_posts_wrap = $res.find( is_archive ? '.archive-posts .posts-wrap' : '.posts-wrap' ); 1009 if ( $new_posts_wrap.data( 'cur_page' ) ) { 1010 $posts_wrap.data( 'cur_page', $new_posts_wrap.data( 'cur_page' ) ); 1011 $posts_wrap.data( 'max_page', $new_posts_wrap.data( 'max_page' ) ); 1012 } 1013 1014 var should_init_again = true; 1015 if ( infinitescroll_ins ) { 1016 if ( infinitescroll_ins.options.state.isDestroyed ) { 1017 $posts_wrap.removeData( 'infinitescroll' ); 1018 } else { 1019 should_init_again = false; 1020 if ( $new_posts_wrap.data( 'cur_page' ) ) { 1021 infinitescroll_ins.update( { 1022 maxPage: $new_posts_wrap.data( 'max_page' ), 1023 state: { 1024 currPage: $new_posts_wrap.data( 'cur_page' ) 1025 } 1026 } ); 1027 }
1028 if ( infinitescroll_ins.options.state.isPaused ) { 1029 infinitescroll_ins.resume(); 1030 } 1031 } 1032 } 1033 1034 if ( should_init_again ) { 1035 var ins = $posts_wrap.data( '__postsinfinite' ); 1036 if ( ins ) { 1037 ins.destroy(); 1038 } 1039 var selector_product = '.' + post_type + ', .timeline-date'; 1040 if ( is_shop ) { 1041 selector_product = '.archive-products .product'; 1042 if ( $( '.elementor-widget-wc-archive-products' ).length ) { 1043 selector_product = '.elementor-widget-wc-archive-products .product'; 1044 } 1045 } 1046 new theme.PostsInfinite( $posts_wrap, selector_product, $posts_wrap.data( 'infiniteoptions' ), post_type ); 1047 } 1048 1049 if ( is_archive ) { 1050 var page_path = $posts_wrap.siblings( '.pagination-wrap' ).find( '.next' ).attr( 'href' ); 1051 if ( page_path ) { 1052 page_path += ( -1 !== page_path.indexOf( '?' ) ? '&' : '?' ) + 'portoajax=1&load_posts_only=2'; 1053 page_path = page_path.replace( /(paged=)(\d+)|(page\/)(\d+)/, '$1$3%cur_page%' ); 1054 $posts_wrap.data( 'page_path', page_path ); 1055 } 1056 } 1057 var selector_product = '.' + post_type + ', .timeline-date'; 1058 if ( is_shop ) { 1059 selector_product = '.archive-products .product'; 1060 if ( $( '.elementor-widget-wc-archive-products' ).length ) { 1061 selector_product = '.elementor-widget-wc-archive-products .product'; 1062 } 1063 } 1064 new theme.PostsInfinite( $posts_wrap, selector_product, $posts_wrap.data( 'infiniteoptions' ), post_type ); 1065 } 1066 } 1067 1068 // in archive page 1069 if ( is_archive ) { 1070 // update widgets 1071 $( '.sidebar-content' ).each( function( index ) { 1072 var $this = $( this ), 1073 $that = $( $res.find( '.sidebar-content' ).get( index ) ); 1074 1075 $this.html( $that.html() ); 1076 1077 // in shop 1078 if ( is_shop ) { 1079 if ( typeof updateSelect2 != 'undefined' && updateSelect2 ) { 1080 // Use Select2 enhancement if possible 1081 if ( jQuery().selectWoo ) { 1082 var porto_wc_layered_nav_select = function() { 1083 $this.find( 'select.woocommerce-widget-layered-nav-dropdown' ).each( function() { 1084 $( this ).selectWoo( { 1085 placeholder: $( this ).find( 'option' ).eq( 0 ).text(), 1086 minimumResultsForSearch: 5, 1087 width: '100%', 1088 allowClear: typeof $( this ).attr( 'multiple' ) != 'undefined' && $( this ).attr( 'multiple' ) == 'multiple' ? 'false' : 'true' 1089 } ); 1090 } ); 1091 }; 1092 porto_wc_layered_nav_select(); 1093 } 1094 $( 'body' ).children( 'span.select2-container' ).remove(); 1095 } 1096 } 1097 } ); 1098 1099 // in shop 1100 if ( is_shop ) { 1101 var $script = $res.filter( 'script:contains("var woocommerce_price_slider_params")' ).first(); 1102 if ( $script && $script.length && $script.text().indexOf( '{' ) !== -1 && $script.text().indexOf( '}' ) !== -1 ) { 1103 var arrStr = $script.text().substring( $script.text().indexOf( '{' ), $script.text().indexOf( '}' ) + 1 ); 1104 window.woocommerce_price_slider_params = JSON.parse( arrStr ); 1105 } 1106 1107 // update entry title 1108 var $title = $( '.entry-title' ); 1109 if ( $title.length ) { 1110 var $newTitle = $res.find( '.entry-title' ).eq( 0 ); 1111 if ( $newTitle.length ) { 1112 $title.html( $newTitle.html() ); 1113 } 1114 } 1115 1116 // update entry description 1117 var $desc = $( '.entry-description' ); 1118 if ( $desc.length ) { 1119 var $newDesc = $res.find( '.entry-description' ).eq( 0 ); 1120 if ( $newDesc.length ) { 1121 $desc.html( $newDesc.html() ); 1122 } 1123 } 1124 1125 // top toolbar 1126 var shop_before = '.shop-loop-before', 1127 $shop_before = $( shop_before ); 1128 if ( $shop_before.length ) { 1129 if ( $res.find( shop_before ).length ) { 1130 $shop_before.each( function( index ) { 1131 var $res_shop_before = $res.find( shop_before ).eq( index ); 1132 if ( $res_shop_before.length ) { 1133 $( this ).html( $res_shop_before.html() ).show(); 1134 } 1135 } ); 1136 } else { 1137 $shop_before.empty(); 1138 } 1139 } 1140 1141 // update result count 1142 var $count = $( '.woocommerce-result-count' ); 1143 if ( $count.length ) { 1144 var $newCount = $res.find( '.woocommerce-result-count' ).eq( 0 ); 1145 if ( $newCount.length ) { 1146 $count[0].outerHTML = $newCount.length ? $newCount[0].outerHTML : ''; 1147 } 1148 } 1149 1150 // trigger ready event 1151 $( document ).trigger( 'yith_wcan_init_shortcodes' ); 1152 $( document ).trigger( 'yith-wcan-ajax-filtered' ); 1153 } 1154 1155 // update browser history (IE doesn't support it) 1156 if ( page_url && !navigator.userAgent.match( /msie/i ) ) { 1157 window.history.pushState( { 'pageTitle': ( res && res.pageTitle ) || '' }, '', page_url ); 1158 } 1159 } 1160 1161 $( document.body ).trigger( 'porto_load_posts_end', [$parent.parent()] ); 1162 }; 1163 1164 if ( typeof default_args == 'undefined' && typeof self.cache[pid] != 'undefined' && typeof self.cache[pid][cat+ _gridcookie] != 'undefined' && self.cache[pid][cat+ _gridcookie] ) { 1165 successfn( self.cache[pid][cat+ _gridcookie], true ); 1166 self.isLoading = false; 1167 $parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove(); 1168 return; 1169 } 1170 1171 var ajax_load_options = $parent.data( 'ajax_load_options' ); 1172 if ( ( $parent.hasClass( 'archive-products' ) && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'shop' ) ) || 1173 ( is_archive && -1 != js_porto_vars.use_skeleton_screen.indexOf( 'blog' ) ) ) { // skeleton
1173screen in archive builder 1174 $posts_wrap = $parent.find( '.' + post_type + 's-container' ); 1175 if ( ajax_load_options ) { 1176 var tag_name = 'div'; 1177 if ( 'product' == post_type && 'ul' == $posts_wrap.get( 0 ).tagName.toLowerCase() ) { 1178 tag_name = 'li'; 1179 } 1180 $posts_wrap.addClass( 'skeleton-body' ).empty(); 1181 for ( var i = 0; i < Number( ajax_load_options.count || ( ajax_load_options.columns && ajax_load_options.columns * 3 ) || 12 ); i++ ) { 1182 $posts_wrap.append( '<' + tag_name + ' class="porto-tb-item post ' + post_type + ( 'product' == post_type ? ' product-col' : '' ) + '"></' + tag_name + '>' ); 1183 } 1184 } else { 1185 $posts_wrap.addClass( 'skeleton-body' ).children().empty(); 1186 } 1187 } else { 1188 if ( !$parent.children( '.porto-loading-icon' ).length ) { 1189 $parent.append( '<i class="porto-loading-icon"></i>' ); 1190 } 1191 $parent.addClass( 'porto-ajax-loading' ); 1192 } 1193 1194 var current_url = window.location.href; 1195 if ( -1 !== current_url.indexOf( '#' ) ) { 1196 current_url = current_url.split( '#' )[0]; 1197 } 1198 1199 var args, load_url = theme.ajax_url; 1200 if ( $parent.hasClass( 'archive-posts' ) ) { // archive builder 1201 args = { 1202 portoajax: true, 1203 load_posts_only: true 1204 }; 1205 if ( $parent.closest( '.porto-block' ).length ) { 1206 args['builder_id'] = $parent.closest( '.porto-block' ).data( 'id' ); 1207 } 1208 load_url = typeof page_url != 'undefined' ? page_url : current_url; 1209 } else { 1210 args = { 1211 action: 'porto_ajax_posts', 1212 nonce: js_porto_vars.porto_nonce, 1213 post_type: post_type, 1214 current_link: current_url 1215 }; 1216 if ( $parent.data( 'post_layout' ) ) { 1217 args['post_layout'] = $parent.data( 'post_layout' ); 1218 } 1219 if ( ajax_load_options ) { 1220 args['extra'] = ajax_load_options; 1221 } 1222 if ( typeof default_args != 'undefined' ) { 1223 args = $.extend( args, default_args ); 1224 } 1225 } 1226 if ( cat ) { 1227 args['category'] = cat; 1228 } 1229 1230 $.ajax( { 1231 url: load_url, 1232 type: 'post', 1233 data: args, 1234 success: successfn, 1235 complete: function() { 1236 self.isLoading = false; 1237 $posts_wrap.removeClass( 'skeleton-body' ); 1238 $parent.removeClass( 'porto-ajax-loading' ).removeClass( 'loading' ).find( '.porto-loading-icon' ).remove(); 1239 } 1240 } ); 1241 1242 } 1243 } 1244 1245 } ); 1246 1247} ).apply( this, [window.theme, jQuery] ); 1248 1249// Filter Zoom 1250( function( theme, $ ) { 1251 'use strict'; 1252 1253 theme = theme || {}; 1254 1255 $.extend( theme, { 1256 1257 FilterZoom: { 1258 1259 defaults: { 1260 elements: null 1261 }, 1262 1263 initialize: function( $elements ) { 1264 this.$elements = ( $elements || this.defaults.elements ); 1265 1266 this.build(); 1267 1268 return this; 1269 }, 1270 1271 build: function() { 1272 var self = this; 1273 1274 self.$elements.each( function() { 1275 var $this = $( this ), 1276 zoom = $this.find( '.zoom, .thumb-info-zoom' ).get( 0 ); 1277 1278 if ( !zoom ) return; 1279 1280 $this.find( '.zoom, .thumb-info-zoom' ).off( 'click' ); 1281 var links = []; 1282 var i = 0; 1283 $this.find( 'article' ).each( function() { 1284 var $that = $( this ); 1285 if ( $that.css( 'display' ) != 'none' ) { 1286 var $zoom = $that.find( '.zoom, .thumb-info-zoom' ), 1287 slide, 1288 src = $zoom.data( 'src' ), 1289 title = $zoom.data( 'title' ); 1290 1291 $zoom.data( 'index', i ); 1292 if ( Array.isArray( src ) ) { 1293 $.each( src, function( index, value ) { 1294 slide = {}; 1295 slide.src = value; 1296 slide.title = title[index]; 1297 links[i] = slide; 1298 i++; 1299 } ); 1300 } else { 1301 slide = {}; 1302 slide.src = src; 1303 slide.title = title; 1304 links[i] = slide; 1305 i++; 1306 } 1307 } 1308 } ); 1309 $this.find( 'article' ).each( function() { 1310 var $that = $( this ); 1311 if ( $that.css( 'display' ) != 'none' ) { 1312 $that.off( 'click', '.zoom, .thumb-info-zoom' ).on( 'click', '.zoom, .thumb-info-zoom', function( e ) {
1313 var $zoom = $( this ), $parent = $zoom.parents( '.thumb-info' ), offset = 0; 1314 if ( $parent.get( 0 ) ) { 1315 var $slider = $parent.find( '.porto-carousel' ); 1316 if ( $slider.get( 0 ) ) { 1317 offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2; 1318 } 1319 } 1320 e.preventDefault(); 1321 if ( $.fn.magnificPopup ) { 1322 $.magnificPopup.close(); 1323 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 1324 items: links, 1325 gallery: { 1326 enabled: true 1327 }, 1328 type: 'image' 1329 } ), $zoom.data( 'index' ) + offset ); 1330 } 1331 return false; 1332 } ); 1333 } 1334 } ); 1335 } ); 1336 1337 return self; 1338 } 1339 } 1340 1341 } ); 1342 1343} ).apply( this, [window.theme, jQuery] ); 1344 1345/* initialize */ 1346( function( theme, $ ) { 1347 theme.initAsync = function( $wrap, wrapObj ) { 1348 // Carousel 1349 if ( $.fn.themeCarousel ) { 1350 1351 $( function() { 1352 1353 var portoImgNavMiddle = function ( $el ) { 1354 var $images = $el.find( '.owl-item img' ), 1355 height = 0; 1356 for ( var i = 0; i < $images.length; i++) { 1357 var imgHeight = $images.eq(i).height(); 1358 if ( height < imgHeight ) { 1359 height = imgHeight; 1360 } 1361 } 1362 if ( $el.hasClass( 'products-slider' ) ) { 1363 $el.children( '.owl-nav' ).css( 'top', ( 5 + height / 2 ) + 'px' ); 1364 } else { 1365 $el.children( '.owl-nav' ).css( 'top', height / 2 + 'px' ); 1366 } 1367 }; 1368 // Carousel Lazyload images 1369 var portoCarouselInit = function( e ) { 1370 var $this = $( e.currentTarget ); 1371 1372 $this.find( '[data-appear-animation]:not(.appear-animation)' ).addClass( 'appear-animation' ); 1373 if ( $this.find( '.owl-item.cloned' ).length ) { 1374 // compatibility with W3 Total Cache 1375 var $not_loaded = $this.find( 'img.lazy:not(.loaded)' ); 1376 if ( $not_loaded.length ) { 1377 if (typeof window.w3tc_lazyload == 'object') { 1378 window.w3tc_lazyload.update(); 1379 } else if (theme.w3tcLazyLoadInstance) { 1380 theme.w3tcLazyLoadInstance.update(); 1381 } 1382 } 1383 1384 if ( $.fn.themePluginLazyLoad ) { 1385 $this.find( '.porto-lazyload:not(.lazy-load-loaded)' ).themePluginLazyLoad( { effect: 'fadeIn', effect_speed: 400 } ); 1386 } 1387 var $animates = e.currentTarget.querySelectorAll( '.appear-animation' ); 1388 if ( $animates.length ) { 1389 if ( theme.animation_support ) { 1390 // theme.dynIntObsInit( $animates, 'themeAnimate', theme.Animate.defaults ); 1391 } else {
1392 $animates.forEach( function( o ) { 1393 o.classList.add( 'appear-animation-visible' ); 1394 } ); 1395 } 1396 } 1397 if ( $.fn.themePluginAnimatedLetters && ( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ).length ) ) { 1398 theme.dynIntObsInit( $( this ).find( '.owl-item.cloned [data-plugin-animated-letters]:not(.manual)' ), 'themePluginAnimatedLetters' ); 1399 } 1400 } 1401 1402 setTimeout( function() { 1403 var $hiddenItems = $this.find( '.owl-item:not(.active)' ); 1404 if ( theme.animation_support ) { 1405 $hiddenItems.find( '.appear-animation' ).removeClass( 'appear-animation-visible' ); 1406 $hiddenItems.find( '.appear-animation' ).each( function() { 1407 var $el = $( this ), 1408 delay = Math.abs( $el.data( 'appear-animation-delay' ) ? $el.data( 'appear-animation-delay' ) : 0 ); 1409 if ( delay > 1 ) { 1410 this.style.animationDelay = delay + 'ms'; 1411 } 1412 1413 var duration = Math.abs( $el.data( 'appear-animation-duration' ) ? $el.data( 'appear-animation-duration' ) : 1000 ); 1414 if ( 1000 != duration ) { 1415 this.style.animationDuration = duration + 'ms'; 1416 } 1417 } ); 1418 } 1419 if ( window.innerWidth >= 1200 ) { 1420 $hiddenItems.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' ); 1421 } 1422 // Position the navigation in the middle of the image 1423 if ( $this.hasClass( 'nav-center-images-only' ) ) { 1424 portoImgNavMiddle( $this ); 1425 } 1426 }, 300 ); 1427 }; 1428 var portoCarouselTranslated = function( e ) { 1429 var $this = $( e.currentTarget ); 1430 /*if ( window.innerWidth > 767 ) { 1431 if ( $this.find( '.owl-item.cloned' ).length && $this.find( '.appear-animation:not(.appear-animation-visible)' ).length ) { 1432 $( document.body ).trigger( 'appear_refresh' ); 1433 } 1434 }*/ 1435 1436 var $active = $this.find( '.owl-item.active' ); 1437 if ( $active.hasClass( 'translating' ) ) { 1438 $active.removeClass( 'translating' ); 1439 return; 1440 } 1441 $this.find( '.owl-item.translating' ).removeClass( 'translating' ); 1442 // Animated Letters 1443 $this.find( '[data-plugin-animated-letters]' ).removeClass( 'invisible' ); 1444 $this.find( '.owl-item.active [data-plugin-animated-letters]' ).trigger( 'animated.letters.initialize' ); 1445 1446 if ( window.innerWidth > 767 ) { 1447 // WPBakery 1448 $this.find( '.appear-animation' ).removeClass( 'appear-animation-visible' ); 1449 $active.find( '.appear-animation' ).each( function() { 1450 var $animation_item = $( this ), 1451 anim_name = $animation_item.data( 'appear-animation' ); 1452 $animation_item.addClass( anim_name + ' appear-animation-visible' ); 1453 } ); 1454 } 1455 1456 // sticky sidebar 1457 if ( window.innerWidth > 991 ) { 1458 if ( $this.closest( '[data-plugin-sticky]' ).length ) { 1459 theme.refreshStickySidebar( false, $this.closest( '[data-plugin-sticky]' ) ); 1460 } 1461 } 1462 1463 // Elementor 1464 $active.find( '.slide-animate' ).each( function() { 1465 var $animation_item = $( this ), 1466 settings = $animation_item.data( 'settings' ); 1467 if ( settings && ( settings._animation || settings.animation ) ) { 1468 var animation = settings._animation || settings.animation, 1469 delay = settings._animation_delay || settings.animation_delay || 0; 1470 theme.requestTimeout( function() { 1471 $animation_item.removeClass( 'elementor-invisible' ).addClass( 'animated ' + animation ); 1472 }, delay ); 1473 } 1474 } ); 1475 1476 // Visual Composer 1477 if ( window.innerWidth >= 1200 ) { 1478 $this.find( '[data-vce-animate]' ).removeAttr( 'data-vcv-o-animated' ).removeAttr( 'data-vcv-o-animated-fully' ); 1479 $active.find( '[data-vce-animate]' ).each( function() { 1480 var $animation_item = $( this ); 1481 if ( $animation_item.data( 'porto-origin-anim' ) ) { 1482 var anim_name = $animation_item.data( 'porto-origin-anim' ); 1483 $animation_item.attr( 'data-vce-animate', anim_name ).attr( 'data-vcv-o-animated', true ); 1484 var duration = parseFloat( window.getComputedStyle( this )['animationDuration'] ) * 1000,
1485 delay = parseFloat( window.getComputedStyle( this )['animationDelay'] ) * 1000; 1486 window.setTimeout( function() { 1487 $animation_item.attr( 'data-vcv-o-animated-fully', true ); 1488 }, delay + duration + 5 ); 1489 } 1490 } ); 1491 } 1492 }; 1493 var portoCarouselTranslateVC = function( e ) { 1494 var $this = $( e.currentTarget ); 1495 $this.find( '.owl-item.active' ).addClass( 'translating' ); 1496 1497 if ( window.innerWidth >= 1200 ) { 1498 $this.find( '[data-vce-animate]' ).each( function() { 1499 var $animation_item = $( this ); 1500 $animation_item.data( 'porto-origin-anim', $animation_item.data( 'vce-animate' ) ).attr( 'data-vce-animate', '' ); 1501 } ); 1502 } 1503 }; 1504 var portoCarouselTranslateElementor = function( e ) { 1505 var $this = $( e.currentTarget ); 1506 $this.find( '.owl-item.active' ).addClass( 'translating' ); 1507 $this.find( '.owl-item:not(.active) .slide-animate' ).addClass( 'elementor-invisible' ); 1508 $this.find( '.slide-animate' ).each( function() { 1509 var $animation_item = $( this ), 1510 settings = $animation_item.data( 'settings' ); 1511 if ( settings._animation || settings.animation ) { 1512 $animation_item.removeClass( settings._animation || settings.animation ); 1513 } 1514 } ); 1515 }; 1516 var portoCarouselTranslateWPB = function( e ) { 1517 if ( window.innerWidth > 767 ) { 1518 var $this = $( e.currentTarget ); 1519 $this.find( '.owl-item.active' ).addClass( 'translating' ); 1520 $this.find( '.appear-animation' ).each( function() { 1521 var $animation_item = $( this ); 1522 $animation_item.removeClass( $animation_item.data( 'appear-animation' ) ); 1523 } ); 1524 } 1525 }; 1526 1527 var carouselItems = $wrap.find( '.owl-carousel:not(.manual)' ); 1528 carouselItems.on( 'initialized.owl.carousel refreshed.owl.carousel', portoCarouselInit ).on( 'translated.owl.carousel', portoCarouselTranslated ); 1529 carouselItems.on( 'translate.owl.carousel', function() { 1530 // Hide elements inside carousel 1531 $( this ).find( '[data-plugin-animated-letters]' ).addClass( 'invisible' ); 1532 // Animated Letters 1533 $( this ).find( '[data-plugin-animated-letters]' ).trigger( 'animated.letters.destroy' ); 1534 } ); 1535 carouselItems.on( 'resized.owl.carousel', function () { 1536 var $this = $( this ); 1537 // Position the navigation in the middle of the image 1538 if ( $this.hasClass( 'nav-center-images-only' ) ) { 1539 portoImgNavMiddle( $this ); 1540 } 1541 } ) 1542 carouselItems.filter( function() { 1543 if ( $( this ).find( '[data-vce-animate]' ).length ) { 1544 return true; 1545 } 1546 return false; 1547 } ).on( 'translate.owl.carousel', portoCarouselTranslateVC ); 1548 carouselItems.filter( function() { 1549 var $anim_obj = $( this ).find( '.elementor-invisible' ); 1550 if ( $anim_obj.length ) { 1551 $anim_obj.addClass( 'slide-animate' ); 1552 return true; 1553 } 1554 return false; 1555 } ).on( 'translate.owl.carousel', portoCarouselTranslateElementor ); 1556 carouselItems.filter( function() { 1557 if ( $( this ).find( '.appear-animation, [data-appear-animation]' ).length ) { 1558 return true; 1559 } 1560 return false; 1561 } ).on( 'translate.owl.carousel', portoCarouselTranslateWPB ); 1562 1563 $wrap.find( '[data-plugin-carousel]:not(.manual), .porto-carousel:not(.manual)' ).each( function() { 1564 var $this = $( this ), 1565 opts; 1566 if ( $this.closest( '.tab-pane' ).length && ! $this.closest( '.tab-pane' ).hasClass( 'active' ) ) { 1567 return; 1568 } 1569 if ( $this.closest( '.e-n-tabs-content > .e-con' ).length && ! $this.closest( '.e-n-tabs-content > .e-con' ).hasClass( 'e-active' ) ) { 1570 return; 1571 } 1572 if ( $this.closest( '.sidebar-menu:not(.side-menu-accordion) .menu-block' ).length ) { 1573 return; 1574 } 1575 if ( $this.closest( '.mega-menu .menu-block' ).length ) { 1576 return; 1577 } 1578 var pluginOptions = $this.data( 'plugin-options' ); 1579 if ( pluginOptions ) 1580 opts = pluginOptions; 1581 1582 setTimeout( function() { 1583 $this.themeCarousel( opts ); 1584 }, 0 ); 1585 } ); 1586 } ); 1587 1588 } 1589 // Fixed video 1590 $wrap.find( '.video-fixed' ).each( function() { 1591 var $this = $( this ), 1592 $video = $this.find( 'video, iframe' ); 1593 1594 if ( $video.length ) { 1595 window.addEventListener( 'scroll', function() { 1596 var offset = $( window ).scrollTop() - $this.position().top + theme.adminBarHeight(); 1597 $video.css( "cssText", "top: " + offset + "px !important;" ); 1598 }, { passive: true } ); 1599 } 1600 } ); 1601 setTimeout( function() { 1602 // Search 1603 if ( typeof theme.Search !== 'undefined' ) { 1604 theme.Search.initialize(); 1605 } 1606 }, 0 ); 1607 if ( typeof theme.isAsyncInit == 'undefined' ) { 1608 theme.isAsyncInit = -1; //initial 1609 } 1610 $( document.body ).trigger( 'porto_after_async_init', [ $wrap, wrapObj ] ); 1611 theme.isAsyncInit = 1; 1612 }; 1613 1614 $( document.body ).trigger( 'porto_async_init' ); 1615} ).apply( this, [window.theme, jQuery] ); 1616 1617jQuery( document ).ready( function( $ ) { 1618 'use strict'; 1619 1620 function porto_modal_open( $this ) { 1621 var trigger = $this.data( 'trigger-id' ), 1622 overlayClass = $this.data( 'overlay-class' ), 1623 disableOverlay = $this.data( 'disable-overlay' ), 1624 extraClass = $this.data( 'extra-class' ) ? $this.data( 'extra-class' ) : '', 1625 type = $this.data( 'type' ), 1626 buttonPopup = false, 1627 isExist = 0; 1628 if ( typeof trigger != 'undefined'/* && $('#' + escape(trigger)).length > 0*/ ) { 1629 if ( typeof type == 'undefined' ) { 1630 type = 'inline'; 1631 } 1632 if ( type == 'inline' ) { 1633 trigger = '#' + escape( trigger ); 1634 } 1635 if ( typeof $.magnificPopup.instance != 'undefined' && $.magnificPopup.instance.isOpen ) { 1636 isExist = 350; 1637 $.magnificPopup.close(); // Destroy before init 1638 } 1639 1640 try { 1641 if ( document.querySelector( trigger ) ) { 1642 if ( 'script' == document.querySelector( trigger ).nodeName.toLowerCase() ) { // Dynamic Popup Click 1643 trigger = $( trigger ).html(); 1644 disableOverlay = $( trigger ).data( 'disable-overlay' ); 1645 overlayClass = $( trigger ).data( 'overlay-class' ); 1646 extraClass = 'button-popup '; 1647 buttonPopup = true; 1648 } 1649 } 1650 } catch( e ) { 1651 1652 } 1653 1654 var args = { 1655 items: { 1656 src: trigger 1657 }, 1658 type: type, 1659 mainClass: extraClass + ( disableOverlay ? ' popup-builder-disable-overlay ' : '' ), 1660 prependTo: $( '.page-wrapper' ) 1661 }; 1662 if ( trigger == '#popup-builder' ) { 1663 args['fixedContentPos'] = true; 1664 } 1665 var $popupModal = $this; 1666 if ( buttonPopup ) { 1667 args['fixedContentPos'] = true; 1668 if ( disableOverlay ) { 1669 args['closeOnBgClick'] = false; 1670 args['fixedContentPos'] = false; 1671 args['focus'] = '.bb-none'; // random selector 1672 } 1673 args['callbacks'] = { 1674 'open': function () { 1675 if ( disableOverlay ) { 1676 $( '.button-popup.mfp-bg' ).remove(); 1677 1678 } 1679 // Update bootstrap tooltip for Popup 1680 var $popup_builder = $( '.button-popup.mfp-wrap' ); 1681 if ( typeof theme.porto_init_builder_tooltip == 'function' ) { 1682 theme.porto_init_builder_tooltip( $popup_builder.get(0) ); 1683 } 1684 porto_init( $popup_builder ); 1685 1686 if ( $popup_builder.find( '.wpcf7' ).length ) { 1687 var $wpcf7 = $popup_builder.find( '.wpcf7 .wpcf7-form' ); 1688 if ( typeof wpcf7 == 'object' ) { 1689 if ( typeof wpcf7.initForm == 'function' ) { 1690 wpcf7.initForm( $wpcf7 ); 1691 } else if ( typeof wpcf7.init == 'function' ) { 1692 wpcf7.init( $wpcf7.get( 0 ) );
1693 $wpcf7.get( 0 ).classList.replace( "no-js", "js" ); 1694 } 1695 } 1696 } 1697 if ( $popup_builder.find( '.wpforms-container' ).length ) { 1698 if ( typeof wpforms == 'object' && typeof wpforms.init == 'function' ) { 1699 wpforms.init(); 1700 } 1701 } 1702 } 1703 }; 1704 } 1705 if ( $this.hasClass( 'porto-onload' ) || $this.hasClass( 'porto-exit-intent' ) ) { 1706 if ( disableOverlay ) { 1707 args['closeOnBgClick'] = false; 1708 args['fixedContentPos'] = false; 1709 args['focus'] = '.bb-none'; // random selector 1710 } 1711 args['callbacks'] = { 1712 'beforeClose': function() { 1713 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' ) ) ) { 1714 $.cookie( 'porto_modal_disable_onload', 'true', { expires: 7 } ); 1715 } else if ( 'undefined' !== typeof $popupModal.data( 'expired' ) && 'undefined' !== typeof $popupModal.data( 'popup-id' ) ) { 1716 $.cookie( 'porto_modal_disable_period_onload_' + $popupModal.data( 'popup-id' ), $popupModal.data('expired'), { expires: $popupModal.data('expired') } ); 1717 } 1718 }, 1719 'afterClose': function() { 1720 // If minicart(cart, wishlist) opened, keep disabling mouse scrolling 1721 if ( $( '#header .minicart-opened' ).length ) { 1722 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', theme.getScrollbarWidth() ); 1723 $( 'html' ).css( 'overflow', 'hidden' ); 1724 } 1725 }, 1726 'open': function () { 1727 if ( disableOverlay ) { 1728 $( '.popup-builder.mfp-bg' ).remove(); 1729 } 1730 // Update bootstrap tooltip for Popup 1731 var $popup_builder = $( '.mfp-wrap .porto-block[data-bs-original-title]' ); 1732 if ( $popup_builder.length ) { 1733 bootstrap.Tooltip.getInstance( $popup_builder[0] ).update(); 1734 } 1735 if ( $popup_builder.find( '.marquee' ).length && $.isFunction( $.fn.marquee ) ) { 1736 $popup_builder.find( '.marquee' ).marquee( { 1737 duration: 5000, 1738 gap: 0, 1739 delayBeforeStart: 0, 1740 direction: 'left', 1741 duplicated: true 1742 } ); 1743 } 1744 if ( $( '.mfp-wrap .porto-block .owl-carousel' ) ) { 1745 $( '.mfp-wrap .porto-block .owl-carousel' ).trigger( 'refresh.owl.carousel' ); 1746 } 1747 } 1748 }; 1749 } 1750 if ( typeof overlayClass != "undefined" && overlayClass ) { 1751 args.mainClass += escape( overlayClass ); 1752 } 1753 setTimeout( () => { 1754 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, args ), 0 ); 1755 }, isExist ); 1756 1757 } 1758 } 1759 theme.porto_modal_open = porto_modal_open; 1760 function porto_init_magnific_popup_functions( $wrap ) { 1761 if ( typeof $wrap == 'undefined' || !$wrap.length ) { 1762 $wrap = $( document.body ); 1763 } 1764 $wrap.find( '.lightbox:not(.manual)' ).each( function() { 1765 var $this = $( this ), 1766 opts; 1767 if ( $this.find( '>.lb-dataContainer' ).length ) { 1768 return; 1769 } 1770 var pluginOptions = $this.data( 'lightbox-options' ); 1771 if ( pluginOptions ) { 1772 opts = pluginOptions; 1773 } else { 1774 pluginOptions = $this.data( 'plugin-options' ); 1775 if ( typeof pluginOptions != 'object' ) { 1776 pluginOptions = JSON.parse( pluginOptions ); 1777 } 1778 if ( pluginOptions ) { 1779 opts = pluginOptions; 1780 } 1781 } 1782 1783 $this.themeLightbox( opts ); 1784 } ); 1785 1786 // Popup with video or map 1787 $wrap.find( '.porto-popup-iframe' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 1788 disableOn: 700, 1789 type: 'iframe', 1790 mainClass: 'mfp-fade', 1791 removalDelay: 160, 1792 preloader: false, 1793 fixedContentPos: false 1794 } ) ); 1795 1796 // Popup with ajax 1797 $wrap.find( '.porto-popup-ajax' ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 1798 type: 'ajax' 1799 } ) ); 1800 1801 // Popup with content 1802 $wrap.find( '.porto-popup-content' ).each( function() { 1803 var animation = $( this ).attr( 'data-animation' ); 1804 $( this ).magnificPopup( $.extend( true, {}, theme.mfpConfig, { 1805 type: 'inline', 1806 fixedContentPos: false, 1807 fixedBgPos: true, 1808 overflowY: 'auto', 1809 closeBtnInside: true, 1810 preloader: false, 1811 midClick: true, 1812 removalDelay: 300, 1813 mainClass: animation 1814 } ) ); 1815 } ); 1816 1817 // Porto Modal 1818 $wrap.find( '.popup-youtube, .popup-vimeo, .popup-gmaps' ).each( function( index ) { 1819 var overlayClass = $( this ).find( '.porto-modal-trigger' ).data( 'overlay-class' ), 1820 args = { 1821 type: 'iframe', 1822 removalDelay: 160, 1823 preloader: false, 1824
1825 fixedContentPos: false 1826 }; 1827 if ( typeof overlayClass != "undefined" && overlayClass ) { 1828 args.mainClass = escape( overlayClass ); 1829 } 1830 $( this ).magnificPopup( args ); 1831 } ); 1832 1833 $wrap.find( '[href*=porto-action_popup-id-]' ).each( function() { 1834 var $this = $( this ), popupId = $this.attr( 'href' ); 1835 if ( popupId = popupId.match(/#porto-action_popup-id-(\d+)/)[1] ) { 1836 $this.attr( 'data-trigger-id', 'popup-id-' + popupId ); 1837 $this.addClass( 'porto-modal-trigger' ); 1838 } 1839 } ); 1840 1841 if ( $wrap.find( '.porto-modal-trigger.porto-onload' ).length ) { 1842 var $obj = $wrap.find( '.porto-modal-trigger.porto-onload' ).eq( 0 ), 1843 timeout = 0; 1844 if ( $obj.data( 'timeout' ) ) { 1845 timeout = parseInt( $obj.data( 'timeout' ), 10 ); 1846 } 1847 setTimeout( function() { 1848 porto_modal_open( $obj ); 1849 }, timeout ); 1850 } 1851 $wrap.on( 'click', '.porto-modal-trigger', function( e ) { 1852 e.preventDefault(); 1853 porto_modal_open( $( this ) ); 1854 } ); 1855 1856 /* Woocommerce */ 1857 // login popup 1858 if ( $wrap.hasClass( 'login-popup' ) ) { 1859 $wrap.find( '.porto-link-login, .porto-link-register' ).magnificPopup( { 1860 items: { 1861 src: theme.ajax_url + ( -1 === theme.ajax_url.indexOf( '?' ) ? '?' : '&' ) + 'action=porto_account_login_popup&nonce=' + js_porto_vars.porto_nonce, 1862 type: 'ajax' 1863 }, 1864 tLoading: '<i class="porto-loading-icon"></i>', 1865 callbacks: { 1866 ajaxContentAdded: function() { 1867 $( window ).trigger( 'porto_login_popup_opened' ); 1868 } 1869 } 1870 } ); 1871 } 1872 1873 if ( typeof PhotoSwipe != 'undefined' ) { 1874 let _images = $wrap.find( '.product-images' ), links = [], i = 0; 1875 _images.find( 'img' ).each( function() { 1876 var slide = {}; 1877 1878 slide.src = $( this ).attr( 'href' ); 1879 slide.title = $( this ).attr( 'alt' ); 1880 slide.w = parseInt( $( this ).attr( 'data-large_image_width' ) ); 1881 slide.h = parseInt( $( this ).attr( 'data-large_image_height' ) ); 1882 1883 links[i] = slide; 1884 i++; 1885 } ); 1886 _images.data( 'links', links ); 1887 _images.on( 'click', '.img-thumbnail a.zoom', function( e ) { 1888 e.preventDefault(); 1889 var options = $.extend( { 1890 index: $( this ).closest( '.img-thumbnail' ).index(), 1891 addCaptionHTMLFn: function( item, captionEl ) { 1892 if ( ! item.title ) { 1893 captionEl.children[0].textContent = ''; 1894 return false; 1895 } 1896 captionEl.children[0].textContent = item.title; 1897 return true; 1898 } 1899 }, wc_single_product_params.photoswipe_options ); 1900 1901 // Initializes and opens PhotoSwipe. 1902 var photoswipe = new PhotoSwipe( $( '.pswp' )[0], PhotoSwipeUI_Default, _images.data( 'links' ), options ); 1903 photoswipe.init(); 1904 } ); 1905 1906 1907 } else { 1908 $wrap.find( '.product-images' ).magnificPopup( 1909 $.extend( true, {}, theme.mfpConfig, { 1910 delegate: '.img-thumbnail a.zoom', 1911 type: 'image', 1912 gallery: { enabled: true } 1913 } ) 1914 ); 1915 } 1916 $wrap.find( '.porto-posts-grid' ).each( function() { 1917 $( this ).magnificPopup( 1918 $.extend( true, {}, theme.mfpConfig, { 1919 delegate: '.porto-tb-featured-image span.zoom, .porto-tb-featured-image a.zoom, .post-image span.zoom', 1920 type: 'image', 1921 gallery: { enabled: true } 1922 } ) 1923 ); 1924 } ); 1925 $wrap.find( '.porto-posts-grid .tb-image-type-slider div.zoom' ).each( function() { 1926 var $this = $( this ), 1927 links = []; 1928 $this.find( 'a' ).each( function() { 1929 var slide = {}; 1930 slide.src = $( this ).attr( 'href' ); 1931 slide.title = $( this ).attr( 'title' ); 1932 links.push( slide ); 1933 } ); 1934 if ( links.length ) { 1935 $this.on( 'click', function() { 1936 var $slider = $this.siblings( '.porto-carousel' ); 1937 if ( $slider.length ) { 1938 var offset = $slider.data( 'owl.carousel' ).current() - $slider.find( '.cloned' ).length / 2; 1939 $.magnificPopup.open( $.extend( true, {}, theme.mfpConfig, { 1940 items: links, 1941 gallery: { 1942 enabled: true 1943 }, 1944 type: 'image' 1945 } ), offset ); 1946 } 1947 } ); 1948 } 1949 } ); 1950 } 1951 1952 if ( $.fn.magnificPopup ) { 1953 porto_init_magnific_popup_functions(); 1954 } else { 1955 setTimeout( function() { 1956 if ( $.fn.magnificPopup ) { 1957 porto_init_magnific_popup_functions(); 1958 } 1959 }, 500 ); 1960 } 1961 $( document.body ).on( 'porto_load_posts_end', function( e, $posts_wrap ) { 1962 if ( $.fn.magnificPopup ) { 1963 porto_init_magnific_popup_functions( $posts_wrap ); 1964 } 1965 } ); 1966 1967 // Post Filter
1968 if ( typeof theme.PostFilter !== 'undefined' ) { 1969 var $postFilterElements = $( 'ul[data-filter-type], .portfolio-filter, .member-filter, .faq-filter, .porto-ajax-filter.product-filter, .porto-ajax-filter.post-filter' ); 1970 if ( $postFilterElements.length ) { 1971 theme.PostFilter.initialize( $postFilterElements ); 1972 } 1973 } 1974 1975 // Post ajax pagination 1976 $( 'body' ).on( 'click', '.porto-ajax-load .pagination:not(.load-more) .page-numbers', function( e ) { 1977 var $this = $( this ); 1978 if ( $this.hasClass( 'current' ) || $this.hasClass( 'dots' ) ) { 1979 return; 1980 } 1981 e.preventDefault(); 1982 var $wrap = $this.closest( '.porto-ajax-load' ), 1983 post_type = $wrap.data( 'post_type' ), 1984 $obj = $wrap.find( '.' + post_type + 's-container' ); 1985 1986 if ( !$obj.length || $wrap.hasClass( 'loading' ) ) { 1987 return; 1988 } 1989 $wrap.addClass( 'loading' ); 1990 var $filter = $wrap.find( '.porto-ajax-filter' ), 1991 cat = $filter.length && $filter.children( '.active' ).length && $filter.children( '.active' ).data( 'filter' ); 1992 if ( '*' == cat ) { 1993 cat = ''; 1994 } 1995 var default_args = {}, 1996 page = $this.attr( 'href' ).match( /paged=(\d+)|page\/(\d+)/ ); 1997 1998 if ( page && Array.isArray( page ) && ( page[1] || page[2] ) ) { 1999 default_args['page'] = parseInt( page[1] || page[2] ); 2000 } else { 2001 if ( $this.hasClass( 'prev' ) ) { 2002 default_args['page'] = parseInt( $this.next().text() ); 2003 } else if ( $this.hasClass( 'next' ) ) { 2004 default_args['page'] = parseInt( $this.prev().text() ); 2005 } else { 2006 default_args['page'] = parseInt( $this.text() ); 2007 } 2008 } 2009 if ( cat == '' && $wrap.find( 'input[type=hidden].category' ).length ) { 2010 cat = $wrap.find( 'input[type=hidden].category' ).val(); 2011 default_args['taxonomy'] = $wrap.find( 'input[type=hidden].taxonomy' ).val(); 2012 } 2013 theme.PostFilter.load_posts( cat, $wrap.hasClass( 'load-infinite' ), $wrap, post_type, $obj, default_args, $this.attr( 'href' ) ); 2014 2015 } ); 2016 2017 // Filter Zooms 2018 if ( typeof theme.FilterZoom !== 'undefined' ) { 2019 // Portfolio Filter Zoom 2020 theme.FilterZoom.initialize( $( '.page-portfolios' ) ); 2021 // Member Filter Zoom 2022 theme.FilterZoom.initialize( $( '.page-members' ) ); 2023 // Posts Related Style Filter Zoom 2024 theme.FilterZoom.initialize( $( '.blog-posts-related' ) ); 2025 } 2026 2027 // close popup using esc key 2028 var $minicart_offcanvas = $( '.minicart-offcanvas' ), 2029 $wl_offcanvas = $( '.wishlist-offcanvas' ), 2030 $mobile_sidebar = $( '.mobile-sidebar' ), 2031 $mobile_panel = $( '#side-nav-panel' ), 2032 $overlay_search = $( '#header .btn-close-search-form' ), 2033 $html = $( 'html' ); 2034 if ( $minicart_offcanvas.length || $wl_offcanvas.length || $mobile_sidebar.length || $mobile_panel.length || $( '.skeleton-loading' ).length || $overlay_search.length ) { 2035 $( document.documentElement ).on( 'keyup', function( e ) { 2036 try { 2037 if ( e.keyCode == 27 ) { 2038 $minicart_offcanvas.removeClass( 'minicart-opened' ); 2039 $wl_offcanvas.removeClass( 'minicart-opened' ); 2040 if ( $mobile_sidebar.length ) { 2041 $html.removeClass( 'filter-sidebar-opened' ); 2042 $html.removeClass( 'sidebar-opened' ); 2043 $( '.sidebar-overlay' ).removeClass( 'active' ); 2044 $( 'html' ).css( 'overflow', '' ); 2045 $( 'html' ).css( theme.rtl_browser ? 'margin-left' : 'margin-right', '' ); 2046 } 2047 if ( $mobile_panel.length && $html.hasClass( 'panel-opened' ) ) { 2048 $html.removeClass( 'panel-opened' ); 2049 $( '.panel-overlay' ).removeClass( 'active' ); 2050 } 2051 if ( $overlay_search.length ) { 2052 $overlay_search.trigger( 'click' ); 2053 } 2054 } 2055 } catch ( err ) { } 2056 } ); 2057 $( '.skeleton-loading' ).on( 'skeleton-loaded', function() { 2058 $mobile_sidebar = $( '.mobile-sidebar' ); 2059 } ); 2060 } 2061} );
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.