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