1/* Debounce */ 2( 3 function ( b, c ) { 4 var $ = b.jQuery || b.Cowboy || ( 5 b.Cowboy = {} 6 ), a 7 $.throttle = a = function ( e, f, j, i ) { 8 var h, d = 0 9 if ( typeof f !== 'boolean' ) { 10 i = j 11 j = f 12 f = c 13 } 14 15 function g() { 16 var o = this, m = + new Date() - d, n = arguments 17 18 function l() { 19 d = + new Date() 20 j.apply( o, n ) 21 } 22 23 function k() { 24 h = c 25 } 26 27 if ( i && !h ) { 28 l() 29 } 30 h && clearTimeout( h ) 31 if ( i === c && m > e ) { 32 l() 33 } else { 34 if ( f !== true ) { 35 h = setTimeout( i ? k : l, i === c ? e - m : e ) 36 } 37 } 38 } 39 40 if ( $.guid ) { 41 g.guid = j.guid = j.guid || $.guid ++ 42 } 43 return g 44 } 45 $.debounce = function ( d, e, f ) { 46 return f === c ? a( d, e, false ) : a( d, f, e !== false ) 47 } 48 } 49)( this ); 50 51/* global PENCILOCALIZE */ 52( 53 function ( $ ) { 54 'use strict' 55 var PENCI = PENCI || {} 56 57 /* General functions 58 ---------------------------------------------------------------*/ 59 PENCI.general = function () { 60 // Top search 61 $( '.pcheader-icon a.search-click' ).on( 'click', function ( e ) { 62 var $this = $( this ), 63 $body = $( 'body' ), 64 $container = $this.closest( '.container' ) 65 66 $( 'body' ).find( '.search-input' ).removeClass( 'active' ) 67 $container.find( '.search-input' ).toggleClass( 'active' ) 68 69 if ( $body.find( '.header-search-style-overlay' ).length || 70 $body.find( '.header-search-style-showup' ).length ) { 71 $container.find( '.show-search' ).toggleClass( 'active' ) 72 } else { 73 $this.next().fadeToggle() 74 } 75 76 var opentimeout = setTimeout( function () { 77 var element = document.querySelector( '.search-input.active' ) 78 if ( element !== null ) { 79 element.focus( { 80 preventScroll: true, 81 } ) 82 } 83 }, 200, function () { 84 clearTimeout( opentimeout ) 85 } ) 86 87 $body.addClass( 'search-open' ) 88 e.preventDefault() 89 e.stopPropagation() 90 return false 91 } ) 92 93 $( '.pcheader-icon .close-search' ).on( 'click', function ( e ) { 94 95 if ( $( 'body' ).find( '.header-search-style-overlay' ).length || 96 $( 'body' ).find( '.header-search-style-showup' ).length ) { 97 $( 'body' ).find( '.show-search' ).each( function () { 98 $( this ).removeClass( 'active' ) 99 } ) 100 } else { 101 $( this ).closest( '.show-search' ).fadeToggle() 102 } 103 $( 'body' ).removeClass( 'search-open' ) 104 $( 'body' ).find( '.search-input' ).each( function () { 105 $( this ).removeClass( 'active' ) 106 } ) 107 return false 108 } ) 109 110 $( document ).keyup( function ( e ) { 111 var bd = $( 'body' ) 112 if ( e.key === 'Escape' && bd.hasClass( 'pchds-overlay' ) && 113 bd.hasClass( 'search-open' ) ) { 114 bd.removeClass( 'search-open' ) 115 if ( $( 'body' ).find( '.header-search-style-overlay' ).length || 116 $( 'body' ).find( '.header-search-style-showup' ).length ) { 117 $( 'body' ).find( '.show-search' ).each( function () { 118 $( this ).removeClass( 'active' ) 119 } ) 120 } else { 121 $( 'body' ).find( '.show-search' ).fadeToggle() 122 } 123 $( 'body' ).find( '.search-input, .show-search' ).each( function () { 124 $( this ).removeClass( 'active' ) 125 } ) 126 } 127 return false 128 } ) 129 130 // Go to top 131 $( '.go-to-top, .penci-go-to-top-floating' ).on( 'click', function () { 132 $( 'html, body' ).animate( { scrollTop: 0 }, 700 ) 133 return false 134 } ) 135 136 // Go to top button 137 var $goto_button = $( '.penci-go-to-top-floating' ) 138 if ( $goto_button.length ) { 139 $( document ).on( 'scroll', $.debounce( 200, function () { 140 var y = $( this ).scrollTop() 141 if ( y > 300 ) { 142 $goto_button.addClass( 'show-up' ) 143 } else { 144 $goto_button.removeClass( 'show-up' ) 145 } 146 } ) ) 147 } 148 149 // Call back fitvid when click load more button on buddypress 150 $( 'body.buddypress .activity .load-more a' ).on( 'click', function () { 151 $( document ).ajaxStop( function () { 152 $( '.container' ).fitVids( { ignore: '.penci-sticky-video' } ) 153 } ) 154 } ) 155 156 document.querySelectorAll( '.menu-item-has-anchor' ).forEach( function ( item ) { 157 var offset = - 120 158 var a = item.querySelector( 'a' ).getAttribute( 'href' ) 159 var currentOffset 160 161 if ( a.startsWith( '#' ) !== true || document.querySelector( a ) === null ) { 162 return false 163 } 164 165 currentOffset = document.querySelector( a ).offsetTop 166 167 item.querySelector( 'a' ).addEventListener( 'click', function ( e ) { 168 e.preventDefault() 169 window.scrollTo( { 170 top: currentOffset + offset, 171 behavior: 'smooth', 172 } ) 173 } ) 174 } ) 175 176 $( '#pc_archive_sort' ).on( 'change', function ( e ) { 177 var form = $( this ).closest( 'form' ) 178 form.submit() 179 } ) 180 181 $( document ).on( 'click', '.pcauthor-tabs', function ( e ) { 182 e.preventDefault() 183 184 if ( $( this ).hasClass( 'active' ) ) { 185 return 186 } 187 188 var tab = $( this ).attr( 'data-tab' ), 189 wrapper = $( this ).closest( '.post-author' ) 190 191 wrapper.find( '.author-tab-content' ).removeClass( 'active' ) 192 wrapper.find( '.pcauthor-tabs' ).removeClass( 'active' ) 193 wrapper.find( '#' + tab ).addClass( 'active' ) 194 $( this ).addClass( 'active' ) 195 } ) 196 197 $( document ).on( 'click', '.penci-category-description-button a', function ( e ) { 198 e.preventDefault() 199 $( this ).closest( '.penci-category-description' ).toggleClass( 'active' ) 200 } ) 201 202 203 $( document ).on ( 'click', '.penci-wuser-gps', function( e ) { 204 e.preventDefault() 205 var t = $(this), 206 parent = t.closest('.penci-weather-widget'), 207 id = parent.attr('data-id'), 208 forecast_days = parent.attr('data-forecast_days'), 209 units = parent.attr('data-units') 210 211 parent.addClass('loading') 212 213 $.ajax({ 214 type: "GET", 215 url: ajax_var_more.url, 216 data: { 217 action: 'penci_get_weather_loc', 218 id: id, 219 forecast_days: forecast_days, 220 units: units, 221 }, 222 success: function (response) { 223 var z = response.data.html, 224 v = $(z).html() 225 parent.html(v) 226 parent.removeClass('loading') 227 } 228 }) 229 } ) 230 231 return false 232 } 233 234 PENCI.videofloat = function () { 235 $( 'body.single .post' ).each( function ( e ) { 236 237 var wrapper = $( this ), 238 t = wrapper.find( '.post-image' ), 239 h = t.height(),
240 f = t.find( 'iframe' ), 241 p 242 243 if ( f.length && ajax_var_more.vfloat ) { 244 245 t.addClass( ajax_var_more.vfloatp ) 246 247 var z = h + t.offset().top 248 249 $( document ).on( 'scroll', function () { 250 251 if ( t.hasClass( 'disable-sticky' ) ) { 252 return 253 } 254 var y = $( this ).scrollTop() 255 if ( y > z ) { 256 t.addClass( 'stick-video-enable' ) 257 if ( t.find( '.stick-video-enable-remove' ).length == 0 ) { 258 t.append( '<span class="stick-video-enable-remove"><i class="penciicon-close-button"></i></span>' ) 259 } 260 if ( !wrapper.hasClass( 'penci-apply-padding' ) ) { 261 wrapper.addClass( 'penci-apply-padding' ).css( 'padding-top', h ) 262 } 263 } else { 264 t.removeClass( 'stick-video-enable' ) 265 t.find( '.stick-video-enable-remove' ).remove() 266 wrapper.removeClass( 'penci-apply-padding' ) 267 wrapper.css( 'padding-top', 0 ) 268 } 269 } ) 270 } 271 272 } ) 273 274 $( document ).on( 'click', '.stick-video-enable-remove', function ( e ) { 275 e.preventDefault() 276 var t = $( this ).closest( '.post-image' ) 277 278 t.find( '.stick-video-enable-remove' ).remove() 279 t.removeClass( 'stick-video-enable' ).addClass( 'disable-sticky' ) 280 } ) 281 282 $( document ).on( 'mouseenter', '.penci-preview-thumb', function() { 283 var t = $(this), 284 w = t.outerHeight() * 16/9, 285 h = t.outerHeight(), 286 type = $(this).attr('data-type'), 287 url = $(this).attr('data-url'); 288 289 if ( t.find('video').length == 0 && type == 'self' ) { 290 t.append('<video src="'+url+'" loop muted></video>') 291 } 292 293 if ( t.find('iframe').length == 0 && type !== 'self' ) { 294 t.append('<div class="penci-preview-iframe"><iframe src="'+url+'" frameborder="0"></iframe></div>') 295 $(this).find('iframe').width(w).height(h).fadeIn() 296 } 297 298 if ( $(this).find('video').length !== 0 ) { 299 $(this).find('video').fadeIn() 300 $(this).find('video')[0].play() 301 } 302 303 if ( $(this).find('iframe').length !== 0 ) { 304 $(this).find('iframe').fadeIn() 305 } 306 307 } ).on( 'mouseleave', '.penci-preview-thumb', function() { 308 if ( $(this).find('video').length !== 0 ) { 309 $(this).find('video')[0].pause() 310 $(this).find('video').fadeOut() 311 } 312 if ( $(this).find('iframe').length !== 0 ) { 313 $(this).find('iframe').fadeOut() 314 } 315 }) 316 } 317 318 /* Font Size Changer 319---------------------------------------------------------------*/ 320 PENCI.fontsizeChanger = function () { 321 322 if ( $( '.penci-font-changer' ).length ) { 323 324 var c = Cookies.get( 'penci-font-changer' ) ? Cookies.get( 325 'penci-font-changer' ) : 1, 326 pr = $( '.penci-font-changer' ), 327 w = $( '#main' ).width(), 328 step = .1 329 330 if ( $( 'body' ).hasClass( 'elementor-default' ) ) { 331 w = $( 'article.post' ).width() 332 } 333 334 pr.attr( 'data-size', c ) 335 336 var penci_apply_fontsize = function ( $csize = null ) { 337 var size = parseFloat( pr.attr( 'data-size' ) ) 338 339 size = $csize ? parseFloat( $csize ) : size 340 341 size = size > 1.5 ? size = 1.5 : ( 342 size < - 1.5 ? size = - 1.5 : size 343 ) 344 345 $( '.entry-content' ).css( { 346 'transform': 'scale(' + size + ')', 347 'transform-origin': '0 0 0', 348 'overflow': 'hidden', 349 'width': parseInt( w / size ) + 'px', 350 } ) 351 352 if ( $( 'body' ).hasClass( 'rtl' ) ) { 353 $( '.entry-content' ).css( { 354 'transform-origin': '100% 0', 355 } ) 356 } 357 358 $( '.entry-content p,.entry-content iframe,.entry-content audio,.entry-content div,.entry-content ol, .entry-content ul, .entry-content blockquote, .entry-content h1, .entry-content h1, .entry-content h2, .entry-content h3, .entry-content h4, .entry-content h5, .entry-content h6' ). 359 css( { 360 'max-width': parseInt( w / size ) + 'px', 361 } ) 362 363 if ( $( '.entry-content .penci-toc-container-wrapper' ).length ) { 364 $( '.penci-toc-container-wrapper, .penci-toc-container-wrapper div, .penci-toc-container-wrapper ul, .penci-toc-container-wrapper span, .penci-toc-container-wrapper p' ).css( { 'max-width': '' } ) 365 } 366 367 setTimeout( function () { 368 var entry_content = document.getElementsByClassName( 'entry-content' ), 369 ech = entry_content[0].getBoundingClientRect().height 370 371 $( '.post-entry' ).css( { 372 'height': ech + 'px', 373 'transform': 'none', 374 } ) 375 376 }, 300 ) 377 } 378 379 penci_apply_fontsize() 380 381 if ( $.isFunction( $.fn.jRange ) ) { 382 var def = Cookies.get( 'penci-font-changer' ) ? Cookies.get( 'penci-font-changer' ) : '1' 383 $( '.penci-font-changer-slider' ).each( function () { 384 $( this ).jRange( { 385 from: 0.5, 386 to: 1.5, 387 step: 0.1, 388 scale: [0.5, 0, 1.0, 1.5], 389 format: '%s', 390 width: 120, 391 showLabels: false, 392 showScale: false, 393 snap: true, 394 theme: 'penci-fs-slider', 395 onstatechange: function ( size ) { 396 penci_apply_fontsize( size ) 397 Cookies.set( 'penci-font-changer', size ) 398 }, 399 } ) 400 $( this ).jRange( 'setValue', def ) 401 } ) 402 } 403 404 $( 'body' ).on( 'single_loaded_more', function ( e ) { 405 penci_apply_fontsize() 406 if ( $.isFunction( $.fn.jRange ) ) { 407 var def = Cookies.get( 'penci-font-changer' ) ? Cookies.get( 'penci-font-changer' ) : '1' 408 $( '.penci-font-changer-slider' ).each( function () { 409 $( this ).jRange( { 410 from: 0.5, 411 to: 1.5, 412 step: 0.1, 413 scale: [0.5, 0, 1.0, 1.5], 414 format: '%s', 415 width: 120, 416 showLabels: false, 417 showScale: false, 418 snap: true, 419 theme: 'penci-fs-slider', 420 onstatechange: function ( size ) { 421 penci_apply_fontsize( size ) 422 Cookies.set( 'penci-font-changer', size ) 423 }, 424 } ) 425 $( this ).jRange( 'setValue', def ) 426 } ) 427 } 428 } ) 429 430 $( document ).on( 'click', '.penci-font-changer-reset', function ( e ) { 431 e.preventDefault() 432 $( '.penci-font-changer-slider' ).jRange( 'setValue', '1' ) 433 Cookies.set( 'penci-font-changer', 1 ) 434 } ) 435 436 $( document ).on( 'click', '.penci-font-changer-btn', function ( e ) { 437 e.preventDefault() 438 $( this ).closest( '.penci-font-changer-popup' ).addClass( 'active' ) 439 } ) 440 441 $( document ).on( 'click', function ( e ) { 442 var container = $( '.penci-font-changer-popup' ) 443 444 if ( !container.is( e.target ) && container.has( e.target ).length === 0 ) { 445 container.removeClass( 'active' ) 446 } 447 } ) 448 } 449 450 } 451 452 453 /* Block Heading Lists 454 ---------------------------------------------------------------*/ 455 PENCI.blockheadinglist = function () { 456 $( '.pcnav-lgroup' ).each( function () { 457 var lgroup = $( this ), 458 maintitle = $( this ).closest( '.penci-homepage-title' ), 459 maintitlew = maintitle.width(), 460 mainwrap = lgroup.find( 'ul.pcflx' ), 461 titlew = maintitle.find( '.inner-arrow span' ).width(), 462 nav = maintitle.find( '.pcflx-nav' ).length ? maintitle.find( 463 '.pcflx-nav' ).width() : 0, 464 maxwidthc = 0, 465 childlists = $( 466 '<li class="more"><a class="more-click" href="#"><i class="fa fa-ellipsis-v"></i></a><ul class="pcflx-sub"></ul></li>' ), 467 width = maintitlew - titlew - nav, 468 oldlist 469 470 if ( maintitle.hasClass( 'pcalign-center' ) ) { 471 width = maintitlew / 2 - titlew / 2 - 30 472 } 473 474 if ( maintitle.hasClass( 'pciconp-left' ) || 475 maintitle.hasClass( 'pciconp-right' ) ) { 476 width = width - 36 477 } 478 479 lgroup.css( 'width', width ) 480 481 //reset 482 oldlist = mainwrap.find( '.pcflx-sub' ).html() 483 mainwrap.find( '.more' ).remove() 484 mainwrap.append( oldlist ) 485 486 mainwrap.find( 'li' ).each( function () { 487 maxwidthc = maxwidthc + $( this ).outerWidth() 488 if ( maxwidthc > width - 60 ) { 489 $( childlists ).find( '.pcflx-sub' ).append( $( this ) ) 490 } 491 } ) 492 if ( $( childlists ).find( '.pcflx-sub li' ).length ) { 493 mainwrap.append( childlists ) 494 } 495 maintitle.parent().addClass( 'pc-flexmnld' ) 496 lgroup.addClass( 'loaded' ) 497 } ) 498 $( document ).on( 'click', '.pcnav-lgroup .more-click', function ( e ) { 499 e.preventDefault() 500 } ) 501 502 $( '.pcnav-lgroup a' ).on( 'click', function () { 503 var t = $( this ), 504 pr = t.closest( '.pcnav-lgroup' ) 505 506 if ( !t.hasClass( 'pcaj-nav-link' ) ) { 507 pr.find( 'a' ).removeClass( 'clactive' ) 508 t.addClass( 'clactive' ) 509 } 510 511 } ) 512 } 513
514 /* Share Expand 515 ---------------------------------------------------------------*/ 516 PENCI.shareexpand = function () { 517 518 if ( !$( '.tags-share-box' ).length ) { 519 return 520 } 521 522 $( '.tags-share-box' ).each( function () { 523 var tag = $( this ) 524 525 if ( tag.hasClass( 'disable-btnplus' ) ) { 526 tag.css( 'opacity', '1' ) 527 return 528 } 529 530 if ( tag.length ) { 531 var sharew = 0, 532 sexpand = false, 533 maxw = tag.width(), 534 $count = 1, 535 exspace, 536 dsharew = tag.find( '.post-share-expand' ).outerWidth() 537 538 if ( tag.find( '.penci-social-share-text' ).length ) { 539 maxw = maxw - tag.find( '.penci-social-share-text' ).outerWidth( true ) 540 } 541 542 if ( tag.find( '.post-share-plike' ).length ) { 543 maxw = maxw - tag.find( '.post-share-plike' ).outerWidth( true ) 544 } 545 546 if ( tag.find( '.new-ver-share' ).length ) { 547 exspace = tag.find( '.new-ver-share' ).outerWidth( true ) - 548 tag.find( '.new-ver-share' ).outerWidth() 549 } 550 551 tag.find( '.post-share-expand' ). 552 removeClass( 'auto-hidden' ). 553 removeClass( 'showing' ). 554 removeClass( 'hidden' ) 555 556 tag.find( '.new-ver-share' ).each( function () { 557 $( this ).removeClass( 'auto-hidden' ).removeClass( 'show' ) 558 sharew += $( this ).outerWidth( true ) 559 if ( sharew > maxw + exspace ) { 560 $( this ).addClass( 'auto-hidden' ).removeClass( 'show' ) 561 sexpand = true 562 } else { 563 $( this ).removeClass( 'auto-hidden' ).addClass( 'show' ) 564 } 565 $count ++ 566 } ) 567 568 if ( sexpand ) { 569 tag.find( '.post-share-expand' ). 570 removeClass( 'auto-hidden' ). 571 addClass( 'showing' ) 572 573 tag.find( '.new-ver-share.show' ).each( function () { 574 dsharew += $( this ).outerWidth( true ) 575 if ( dsharew >= maxw - exspace ) { 576 $( this ).addClass( 'auto-hidden' ).removeClass( 'show' ) 577 } 578 } ) 579 580 } else { 581 tag.find( '.post-share-expand' ).addClass( 'hidden' ) 582 } 583 584 $( '.post-share-item.post-share-expand' ).off().on( 'click', function ( e ) { 585 e.preventDefault() 586 var parent = $( this ).closest( '.post-share' ) 587 parent.find( '.auto-hidden' ).toggleClass( 'active' ) 588 parent.toggleClass( 'showing-hidden' ) 589 } ) 590 591 tag.css( 'opacity', '1' ) 592 } 593 } ) 594 595 } 596 597 /* Smooth Scroll */ 598 PENCI.smoothlinkscroll = function () { 599 $( 'a[href^="#"]' ).on( 'click', function ( e ) { 600 // e.preventDefault(); 601 602 var target = this.hash, 603 $target = $( target ) 604 605 $( 'html, body' ).stop().animate( { 606 'scrollTop': $target.offset().top - 70, 607 }, 900, 'swing', function () { 608 window.location.hash = target 609 } ) 610 } ) 611 } 612 /* Cookie Law 613 ---------------------------------------------------------------*/ 614 PENCI.cookie = function () { 615 var wrapCookie = '.penci-wrap-gprd-law', 616 $wrapCookie = $( wrapCookie ), 617 classAction = 'penci-wrap-gprd-law-close', 618 penciCookieName = 'penci_law_footer_new' 619 620 if ( !$wrapCookie.length ) { 621 return false 622 } 623 624 var penciCookie = { 625 set: function ( name, value ) { 626 var date = new Date() 627 date.setTime( date.getTime() + ( 628 31536000000 629 ) ) 630 var expires = '; expires=' + date.toGMTString() 631 document.cookie = name + '=' + value + expires + '; path=/' 632 }, 633 read: function ( name ) { 634 var namePre = name + '=' 635 var cookieSplit = document.cookie.split( ';' ) 636 for ( var i = 0; i < cookieSplit.length; i ++ ) { 637 var cookie = cookieSplit[i] 638 while ( cookie.charAt( 0 ) == ' ' ) { 639 cookie = cookie.substring( 1, cookie.length ) 640 } 641 if ( cookie.indexOf( namePre ) === 0 ) { 642 return cookie.substring( namePre.length, cookie.length ) 643 } 644 } 645 return null 646 }, 647 erase: function ( name ) { 648 this.set( name, '', - 1 ) 649 }, 650 exists: function ( name ) { 651 return ( 652 this.read( name ) !== null 653 ) 654 }, 655 } 656 657 $wrapCookie.removeClass( 'penci-close-all' ) 658 if ( !penciCookie.exists( penciCookieName ) || 659 ( 660 penciCookie.exists( penciCookieName ) && 1 == 661 penciCookie.read( penciCookieName ) 662 ) ) { 663 $wrapCookie.removeClass( classAction ) 664 } else { 665 $wrapCookie.addClass( classAction ) 666 } 667 668 $( '.penci-gprd-accept, .penci-gdrd-show' ).on( 'click', function ( e ) { 669 e.preventDefault() 670 671 var $this = $( this ), 672 $parent_law = $this.closest( wrapCookie ) 673 674 $parent_law.toggleClass( classAction ) 675 676 if ( $parent_law.hasClass( classAction ) ) { 677 penciCookie.set( penciCookieName, '2' ) 678 } else { 679 penciCookie.set( penciCookieName, '1' ) 680 } 681 682 return false 683 } ) 684 } 685
686 /* Sticky main navigation 687 ---------------------------------------------------------------*/ 688 PENCI.main_sticky = function () { 689 if ( $( 'nav#navigation' ).length && $().pensticky && 690 !$( 'nav#navigation' ).hasClass( 'penci-disable-sticky-nav' ) ) { 691 var spaceTop = 0 692 if ( $( 'body' ).hasClass( 'admin-bar' ) ) { 693 spaceTop = 32 694 } 695 $( 'nav#navigation' ).each( function () { 696 $( this ).pensticky( { topSpacing: spaceTop } ) 697 } ) 698 } // sticky 699 } 700 701 /* Homepage Featured Slider 702 ---------------------------------------------------------------*/ 703 PENCI.featured_slider = function () { 704 705 const owl_fslider_name = {} 706 707 $( '.featured-area .penci-owl-featured-area' ).each( function () { 708 709 var $this = $( this ), 710 $style = $this.data( 'style' ), 711 $auto = false, 712 $autotime = $this.data( 'autotime' ), 713 $speed = $this.data( 'speed' ), 714 $loop = $this.data( 'loop' ), 715 $item = 1, 716 $slideby = 1, 717 $nav = true, 718 $dots = false, 719 $rtl = false, 720 $items_desktop = 1, 721 $items_tablet = 1, 722 $items_tabsmall = 1, 723 $items_mobile = 1, 724 $spaceBetween = 0, 725 $ctyle = ajax_var.fcarousel_e, 726 $sstyle = ajax_var.fslider_e, 727 $slider_content = $this.find('.swiper-wrapper').html(), 728 $id = 'fetured-swiper-' + Math.floor( Math.random() * ( 729 1 - 999999 730 ) + 1 ) + 1 731 732 if ( $this.attr( 'data-id' ) ) { 733 $id = $this.attr( 'data-id' ) 734 } 735 736 $this.addClass( $id ) 737 738 if ( $this.hasClass( 'no-df-swiper' ) ) { 739 return 740 } 741 742 if ( $this.attr( 'data-ceffect' ) ) { 743 $ctyle = $this.attr( 'data-ceffect' ) 744 } 745 746 if ( $this.attr( 'data-seffect' ) ) { 747 $sstyle = $this.attr( 'data-seffect' ) 748 } 749 750 if ( $( 'html' ).attr( 'dir' ) === 'rtl' ) { 751 $rtl = true 752 } 753 if ( $this.attr( 'data-auto' ) === 'true' ) { 754 $auto = true 755 } 756 if ( $this.attr( 'data-nav' ) === 'false' ) { 757 $nav = false 758 } 759 if ( $this.attr( 'data-dots' ) === 'true' ) { 760 $dots = true 761 $this.append( '<div class="penci-owl-dots"></div>' ) 762 } 763 if ( $this.attr( 'data-item' ) ) { 764 $item = parseInt( $this.data( 'item' ) ) 765 $slideby = $item 766 } 767 if ( $this.attr( 'data-desktop' ) ) { 768 $items_desktop = parseInt( $this.data( 'desktop' ) ) 769 } 770 if ( $this.attr( 'data-tablet' ) ) { 771 $items_tablet = parseInt( $this.data( 'tablet' ) ) 772 } 773 if ( $this.attr( 'data-tabsmall' ) ) { 774 $items_tabsmall = parseInt( $this.data( 'tabsmall' ) ) 775 } 776 if ( $this.attr( 'data-mobile' ) ) { 777 $items_mobile = parseInt( $this.data( 'mobile' ) ) 778 } 779 if ( $this.attr( 'data-slideby' ) ) { 780 $slideby = parseInt( $this.data( 'slideby' ) ) 781 } 782 783 if ( $item > 1 ) { 784 $this.addClass( 'swiper-multi-items' ) 785 } 786 787 let a = 0, 788 e = $( this ), 789 t = !1 790 791 var interleaveOffset = 0.5 792 793 if ( $style === 'style-2' ) { 794 $spaceBetween = 10 795 $loop = true 796 } else if ( $style === 'style-28' ) { 797 $items_desktop = $item = 6 798 } else if ( $style === 'style-38' ) { 799 $spaceBetween = 5 800 $items_desktop = $item = 5 801 } 802 803 var swiper_arg = { 804 loop: $loop, 805 autoplay: $auto, 806 spaceBetween: $spaceBetween, 807 slidesPerView: $item, 808 speed: $speed, 809 slideActiveClass: 'active', 810 watchSlidesProgress: true, 811 navigation: { 812 nextEl: '.' + $id + ' .owl-next', 813 prevEl: '.' + $id + ' .owl-prev', 814 }, 815 on: { 816 init: function () { 817 $this.addClass( 'penci-owl-loaded' ) 818 }, 819 afterInit: function () { 820 $this.addClass( 'penci-featured-loaded' ) 821 }, 822 setTransition: function ( swiper, speed ) { 823 824 if ( swiper.slides ) { 825 826 for ( var i = 0; i < swiper.slides.length; i ++ ) { 827 if ( swiper.slides[i].querySelector( '.slide-inner' ) !== null && $sstyle == 'creative' ) { 828 swiper.slides[i].style.transition = speed + 'ms' 829 swiper.slides[i].querySelector( '.slide-inner' ).style.transition = speed + 'ms' 830 } 831 if ( swiper.slides[i].querySelector( '.penci-swiper-mask' ) !== null && $sstyle == 'creative' ) { 832 swiper.slides[i].style.transition = speed + 'ms' 833 swiper.slides[i].querySelector( '.penci-swiper-mask' ).style.transition = speed + 'ms' 834 } 835 } 836 837 } 838 839 }, 840 touchStart( ...n ) { 841 if ( $item > 1 ) { 842 t = !0, e.on && e.on.touchStart && e.on.touchStart( ...n ) 843 } 844 var swiper = this 845 if ( swiper.slides ) { 846 for ( var i = 0; i < swiper.slides.length; i ++ ) { 847 if ( swiper.slides[i].querySelector( '.slide-inner' ) !== null && $sstyle == 'creative' ) { 848 swiper.slides[i].style.transition = '' 849 } 850 if ( swiper.slides[i].querySelector( '.penci-swiper-mask' ) !== null && $sstyle == 'creative' ) { 851 swiper.slides[i].style.transition = '' 852 } 853 } 854 } 855 }, 856 touchEnd( ...n ) { 857 if ( $item > 1 ) { 858 t = !1, e.on && e.on.touchStart && e.on.touchEnd( ...n ) 859 } 860 }, 861 progress( n, u ) { 862 if ( t ) { 863 return 864 } 865 if ( $item > 1 && $ctyle == 'swing' ) { 866 n.on && n.on.progress && n.on.progress(n, u); 867 const g = n.progress > a ? "next" : "prev"; 868 a = n.progress; 869 const y = n.params.speed / 16, 870 f = n.visibleSlidesIndexes, 871 h = f[0], 872 m = f[f.length - 1], 873 v = (l, c) => { 874 g === "next" && c >= h ? l.style.transitionDelay = `${(c-h+1)*y}ms` : g === "prev" && c <= m + 1 ? l.style.transitionDelay = `${(m-c+1)*y}ms` : l.style.transitionDelay = `${0}ms` 875 };
876 n.slides.forEach((l, c) => { 877 n.animating ? (l.style.transitionDelay = "0ms", requestAnimationFrame(() => { 878 v(l, c) 879 })) : v(l, c) 880 }) 881 } 882 883 var swiper = this 884 if ( swiper.slides ) { 885 for ( var i = 0; i < swiper.slides.length; i ++ ) { 886 var slideProgress = swiper.slides[i].progress 887 var innerOffset = swiper.width * interleaveOffset 888 var innerTranslate = slideProgress * innerOffset 889 if ( swiper.slides[i].querySelector( '.slide-inner' ) !== null && $sstyle == 'creative' ) { 890 swiper.slides[i].querySelector( '.slide-inner' ).style.transform = 'translate3d(' + innerTranslate + 'px, 0, 0)' 891 } 892 if ( swiper.slides[i].querySelector( '.penci-swiper-mask' ) !== null && $sstyle == 'creative' ) { 893 swiper.slides[i].querySelector( '.penci-swiper-mask' ).style.transform = 'translate3d(' + innerTranslate + 'px, 0, 0)' 894 } 895 } 896 } 897 898 }, 899 }, 900 } 901 902 903 904 if ( $auto ) { 905 swiper_arg['autoplay'] = { 906 delay: $autotime, 907 disableOnInteraction: false, 908 pauseOnMouseEnter: true, 909 } 910 } 911 912 if ( $style === 'style-2' || $style === 'style-38' ) { 913 swiper_arg['centeredSlides'] = true 914 swiper_arg['loop'] = true 915 swiper_arg['slidesPerView'] = 'auto' 916 } 917 918 if ( $this.find( '.swiper-mark-item' ).length ) { 919 swiper_arg['parallax'] = true 920 } 921 922 if ( $style === 'style-2' ) { 923 swiper_arg['loopAddBlankSlides'] = true 924 swiper_arg['watchSlidesProgress'] = false 925 swiper_arg['centerInsufficientSlides'] = true 926 } 927 928 if ( $style === 'style-38' ) { 929 swiper_arg['loopAddBlankSlides'] = true 930 swiper_arg['watchSlidesProgress'] = false 931 swiper_arg['centerInsufficientSlides'] = true 932 } 933 934 if ( $dots ) { 935 swiper_arg['pagination'] = { 936 el: '.' + $id + ' .penci-owl-dots', 937 type: 'bullets', 938 bulletElement: 'div', 939 clickable: true, 940 bulletClass: 'penci-owl-dot', 941 bulletActiveClass: 'active', 942 renderBullet: function ( index, className ) { 943 return '<div class="' + className + '"><span></span></div>' 944 }, 945 } 946 } 947 948 if ( $item == 1 && $style !== 'style-38' ) { 949 950 if ( $sstyle === 'creative' ) { 951 swiper_arg['effect'] = 'slide' 952 } else { 953 swiper_arg['effect'] = $sstyle 954 } 955 } 956 957 if ( $style == 'style-28' || $style == 'style-2' || $style == 'style-38' ) { 958 swiper_arg['effect'] = 'side' 959 swiper_arg['slidesPerView'] = 'auto' 960 } 961 962 if ( swiper_arg['effect'] == 'fade' ) { 963 swiper_arg['fadeEffect'] = { 964 crossFade: true, 965 } 966 } 967 968 if ( $ctyle == 'swing' && $item > 1 ) { 969 swiper_arg['speed'] = $speed 970 swiper_arg['loop'] = false 971 972 if ( $style !== 'style-38' ) { 973 swiper_arg['rewind'] = true 974 } 975 976 swiper_arg['effect'] = 'creative' 977 swiper_arg['followFinger'] = !1 978 swiper_arg['creativeEffect'] = { 979 limitProgress: 100, 980 prev: { 981 translate: ['-100%', 0, 0], 982 }, 983 next: { 984 translate: ['100%', 0, 0], 985 }, 986 } 987 } 988 989 if ( swiper_arg['slidesPerView'] !== 'auto' ) { 990 swiper_arg['breakpoints'] = { 991 0: { 992 slidesPerView: $items_mobile, 993 }, 994 480: { 995 slidesPerView: $items_tabsmall, 996 }, 997 768: { 998 slidesPerView: $items_tablet, 999 }, 1000 1170: { 1001 slidesPerView: $items_desktop, 1002 }, 1003 } 1004 } 1005 1006 owl_fslider_name[$id] = new Swiper( '.' + $id, swiper_arg ) 1007 1008 owl_fslider_name[$id].update() 1009 1010 if ( $style == 'style-38' ) { 1011 owl_fslider_name[$id].slideTo( 4, 0 ) 1012 } 1013 if ( $style == 'style-2' ) { 1014 owl_fslider_name[$id].slideTo( 4, 0 ) 1015 } 1016 1017 if ( $('body').hasClass('rtl') ) { 1018 owl_fslider_name[$id].changeLanguageDirection( 'ltr' ) 1019 } 1020 } ) 1021 } 1022 1023 1024 /* Owl Slider General 1025 ---------------------------------------------------------------*/ 1026 PENCI.owl_slider = function () { 1027 1028 const owl_slider_name = {} 1029 1030 $( '.penci-owl-carousel-slider' ).each( function () { 1031 var $this = $( this ), 1032 $parent = $this.parent(), 1033 $auto = true, 1034 $dots = false, 1035 $nav = true, 1036 $loop = true, 1037 $rtl = false, 1038 $dataauto = $this.data( 'auto' ), 1039 $items_desktop = 1, 1040 $items_tablet = 1, 1041 $items_tabsmall = 1, 1042 $items_mobile = 1, 1043 $speed = 600, 1044 $item = 1, 1045 $slideby = 1, 1046 $margin = 0, 1047 $autotime = 5000, 1048 $height = true, 1049 $datalazy = false, 1050 $carousel_effect = ajax_var.carousel_e, 1051 $slide_effect = ajax_var.slider_e, 1052 $thumbs = $this.attr( 'data-thumbs' ), 1053 $slider_content = $this.find('.swiper-wrapper').html(), 1054 $id = 'fetured-swiper-' + Math.floor( Math.random() * ( 1055 1 - 999999 1056 ) + 1 ) + 1 1057 1058 1059 if ( $this.hasClass( 'no-df' ) ) { 1060 return 1061 } 1062 1063 if ( $this.hasClass( 'nav-thumb-creative' ) ) { 1064 return 1065 } 1066 1067 if ( $this.hasClass( 'penci-featured-loaded' ) ) { 1068 return 1069 } 1070 1071 if ( $this.attr( 'data-id' ) ) { 1072 $id = $this.attr( 'data-id' ) 1073 } 1074 1075 if ( $this.attr( 'data-ceffect' ) ) { 1076 $carousel_effect = $this.attr( 'data-ceffect' ) 1077 } 1078 1079 if ( $this.attr( 'data-seffect' ) ) { 1080 $slide_effect = $this.attr( 'data-seffect' ) 1081 } 1082
1083 $this.addClass( $id ) 1084 1085 $this.find( '.swiper-slide' ).removeClass( 'penci-ajrs-animate' ) 1086 1087 if ( $this.attr( 'data-nav' ) !== 'false' ) { 1088 $this.append( '<div class="penci-owl-nav"><div class="owl-prev"><i class="penciicon-left-chevron"></i></div><div class="owl-next"><i class="penciicon-right-chevron"></i></div></div>' ) 1089 } 1090 1091 if ( $( 'html' ).attr( 'dir' ) === 'rtl' ) { 1092 $rtl = true 1093 } 1094 if ( $this.attr( 'data-dots' ) === 'true' ) { 1095 $dots = true 1096 if ( ! $this.find('.penci-owl-dots').length ) { 1097 $this.append( '<div class="penci-owl-dots"></div>' ) 1098 } 1099 } 1100 if ( $this.attr( 'data-loop' ) === 'false' ) { 1101 $loop = false 1102 } 1103 if ( $this.attr( 'data-nav' ) === 'false' ) { 1104 $nav = false 1105 } 1106 if ( $this.attr( 'data-auto' ) === 'false' ) { 1107 $auto = false 1108 } 1109 1110 if ( $this.attr( 'data-margin' ) ) { 1111 $margin = parseInt( $this.data( 'margin' ) ) 1112 } 1113 if ( $this.attr( 'data-desktop' ) ) { 1114 $items_desktop = parseInt( $this.data( 'desktop' ) ) 1115 } 1116 if ( $this.attr( 'data-tablet' ) ) { 1117 $items_tablet = parseInt( $this.data( 'tablet' ) ) 1118 } 1119 if ( $this.attr( 'data-tabsmall' ) ) { 1120 $items_tabsmall = parseInt( $this.data( 'tabsmall' ) ) 1121 } 1122 if ( $this.attr( 'data-mobile' ) ) { 1123 $items_mobile = parseInt( $this.data( 'mobile' ) ) 1124 } 1125 if ( $this.attr( 'data-speed' ) ) { 1126 $speed = parseInt( $this.data( 'speed' ) ) 1127 } 1128 if ( $this.attr( 'data-autotime' ) ) { 1129 $autotime = parseInt( $this.data( 'autotime' ) ) 1130 } 1131 if ( $this.attr( 'data-item' ) ) { 1132 $item = $slideby = parseInt( $this.data( 'item' ) ) 1133 } 1134 if ( $this.attr( 'data-lazy' ) ) { 1135 $datalazy = true 1136 } 1137 if ( $this.attr( 'data-height' ) ) { 1138 $height = true 1139 } 1140 1141 let a = 0, 1142 t = !1 1143 1144 var interleaveOffset = 0.5 1145 1146 var swiper_arg = { 1147 loop: $loop, 1148 spaceBetween: $margin, 1149 slidesPerView: $item, 1150 speed: $speed, 1151 autoplay: $auto, 1152 pauseOnMouseEnter: true, 1153 autoHeight: $height, 1154 slideActiveClass: 'active', 1155 watchSlidesProgress: true, 1156 lazyLoading: $datalazy, 1157 navigation: { 1158 nextEl: '.' + $id + ' .owl-next', 1159 prevEl: '.' + $id + ' .owl-prev', 1160 }, 1161 breakpoints: { 1162 320: { 1163 slidesPerView: $items_mobile, 1164 }, 1165 768: { 1166 slidesPerView: $items_tablet, 1167 }, 1168 1170: { 1169 slidesPerView: $items_desktop, 1170 }, 1171 }, 1172 on: { 1173 init: function () { 1174 $this.addClass( 'penci-owl-loaded' ) 1175 }, 1176 afterInit: function () { 1177 $this.addClass( 'penci-featured-loaded' ) 1178 }, 1179 touchStart( slider ) { 1180 1181 if ( $item > 1 ) { 1182 t = !0, slider.on && slider.on.touchStart && slider.on.touchStart( slider ) 1183 } else { 1184 var swiper = this 1185 if ( swiper.slides ) { 1186 for ( var i = 0; i < swiper.slides.length; i ++ ) { 1187 if ( swiper.slides[i].querySelector( '.slide-inner' ) !== null && $slide_effect == 'creative' ) { 1188 swiper.slides[i].style.transition = '' 1189 } 1190 if ( swiper.slides[i].querySelector( '.penci-swiper-mask' ) !== null && $slide_effect == 'creative' ) { 1191 swiper.slides[i].style.transition = '' 1192 } 1193 } 1194 } 1195 } 1196 }, 1197 touchEnd( slider ) { 1198 1199 if ( $item > 1 ) { 1200 t = !1, slider.on && slider.on.touchStart && slider.on.touchEnd( slider ) 1201 } 1202 }, 1203 setTransition: function ( swiper, speed ) { 1204 1205 if ( swiper.slides ) { 1206 1207 for ( var i = 0; i < swiper.slides.length; i ++ ) { 1208 1209 if ( swiper.slides[i].querySelector( '.slide-inner' ) !== null && $slide_effect == 'creative' ) { 1210 swiper.slides[i].style.transition = speed + 'ms' 1211 swiper.slides[i].querySelector( '.slide-inner' ).style.transition = speed + 'ms' 1212 } 1213 if ( swiper.slides[i].querySelector( '.penci-ctslide-bg' ) !== null && $slide_effect == 'creative' ) { 1214 swiper.slides[i].style.transition = speed + 'ms' 1215 swiper.slides[i].querySelector( '.penci-ctslide-bg' ).style.transition = speed + 'ms' 1216 } 1217 if ( swiper.slides[i].querySelector( '.penci-swiper-mask' ) !== null && $slide_effect == 'creative' ) { 1218 swiper.slides[i].style.transition = speed + 'ms' 1219 swiper.slides[i].querySelector( '.penci-swiper-mask' ).style.transition = speed + 'ms' 1220 } 1221 } 1222 1223 } 1224 1225 }, 1226 progress( n, u ) { 1227 if ( t ) { 1228 return 1229 } 1230 1231 if ( $item > 1 && $carousel_effect === 'swing' ) { 1232 1233 n.on && n.on.progress && n.on.progress(n, u); 1234 const g = n.progress > a ? "next" : "prev"; 1235 a = n.progress; 1236 const y = n.params.speed / 16, 1237 f = n.visibleSlidesIndexes, 1238 h = f[0], 1239 m = f[f.length - 1], 1240 v = (l, c) => { 1241 g === "next" && c >= h ? l.style.transitionDelay = `${(c-h+1)*y}ms` : g === "prev" && c <= m + 1 ? l.style.transitionDelay = `${(m-c+1)*y}ms` : l.style.transitionDelay = `${0}ms` 1242 };
1243 n.slides.forEach((l, c) => { 1244 n.animating ? (l.style.transitionDelay = "0ms", requestAnimationFrame(() => { 1245 v(l, c) 1246 })) : v(l, c) 1247 }) 1248 1249 } else { 1250 1251 var swiper = this 1252 if ( swiper.slides ) { 1253 for ( var i = 0; i < swiper.slides.length; i ++ ) { 1254 var slideProgress = swiper.slides[i].progress 1255 var innerOffset = swiper.width * interleaveOffset 1256 var innerTranslate = slideProgress * innerOffset 1257 if ( swiper.slides[i].querySelector( '.slide-inner' ) !== null && $slide_effect === 'creative' ) { 1258 swiper.slides[i].querySelector( '.slide-inner' ).style.transform = 'translate3d(' + innerTranslate + 'px, 0, 0)' 1259 } 1260 if ( swiper.slides[i].querySelector( '.penci-ctslide-bg' ) !== null && $slide_effect === 'creative' ) { 1261 swiper.slides[i].querySelector( '.penci-ctslide-bg' ).style.transform = 'translate3d(' + innerTranslate + 'px, 0, 0)' 1262 } 1263 if ( swiper.slides[i].querySelector( '.penci-swiper-mask' ) !== null && $slide_effect === 'creative' ) { 1264 swiper.slides[i].querySelector( '.penci-swiper-mask' ).style.transform = 'translate3d(' + innerTranslate + 'px, 0, 0)' 1265 } 1266 } 1267 } 1268 } 1269 }, 1270 }, 1271 } 1272 1273 if ( $carousel_effect === 'swing' && $item > 1 ) { 1274 $this.addClass('penci-swing-ef') 1275 swiper_arg['speed'] = $speed 1276 swiper_arg['loop'] = false 1277 swiper_arg['rewind'] = true 1278 swiper_arg['effect'] = 'creative' 1279 swiper_arg['followFinger'] = !1 1280 swiper_arg['creativeEffect'] = { 1281 limitProgress: 100, 1282 prev: { 1283 translate: ['-100%', 0, 0], 1284 }, 1285 next: { 1286 translate: ['100%', 0, 0], 1287 }, 1288 } 1289 } else if ( $item == 1 ) { 1290 swiper_arg['effect'] = $slide_effect 1291 } 1292 1293 if ( ( 1294 swiper_arg['effect'] === 'flip' || swiper_arg['effect'] === 'cards' 1295 ) && $item == 1 ) { 1296 swiper_arg['loop'] = false 1297 } 1298 1299 if ( swiper_arg['effect'] === 'creative' && $item === 1 ) { 1300 swiper_arg['creativeEffect'] = { 1301 shadowPerProgress: true, 1302 prev: { 1303 translate: ['-100%', 0, 0], 1304 opacity: 0.5, 1305 }, 1306 next: { 1307 translate: ['100%', 0, 0], 1308 opacity: 1, 1309 }, 1310 } 1311 } 1312 1313 if ( $this.attr( 'data-direction' ) ) { 1314 swiper_arg['direction'] = $this.attr( 'data-direction' ) 1315 } 1316 1317 1318 if ( $dots ) { 1319 swiper_arg['pagination'] = { 1320 el: '.' + $id + ' .penci-owl-dots', 1321 type: 'bullets', 1322 bulletElement: 'div', 1323 clickable: true, 1324 bulletClass: 'penci-owl-dot', 1325 bulletActiveClass: 'active', 1326 renderBullet: function ( index, className ) { 1327 return '<div class="' + className + '"><span></span></div>' 1328 }, 1329 } 1330 } 1331 1332 if ( $this.attr( 'data-thumbs-id' ) ) { 1333 swiper_arg['thumbs'] = { 1334 swiper: owl_slider_name[$this.attr( 'data-thumbs-id' )], 1335 } 1336 } 1337 1338 1339 if ( $this.attr( 'data-thumb' ) ) { 1340 swiper_arg['slideToClickedSlide'] = true 1341 } 1342 1343 if ( $parent.hasClass( 'penci-topbar-trending' ) ) { 1344 1345 swiper_arg['navigation'] = { 1346 nextEl: '.penci-slider-next', 1347 prevEl: '.penci-slider-prev', 1348 } 1349 1350 swiper_arg['autoHeight'] = false 1351 1352 if ( $this.attr( 'data-anim' ) ) { 1353 swiper_arg['slideActiveClass'] = 'animated' 1354 } 1355 1356 if ( $this.attr( 'data-anim' ) === 'slideInUp' ) { 1357 swiper_arg['effect'] = 'creative' 1358 swiper_arg['creativeEffect'] = { 1359 shadowPerProgress: true, 1360 prev: { 1361 translate: [0, '-100%', 0], 1362 opacity: 0, 1363 }, 1364 next: { 1365 translate: [0, '100%', 0], 1366 opacity: 1, 1367 }, 1368 } 1369 } 1370 1371 if ( $this.attr( 'data-anim' ) === 'slideInRight' ) { 1372 swiper_arg['effect'] = 'creative' 1373 swiper_arg['creativeEffect'] = { 1374 shadowPerProgress: false, 1375 perspective: true, 1376 1377 prev: { 1378 translate: [ '20px', 0, 0], 1379 opacity: 0, 1380 }, 1381 next: { 1382 translate: ['20px', 0, 0], 1383 opacity: 0, 1384 }, 1385 } 1386 } 1387 1388 if ( $this.attr( 'data-anim' ) === 'fadeIn' ) { 1389 swiper_arg['effect'] = 'fade' 1390 swiper_arg['fadeEffect'] = { 1391 crossFade: true, 1392 } 1393 } 1394 } 1395 1396 if ( $auto ) { 1397 swiper_arg['autoplay'] = { 1398 delay: $autotime, 1399 disableOnInteraction: false, 1400 pauseOnMouseEnter: true, 1401 } 1402 } 1403 1404 owl_slider_name[$id] = new Swiper( '.' + $id, swiper_arg ) 1405 1406 1407 if ( $this.attr( 'data-thumbs-id' ) ) { 1408 owl_slider_name[$this.attr( 'data-thumbs-id' )].update() 1409 } 1410 1411 owl_slider_name[$id].update() 1412 1413 } ) 1414 1415 } 1416
1417 /* Slick Slider w Thumbnails 1418 ---------------------------------------------------------------*/ 1419 PENCI.slick_slider = function () { 1420 1421 $( '.penci-image-gallery-thumbnail-slider' ).each( function () { 1422 1423 var main_slider = $( this ).find( '.pcthumb-s-msl' ).attr( 'data-id' ), 1424 thumb_slider = $( this ).find( '.pcthumb-s-csl' ).attr( 'data-id' ), 1425 thumb_total = $( this ).find( '.pcthumb-s-csl' ).attr( 'data-total' ) 1426 1427 var swiper_thumb_slider = new Swiper( '.' + thumb_slider, { 1428 loop: true, 1429 slidesPerView: 'auto', 1430 spaceBetween: 0, 1431 slideToClickedSlide: true, 1432 on: { 1433 init: function ( e ) { 1434 $( '.' + thumb_slider ).addClass( 'slick-initialized' ) 1435 }, 1436 }, 1437 navigation: { 1438 nextEl: '.' + thumb_slider + ' .slick-next', 1439 prevEl: '.' + thumb_slider + ' .slick-prev', 1440 }, 1441 } ) 1442 1443 var swiper_slider = new Swiper( '.' + main_slider, { 1444 slidesPerView: 1, 1445 autoHeight: true, 1446 loop: true, 1447 thumbs: { 1448 swiper: swiper_thumb_slider, 1449 }, 1450 on: { 1451 init: function ( e ) { 1452 $( '.' + main_slider ).addClass( 'slick-initialized' ) 1453 }, 1454 slideChange: function ( e ) { 1455 var number = e.realIndex, 1456 number = number == 0 ? 1 : number 1457 $( '.' + thumb_slider ).find( '.pcslick-nav-area' ).find( '.current' ).html( number ) 1458 }, 1459 }, 1460 } ) 1461 1462 swiper_thumb_slider.update() 1463 swiper_slider.update() 1464 1465 } ) 1466 1467 } 1468 1469 /* Fitvids 1470 ---------------------------------------------------------------*/ 1471 PENCI.fitvids = function () { 1472 // Target your .container, .wrapper, .post, etc. 1473 if ( $().fitVids ) { 1474 $( '.container' ).fitVids( { ignore: '.penci-sticky-video' } ) 1475 } 1476 } 1477 1478 /* Sticky sidebar 1479 ----------------------------------------------------------------*/ 1480 PENCI.sticky_sidebar = function () { 1481 if ( $().theiaStickySidebar ) { 1482 var top_margin = 80 1483 if ( $( 'body' ).hasClass( 'admin-bar' ) && 1484 $( 'body' ).hasClass( 'penci-vernav-enable' ) ) { 1485 top_margin = 52 1486 } else if ( !$( 'body' ).hasClass( 'admin-bar' ) && 1487 $( 'body' ).hasClass( 'penci-vernav-enable' ) ) { 1488 top_margin = 20 1489 } else if ( $( 'body' ).hasClass( 'admin-bar' ) && 1490 !$( 'body' ).hasClass( 'penci-vernav-enable' ) ) { 1491 top_margin = 112 1492 } 1493 1494 if ( $( '.pc-wrapbuilder-header' ).length ) { 1495 var headerdesktop = $( '.penci_builder_sticky_header_desktop' ) 1496 top_margin = 20 1497 if ( headerdesktop.length && 1498 !headerdesktop.hasClass( 'hide-scroll-down' ) ) { 1499 top_margin = headerdesktop.height() + 20 1500 } 1501 if ( $( 'body' ).hasClass( 'admin-bar' ) ) { 1502 top_margin = top_margin + 32 1503 } 1504 } 1505 1506 $( '.pc-container-sticky' ).each( function() { 1507 var t = $(this) 1508 if ( t.find('.theiaStickySidebar').length === 0 ) { 1509 t.wrapInner('<div class="theiaStickySidebar"></div>') 1510 } 1511 }); 1512 1513 if ( $( 1514 '.penci-vc-sticky-sidebar > .penci-vc-row > .penci-vc-column' ).length ) { 1515 $( '.penci-vc-sticky-sidebar > .penci-vc-row > .penci-vc-column' ). 1516 theiaStickySidebar( { 1517 additionalMarginTop: top_margin, 1518 'minWidth': 961, 1519 } ) 1520 } 1521 1522 if ( $( '.penci-enSticky .penci-sticky-sb' ).length ) { 1523 $( '.penci-enSticky .penci-sticky-sb,.penci-enSticky .penci-sticky-ct' ). 1524 theiaStickySidebar( { 1525 additionalMarginTop: top_margin, 1526 'minWidth': 961, 1527 } ) 1528 } 1529 $( '#main.penci-main-sticky-sidebar, #sidebar.penci-sticky-sidebar' ). 1530 theiaStickySidebar( { 1531 // settings 1532 additionalMarginTop: top_margin, 1533 } ) 1534 } // if sticky 1535 } 1536 1537 /* Mega menu 1538 ----------------------------------------------------------------*/ 1539 PENCI.mega_menu = function () { 1540 // Hover parent 1541 $( '#navigation ul.menu > li.penci-mega-menu' ).on( 'mouseenter', function () { 1542 var $this = $( this ), 1543 $row_active = $this.find( '.row-active' ), 1544 $rowsLazy = $row_active.find( '.penci-lazy' ) 1545 $row_active.fadeIn( '200' ).css( 'display', 'inline-block' ) 1546 } ) 1547 1548 $( '#navigation .penci-mega-child-categories a' ). 1549 on( 'mouseenter', function () { 1550 if ( $( this ).hasClass( 'mega-normal-child' ) ) { 1551 return 1552 } 1553 if ( !$( this ).hasClass( 'cat-active' ) ) { 1554 var $this = $( this ), 1555 $row_active = $this.data( 'id' ),
1556 $parentA = $this.parent().children( 'a' ), 1557 $parent = $this.closest( '.penci-megamenu' ), 1558 $rows = $this.closest( '.penci-megamenu' ). 1559 find( '.penci-mega-latest-posts' ). 1560 children( '.penci-mega-row' ), 1561 $rowsLazy = $rows.find( '.penci-lazy' ) 1562 $parentA.removeClass( 'cat-active' ) 1563 $this.addClass( 'cat-active' ) 1564 $rows.hide() 1565 $rows.removeClass( 'row-active' ) 1566 $parent.find( '.' + $row_active ). 1567 fadeIn( '300' ). 1568 css( 'display', 'inline-block' ). 1569 addClass( 'row-active' ) 1570 } 1571 } ) 1572 } 1573 1574 PENCI.categories_lists = function () { 1575 // Add indicator 1576 1577 $( '.pc-advanced-cat li' ).each( function ( e ) { 1578 if ( $( this ).find( '.children' ).length ) { 1579 $( this ).addClass( 'has-children' ) 1580 $( this ).find( '.children' ).hide() 1581 $( this ).append( '<u class="indicator"><i class="fa fa-angle-down"></i></u>' ) 1582 } 1583 } ) 1584 1585 1586 // indicator click 1587 $( '.pc-advanced-cat .indicator' ).on( 'click', function ( e ) { 1588 var $this = $( this ) 1589 e.preventDefault() 1590 $this.children().toggleClass( 'fa-angle-up' ) 1591 $this.closest( 'li' ).find( '.children' ).slideToggle( 'fast' ) 1592 } ) 1593 } 1594 1595 /* Mobile menu responsive 1596 ----------------------------------------------------------------*/ 1597 PENCI.mobile_menu = function () { 1598 // Add indicator 1599 $( '#sidebar-nav .menu li.menu-item-has-children > a' ). 1600 append( '<u class="indicator"><i class="fa fa-angle-down"></i></u>' ) 1601 1602 // Toggle menu when click show/hide menu 1603 $( '#navigation .button-menu-mobile' ).on( 'click', function () { 1604 $( 'body' ).addClass( 'open-sidebar-nav' ) 1605 } ) 1606 1607 // indicator click 1608 $( '#sidebar-nav .menu li a .indicator' ).on( 'click', function ( e ) { 1609 if ( $( 'body' ).hasClass( 'penci-vernav-cparent' ) ) { 1610 return 1611 } 1612 var $this = $( this ) 1613 e.preventDefault() 1614 $this.children().toggleClass( 'fa-angle-up' ) 1615 $this.parent().next().slideToggle( 'fast' ) 1616 } ) 1617 1618 $( '.penci-vernav-cparent #sidebar-nav .menu li.menu-item-has-children > a' ). 1619 on( 'click', function ( e ) { 1620 var $this = $( this ) 1621 e.preventDefault() 1622 $this.children().children().toggleClass( 'fa-angle-up' ) 1623 $this.next().slideToggle( 'fast' ) 1624 } ) 1625 1626 // Close sidebar nav 1627 $( '#close-sidebar-nav' ).on( 'click', function ( e ) { 1628 e.preventDefault() 1629 $( 'body' ).removeClass( 'open-sidebar-nav' ) 1630 } ) 1631 } 1632 1633 PENCI.toggleMenuHumburger = function () { 1634 var $menuhumburger = $( '.penci-menu-hbg' ) 1635 if ( $menuhumburger.length ) { 1636 var $body = $( 'body' ), 1637 $button = $( 1638 '.penci-vernav-toggle,.penci-menuhbg-toggle,#penci-close-hbg,.penci-menu-hbg
1638-overlay' ), 1639 sidebarClass = 'penci-menuhbg-open' 1640 1641 // Add indicator 1642 $( '.penci-menu-hbg .menu li.menu-item-has-children > a' ). 1643 append( '<u class="indicator"><i class="fa fa-angle-down"></i></u>' ) 1644 1645 // indicator click 1646 $( '.penci-menu-hbg .menu li a .indicator' ).on( 'click', function ( e ) { 1647 if ( $( 'body' ).hasClass( 'penci-hbg-cparent' ) && 1648 !$menuhumburger.hasClass( 'penci-builder-mobile-sidebar-nav' ) ) { 1649 return 1650 } 1651 if ( $menuhumburger.hasClass( 'penci-builder-mobile-sidebar-nav' ) && 1652 $menuhumburger.find( '.pchb-cparent' ).length ) { 1653 return 1654 } 1655 var $this = $( this ) 1656 e.preventDefault() 1657 $this.children().toggleClass( 'fa-angle-up' ) 1658 $this.parent().next().slideToggle( 'fast' ) 1659 } ) 1660 1661 $( '.penci-hbg-cparent .penci-menu-hbg .menu li.menu-item-has-children > a' ). 1662 on( 'click', function ( e ) { 1663 var $this = $( this ) 1664 e.preventDefault() 1665 $this.children().children().toggleClass( 'fa-angle-up' ) 1666 $this.next().slideToggle( 'fast' ) 1667 } ) 1668 1669 // Click to show mobile menu 1670 $button.on( 'click', function ( e ) { 1671 e.preventDefault() 1672 1673 if ( $body.hasClass( sidebarClass ) ) { 1674 $body.removeClass( sidebarClass ) 1675 $button.removeClass( 'active' ) 1676 1677 return 1678 } 1679 e.stopPropagation() // Do not trigger click event on '.site' below 1680 $body.addClass( sidebarClass ) 1681 $button.addClass( 'active' ) 1682 1683 1684 } ) 1685 } 1686 } 1687 1688 /* Light box 1689 ----------------------------------------------------------------*/ 1690 PENCI.lightbox = function () { 1691 if ( $().magnificPopup ) { 1692 $( 'a[data-rel^="penci-gallery-image-content"], .penci-enable-lightbox .gallery-item a' ). 1693 magnificPopup( { 1694 type: 'image', 1695 closeOnContentClick: true, 1696 closeBtnInside: false, 1697 fixedContentPos: true, 1698 image: { 1699 verticalFit: true, 1700 titleSrc: 'data-cap', 1701 }, 1702 gallery: { 1703 enabled: true, 1704 }, 1705 zoom: { 1706 enabled: false, 1707 duration: 300, 1708 }, 1709 } ) 1710 1711 $( 'a[data-rel^="penci-gallery-bground-content"]' ).magnificPopup( { 1712 type: 'image', 1713 closeOnContentClick: true, 1714 closeBtnInside: false, 1715 fixedContentPos: true, 1716 image: { 1717 verticalFit: true, 1718 }, 1719 gallery: { 1720 enabled: true, 1721 }, 1722 } ) 1723 1724 // Enable lightbox videos 1725 $( '.penci-other-layouts-lighbox' ).magnificPopup( { 1726 type: 'iframe', 1727 mainClass: 'mfp-fade', 1728 fixedContentPos: true, 1729 closeBtnInside: false, 1730 closeOnContentClick: true, 1731 } ) 1732 1733 if ( $( '.penci-image-gallery' ).length ) { 1734 $( '.penci-image-gallery' ).each( function () { 1735 var $this = $( this ), 1736 id = $this.attr( 'id' ) 1737 1738 $( '#' + id + ' a.penci-gallery-ite' ).magnificPopup( { 1739 type: 'image', 1740 closeOnContentClick: true, 1741 closeBtnInside: false, 1742 fixedContentPos: true, 1743 image: { 1744 verticalFit: true, 1745 titleSrc: 'data-cap', 1746 }, 1747 gallery: { 1748 enabled: true, 1749 }, 1750 } ) 1751 } ) 1752 } 1753 1754 if ( $( '.penci-post-gallery-container' ).length ) { 1755 $( '.penci-post-gallery-container' ).each( function () { 1756 var $this = $( this ), 1757 id = $this.attr( 'id' ) 1758 1759 $( '#' + id + ' a.penci-gallery-ite' ).magnificPopup( { 1760 type: 'image', 1761 closeOnContentClick: true, 1762 closeBtnInside: false, 1763 fixedContentPos: true, 1764 image: { 1765 verticalFit: true, 1766 titleSrc: 'data-cap', 1767 }, 1768 gallery: { 1769 enabled: true, 1770 }, 1771 } ) 1772 } ) 1773 } 1774 1775 } // if magnificPopup exists 1776 } 1777 1778 /* Masonry layout 1779 ----------------------------------------------------------------*/ 1780 PENCI.masonry = function () { 1781 var $masonry_container = $( 1782 '.penci-masonry, .penci-bgstyle-2 .penci-biggrid-data' ) 1783 if ( $masonry_container.length ) { 1784 $masonry_container.each( function () { 1785 var $this = $( this ) 1786 $this.imagesLoaded( function () { 1787 // initialize isotope 1788 $this.isotope( { 1789 itemSelector: '.item-masonry', 1790 transitionDuration: '.55s', 1791 layoutMode: 'masonry', 1792 } ) 1793 } ) 1794 } ) 1795 } 1796 } 1797
1798 /* Video Background 1799 ----------------------------------------------------------------*/ 1800 PENCI.video_background = function () { 1801 var $penci_videobg = $( '#penci-featured-video-bg' ) 1802 if ( $penci_videobg.length ) { 1803 $( $penci_videobg ).each( function () { 1804 var $this = $( this ), 1805 $src = $this.data( 'videosrc' ), 1806 $startime = $this.data( 'starttime' ), 1807 $jarallaxArgs = { 1808 videoSrc: $src, 1809 videoStartTime: $startime, 1810 videoPlayOnlyVisible: false, 1811 } 1812 1813 jarallax( $this, $jarallaxArgs ) 1814 $( '.featured-area' ).addClass( 'loaded-wait' ) 1815 setTimeout( function () { 1816 $( '.featured-area' ).addClass( 'loaded-animation' ) 1817 }, 1500 ) 1818 } ) 1819 } 1820 } 1821 1822 /* Portfolio 1823 ----------------------------------------------------------------*/ 1824 PENCI.portfolio = function () { 1825 var $penci_portfolio = $( '.penci-portfolio' ) 1826 1827 if ( $().isotope && $penci_portfolio.length ) { 1828 $( '.penci-portfolio' ).each( function () { 1829 var $this = $( this ), 1830 unique_id = $( this ).attr( 'id' ), 1831 DataFilter = null 1832 1833 if ( typeof ( 1834 portfolioDataJs 1835 ) != 'undefined' && portfolioDataJs !== 1836 null ) { 1837 for ( var e in portfolioDataJs ) { 1838 1839 if ( portfolioDataJs[e].instanceId == unique_id ) { 1840 var DataFilter = portfolioDataJs[e] 1841 } 1842 } 1843 } 1844 1845 $this.imagesLoaded( function () { 1846 $this.isotope( { 1847 itemSelector: '.portfolio-item', 1848 animationEngine: 'best-available', 1849 animationOptions: { 1850 duration: 250, 1851 queue: false, 1852 }, 1853 } ) // isotope 1854 1855 $this.addClass( 'loaded' ) 1856 1857 $( '.portfolio-item .inner-item-portfolio' ).each( function () { 1858 var $this = $( this ) 1859 $this.one( 'inview', 1860 function ( event, isInView, visiblePartX, visiblePartY ) { 1861 $this.addClass( 'animated' ) 1862 } ) // inview 1863 } ) // each 1864 1865 var location = window.location.hash.toString() 1866 if ( location.length ) { 1867 location = location.replace( '#', '' ) 1868 location.match( /:/ ) 1869 var Mlocation = location.match( /^([^:]+)/ )[1] 1870 location = location.replace( Mlocation + ':', '' ) 1871 1872 if ( location.length > 1 ) { 1873 1874 var $termActive = $afilter.filter( 1875 '[data-term="' + location + '"]' ), 1876 portfolioItem = $this.find( '.portfolio-item' ), 1877 $buttonLoadMore = $this.parent(). 1878 find( '.penci-pagenavi-shortcode' ) 1879 1880 if ( $termActive.length ) { 1881 1882 liFilter.removeClass( 'active' ) 1883 $termActive.parent().addClass( 'active' ) 1884 $this.isotope( { filter: '.penci-' + location } ) 1885 1886 var dataTerm = $termActive.data( 'term' ), 1887 p = {} 1888 1889 DataFilter.currentTerm = dataTerm 1890 $.each( DataFilter.countByTerms, function ( t, e ) { 1891 p[t] = 0 1892 } ) 1893 1894 portfolioItem.each( function ( t, e ) { 1895 $.each( ( 1896 $( e ).data( 'terms' ) + '' 1897 ).split( ' ' ), function ( t, e ) { 1898 p[e] ++ 1899 } ) 1900 } ) 1901 1902 var show_button = 'number' == typeof p[dataTerm] && 1903 p[dataTerm] == DataFilter.countByTerms[dataTerm] 1904 if ( $buttonLoadMore.length ) { 1905 if ( portfolioItem.length !== DataFilter.count && 1906 !show_button ) { 1907 $buttonLoadMore.show() 1908 } else { 1909 $buttonLoadMore.hide() 1910 } 1911 } 1912 } 1913 } 1914 } 1915 } ) // imagesloaded 1916 1917 // Filter items when filter link is clicked 1918 var $filter = $this.parent().find( '.penci-portfolio-filter' ), 1919 $afilter = $filter.find( 'a' ), 1920 liFilter = $filter.find( 'li' ) 1921 1922 liFilter.on( 'click', function () { 1923 1924 var self = $( this ), 1925 term = self.find( 'a' ).data( 'term' ), 1926 selector = self.find( 'a' ).attr( 'data-filter' ), 1927 $e_dataTerm = $filter.find( 'a' ). 1928 filter( '[data-term="' + term + '"]' ), 1929 portfolioItem = $this.find( '.portfolio-item' ), 1930 $buttonLoadMore = $this.parent(). 1931 find( '.penci-pagenavi-shortcode' ), 1932 scrollTop = $( window ).scrollTop() 1933 1934 liFilter.removeClass( 'active' ) 1935 self.addClass( 'active' ) 1936 1937 $this.parent().find( '.penci-ajax-more-button' ).attr( 'data-cat', term ) 1938 1939 $this.isotope( { filter: selector } ) 1940 1941 if ( $e_dataTerm.length ) { 1942 window.location.hash = '*' == term ? '' : term 1943 1944 $( window ).scrollTop( scrollTop ) 1945 } 1946 1947 var p = {} 1948 DataFilter.currentTerm = term 1949 $.each( DataFilter.countByTerms, function ( t, e ) { 1950 p[t] = 0 1951 } ) 1952 1953 portfolioItem.each( function ( t, e ) { 1954 $.each( ( 1955 $( e ).data( 'terms' ) + '' 1956 ).split( ' ' ), function ( t, e ) { 1957 p[e] ++ 1958 } ) 1959 } ) 1960 1961 var show_button = 'number' == typeof p[term] && p[term] == 1962 DataFilter.countByTerms[term] 1963 if ( $buttonLoadMore.length ) { 1964 if ( portfolioItem.length !== DataFilter.count && !show_button ) { 1965 $buttonLoadMore.show() 1966 } else { 1967 $buttonLoadMore.hide() 1968 } 1969 } 1970 1971 return false 1972 } ) 1973 1974 PENCI.portfolioLoadMore.loadMore( $this, DataFilter ) 1975 PENCI.portfolioLoadMore.infinityScroll( DataFilter ) 1976 1977 } ) // each .penci-portfolio 1978 1979 } // end if isotope & portfolio 1980 1981 var $btnLoadMore = $( '.penci-plf-loadmore' ) 1982 if ( !$().isotope || !$btnLoadMore.length ) { 1983 return false 1984 } 1985 } 1986 1987 PENCI.portfolioLoadMore = { 1988 btnLoadMore: $( '.penci-plf-loadmore' ), 1989 loadMore: function ( $pfl_wapper, DataFilter ) { 1990 var self = this 1991 $( 'body' ).on( 'click', '.penci-ajax-more-button', function ( event ) { 1992 self.actionLoadMore( $( this ), $pfl_wapper, DataFilter ) 1993 } ) 1994 }, 1995 infinityScroll: function ( DataFilter ) { 1996 var self = this, 1997 $handle = $( '.penci-plf-loadmore' ), 1998 $button_load = $handle.find( '.penci-ajax-more-button' ) 1999 2000 if ( $handle.hasClass( 'penci-infinite-scroll' ) ) { 2001 $( window ).on( 'scroll', function () { 2002 var hT = $button_load.offset().top, 2003 hH = $button_load.outerHeight(), 2004 wH = $( window ).height(), 2005 wS = $( this ).scrollTop() 2006 2007 if ( ( 2008 wS > ( 2009 hT + hH - wH 2010 ) 2011 ) && $button_load.length ) { 2012 var $pfl_wapper = $button_load.closest( '.penci-portfolio' ) 2013 self.actionLoadMore( $button_load, $pfl_wapper, DataFilter ) 2014 } 2015 } ).trigger( 'scroll' ) 2016 } 2017 }, 2018 actionLoadMore: function ( $button_load, $pfl_wapper, DataFilter ) { 2019 if ( $button_load.hasClass( 'loading-portfolios' ) ) { 2020 return false 2021 } 2022 2023 $button_load.addClass( 'loading-portfolios' ) 2024 2025 var mesNoMore = $button_load.data( 'mes_no_more' ), 2026 mes = $button_load.data( 'mes' ) 2027 2028 DataFilter.pflShowIds = [] 2029 2030 $button_load.closest( '.wrapper-penci-portfolio' ). 2031 find( '.portfolio-item' ). 2032 each( function ( t, e ) { 2033 DataFilter.pflShowIds.push( $( e ).data( 'pflid' ) ) 2034 } ) 2035 2036 var data = { 2037 action: 'penci_pfl_more_post_ajax', 2038 datafilter: DataFilter, 2039 nonce: ajax_var_more.nonce, 2040 } 2041 $.post( ajax_var_more.url, data, function ( response ) { 2042 if ( !response.data.items ) { 2043 $button_load.find( '.ajax-more-text' ).html( mesNoMore ) 2044 $button_load.removeClass( 'loading-portfolios' ) 2045 2046 $button_load.closest( '.wrapper-penci-portfolio' ). 2047 find( '.penci-portfolio-filter li.active' ). 2048 addClass( 'loadmore-finish' ) 2049 2050 setTimeout( function () { 2051 $button_load.parent().parent().hide() 2052 $button_load.find( '.ajax-more-text' ).html( mes ) 2053 }, 1200 ) 2054 2055 return false 2056 } 2057 2058 var $wrap_content = $button_load.closest( '.wrapper-penci-portfolio' ). 2059 find( '.penci-portfolio' ), 2060 $data = $( response.data.items ) 2061 2062 $wrap_content.find( '.inner-portfolio-posts' ).append( $data ) 2063 $wrap_content.isotope( 'appended', $data ).imagesLoaded( function () { 2064 $wrap_content.isotope( 'layout' ) 2065 } ) 2066 2067 2068 $( '.container' ).fitVids( { ignore: '.penci-sticky-video' } ) 2069 2070 $( 'a[data-rel^="penci-gallery-image-content"]' ).magnificPopup( { 2071 type: 'image', 2072 closeOnContentClick: true, 2073 closeBtnInside: false, 2074 fixedContentPos: true, 2075 image: { 2076 verticalFit: true, 2077 }, 2078 gallery: { 2079 enabled: true, 2080 }, 2081 zoom: { 2082 enabled: false, 2083 duration: 300, 2084 }, 2085 } ) 2086 2087 $wrap_content.addClass( 'loaded' ) 2088
2089 $( '.portfolio-item .inner-item-portfolio' ).each( function () { 2090 var $this = $( this ) 2091 $this.one( 'inview', 2092 function ( event, isInView, visiblePartX, visiblePartY ) { 2093 $this.addClass( 'animated' ) 2094 } ) // inview 2095 } ) // each 2096 2097 $button_load.removeClass( 'loading-portfolios' ) 2098 } ) 2099 2100 $.ajax( { 2101 type: 'POST', 2102 dataType: 'html', 2103 url: ajax_var_more.url, 2104 data: 'datafilter=' + DataFilter + 2105 '&action=penci_pfl_more_post_ajax&nonce=' + ajax_var_more.nonce, 2106 success: function ( data ) { 2107 2108 }, 2109 error: function ( jqXHR, textStatus, errorThrown ) { 2110 console.log( jqXHR + ' :: ' + textStatus + ' :: ' + errorThrown ) 2111 }, 2112 2113 } ) 2114 }, 2115 } 2116 2117 /* Gallery 2118 ----------------------------------------------------------------*/ 2119 PENCI.gallery = function () { 2120 var $justified_gallery = $( '.penci-post-gallery-container.justified' ) 2121 var $masonry_gallery = $( '.penci-post-gallery-container.masonry' ) 2122 if ( $().justifiedGallery && $justified_gallery.length ) { 2123 $( '.penci-post-gallery-container.justified' ).each( function () { 2124 var $this = $( this ) 2125 $this.justifiedGallery( { 2126 rowHeight: $this.data( 'height' ), 2127 lastRow: 'nojustify', 2128 margins: $this.data( 'margin' ), 2129 randomize: false, 2130 } ) 2131 } ) // each .penci-post-gallery-container 2132 } 2133 2134 if ( $().isotope && $masonry_gallery.length ) { 2135 2136 $( '.penci-post-gallery-container.masonry .item-gallery-masonry' ). 2137 each( function () { 2138 var $this = $( this ).children() 2139 if ( $this.attr( 'data-cap' ) && !$this.hasClass( 'added-caption' ) ) { 2140 var $title = $this.attr( 'data-cap' ) 2141 if ( $title !== 'undefined' ) { 2142 $this.children(). 2143 append( '<div class="caption">' + $title + '</div>' ) 2144 $this.addClass( 'added-caption' ) 2145 } 2146 2147 } 2148 } ) 2149 } 2150 2151 if ( $masonry_gallery.length ) { 2152 $masonry_gallery.each( function () { 2153 var $this = $( this ) 2154 $this.imagesLoaded( function () { 2155 // initialize isotope 2156 $this.isotope( { 2157 itemSelector: '.item-gallery-masonry', 2158 transitionDuration: '.55s', 2159 layoutMode: 'masonry', 2160 } ) 2161 2162 $this.addClass( 'loaded' ) 2163 2164 $( '.penci-post-gallery-container.masonry .item-gallery-masonry' ). 2165 each( function () { 2166 var $this = $( this ) 2167 $this.one( 'inview', 2168 function ( event, isInView, visiblePartX, visiblePartY ) { 2169 $this.children().addClass( 'animated' ) 2170 } ) // inview 2171 } ) // each 2172 } ) 2173 } ) 2174 } 2175 }, 2176 2177 /* Jarallax 2178 ----------------------------------------------------------------*/ 2179 PENCI.Jarallax = function () { 2180 if ( !$.fn.jarallax || !$( '.penci-jarallax' ).length ) { 2181 return false 2182 } 2183 $( '.penci-jarallax' ).each( function () { 2184 var $this = $( this ), 2185 $jarallaxArgs = {} 2186 2187 $this.imagesLoaded( { background: true }, function () { 2188 jarallax( $this, $jarallaxArgs ) 2189 } ) 2190 } ) 2191 }, 2192 2193 /* Related Popup 2194 ----------------------------------------------------------------*/ 2195 PENCI.RelatedPopup = function () { 2196 if ( $( '.penci-rlt-popup' ).length ) { 2197 var rltpopup = $( '.penci-rlt-popup' ), 2198 rltclose = $( '.penci-rlt-popup .penci-close-rltpopup' ), 2199 rltlazy = rltpopup.find( '.penci-lazy' ) 2200 2201 $( 'body' ).on( 'inview', '.penci-flag-rlt-popup', 2202 function ( event, isInView, visiblePartX, visiblePartY ) { 2203 if ( !rltpopup.hasClass( 'rltpopup-notshow-again' ) && 2204 isInView ) { 2205 rltpopup.addClass( 'rltpopup-show-up' ) 2206 rltclose.on( 'click', function ( e ) { 2207 e.preventDefault() 2208 rltpopup.removeClass( 'rltpopup-show-up' ). 2209 addClass( 'rltpopup-notshow-again' ) 2210 } ) 2211 /*rltlazy.Lazy({ 2212 effect: 'fadeIn', 2213 effectTime: 300, 2214 scrollDirection: 'both' 2215 });*/ 2216 //lazySizes.init(); 2217 } 2218 } ) 2219 rltclose.on( 'click', function ( e ) { 2220 e.preventDefault()
2221 rltpopup.removeClass( 'rltpopup-show-up' ). 2222 addClass( 'rltpopup-notshow-again' ) 2223 } ) 2224 } 2225 }, 2226 2227 PENCI.extraFunction = { 2228 init: function () { 2229 this.counterUp() 2230 this.progressBar() 2231 this.loginPopup() 2232 this.recoverPassPopup() 2233 this.registerPopup() 2234 this.login() 2235 this.register() 2236 this.map() 2237 }, 2238 progressBar: function () { 2239 if ( $( '.penci-review-process' ).length ) { 2240 $( '.penci-review-process' ).each( function () { 2241 var $this = $( this ), 2242 $bar = $this.children(), 2243 $bar_w = $bar.data( 'width' ) * 10 2244 $this.one( 'inview', 2245 function ( event, isInView, visiblePartX, visiblePartY ) { 2246 $bar.animate( { width: $bar_w + '%' }, 1000 ) 2247 } ) // bind inview 2248 } ) // each 2249 } 2250 2251 if ( $.fn.easyPieChart && $( '.penci-piechart' ).length ) { 2252 $( '.penci-piechart' ).each( function () { 2253 var $this = $( this ) 2254 $this.one( 'inview', 2255 function ( event, isInView, visiblePartX, visiblePartY ) { 2256 var chart_args = { 2257 barColor: $this.data( 'color' ), 2258 trackColor: $this.data( 'trackcolor' ), 2259 scaleColor: false, 2260 lineWidth: $this.data( 'thickness' ), 2261 size: $this.data( 'size' ), 2262 animate: 1000, 2263 } 2264 $this.easyPieChart( chart_args ) 2265 } ) // bind inview 2266 } ) // each 2267 } 2268 }, 2269 counterUp: function () { 2270 var $counterup = $( '.penci-counterup-number' ) 2271 2272 if ( !$.fn.counterUp || !$counterup.length ) { 2273 return false 2274 } 2275 2276 $counterup.each( function () { 2277 var $this = $( this ) 2278 2279 $this.one( 'inview', 2280 function ( event, isInView, visiblePartX, visiblePartY ) { 2281 setTimeout( function () { 2282 $( { countNum: $this.text() } ).animate( 2283 { 2284 countNum: $this.attr( 'data-count' ), 2285 }, 2286 2287 { 2288 duration: 2000, 2289 easing: 'linear', 2290 step: function () { 2291 $this.text( Math.floor( this.countNum ) ) 2292 }, 2293 complete: function () { 2294 $this.text( this.countNum ) 2295 }, 2296 }, 2297 ) 2298 }, $this.attr( 'data-delay' ) ) 2299 2300 } ) // bind inview 2301 } ) 2302 }, 2303 loginPopup: function () { 2304 var $body = $( 'body' ), 2305 $loginform = $( '#penci-loginpopform' ), 2306 $loginContainer = $loginform.closest( '.penci-popup-wrapper' ) 2307 2308 if ( $loginform.length ) { 2309 2310 $( '.penci-login-popup-btn a' ).magnificPopup( { 2311 type: 'inline', 2312 midClick: true, 2313 removalDelay: 600, 2314 mainClass: 'penci-popup-animation', 2315 } ) 2316 2317 $body.on( 'click', '.penci-lostpassword-btn', function ( e ) { 2318 var $this = $( this ), 2319 $parent = $this.closest( '.penci-popup-wrapper' ) 2320 2321 $parent.children( '.penci-popup-passreset' ).slideDown( 'normal' )
2322 $parent.children( '.penci-popup-login' ).slideUp( 'normal' ) 2323 e.preventDefault() 2324 return false 2325 } ) 2326 2327 $body.on( 'click', '.penci-register-popup-btn', function ( e ) { 2328 var $this = $( this ), 2329 $parent = $this.closest( '.penci-popup-wrapper' ) 2330 2331 $parent.children( '.penci-popup-register' ).slideDown( 'normal' ) 2332 $parent.children( '.penci-popup-login' ).slideUp( 'normal' ) 2333 e.preventDefault() 2334 return false 2335 } ) 2336 2337 $body.on( 'click', '.penci-login-popup-btn', function ( e ) { 2338 var $this = $( this ), 2339 $parent = $this.closest( '.penci-popup-wrapper' ) 2340 2341 $parent.children( '.penci-popup-login' ).slideDown( 'normal' ) 2342 $parent.children( '.penci-popup-register' ).slideUp( 'normal' ) 2343 $parent.children( '.penci-popup-passreset' ).slideUp( 'normal' ) 2344 2345 e.preventDefault() 2346 return false 2347 } ) 2348 2349 $( '#penci_user, #penci_pass' ).on( 'focus', function () { 2350 $( this ).removeClass( 'invalid' ) 2351 } ) 2352 2353 $loginform.on( 'submit', function ( e ) { 2354 var $this = $( this ), 2355 inputUsername = $this.find( '#penci_user' ), 2356 inputPass = $this.find( '#penci_pass' ), 2357 valUsername = inputUsername.val(), 2358 valPass = inputPass.val(), 2359 nonce = $this.find( '.penci_form_nonce' ).val(), 2360 gcapcha = $this.find( '.g-recaptcha-response' ) 2361 if ( gcapcha.length ) { 2362 var captcha = gcapcha.val() 2363 } else { 2364 var captcha = 'noexists' 2365 } 2366 2367 if ( inputUsername.length > 0 && valUsername == '' ) { 2368 inputUsername.addClass( 'invalid' ) 2369 e.preventDefault() 2370 } 2371 2372 if ( inputPass.length > 0 && valPass == '' ) { 2373 inputPass.addClass( 'invalid' ) 2374 e.preventDefault() 2375 } 2376 2377 if ( valUsername == '' || valPass == '' ) { 2378 return false 2379 } 2380 2381 $loginContainer.addClass( 'ajax-loading' ) 2382 $loginContainer.find( '.message' ).slideDown().remove() 2383 2384 var data = { 2385 action: 'penci_login_ajax', 2386 username: valUsername, 2387 password: valPass, 2388 captcha: captcha, 2389 security: nonce, 2390 remember: $loginContainer.find( '#remembermepopup' ).val(), 2391 } 2392 2393 $.post( ajax_var_more.url, data, function ( response ) { 2394 $loginContainer.removeClass( 'ajax-loading' ) 2395 $loginContainer.children( '.penci-popup-login' ). 2396 append( response.data ) 2397 if ( !response.success ) { 2398 return 2399 } 2400 2401 var rdurl = window.location.href, 2402 curl = ajax_var_more.redirect_url, 2403 urlPattern = /^(https?:\/\/)?([\w-]+\.)*[\w-]+[\.][\w]+(\/.*)?$/; 2404 2405 if ( urlPattern.test(curl) ) { 2406 rdurl = curl; 2407 } 2408 2409 window.location.href = rdurl + '?singin=true' 2410 } ) 2411 2412 e.preventDefault() 2413 return false 2414 } ) 2415 } 2416 }, 2417 recoverPassPopup: function () { 2418 var $body = $( 'body' ), 2419 $recoveryform = $( '#penci-passreset-popup' ), 2420 $recoveryContainer = $recoveryform.closest( 2421 '.penci-popup-wrapper' ) 2422 2423 if ( $recoveryform.length ) { 2424 2425 $( '.penci_user_email' ).on( 'focus', function () { 2426 $( this ).removeClass( 'invalid' ) 2427 } ) 2428 2429 $recoveryform.on( 'submit', function ( e ) { 2430 e.preventDefault() 2431 2432 var $this = $( this ), 2433 inputUsername = $this.find( '.penci_user_email' ), 2434 valUsername = inputUsername.val(), 2435 nonce = $this.find( '.penci_form_nonce' ).val(), 2436 gcapcha = $this.find( '.g-recaptcha-response' ) 2437 if ( gcapcha.length ) { 2438 var captcha = gcapcha.val() 2439 } else { 2440 var captcha = 'noexists' 2441 } 2442 2443 if ( inputUsername.length > 0 && valUsername == '' ) { 2444 inputUsername.addClass( 'invalid' ) 2445 2446 e.preventDefault() 2447 return false 2448 } 2449 2450 $recoveryContainer.addClass( 'ajax-loading' ) 2451 $recoveryContainer.find( '.message' ).slideDown().remove() 2452 2453 var data = { 2454 action: 'penci_resetpass_ajax', 2455 security: nonce, 2456 username: valUsername, 2457 captcha: captcha, 2458 } 2459 2460 $.post( ajax_var_more.url, data, function ( response ) { 2461 $recoveryContainer.removeClass( 'ajax-loading' ) 2462 $recoveryContainer.children( '.penci-popup-passreset' ). 2463 append( response.data ) 2464 2465 return 2466 } ) 2467 2468 event.preventDefault() 2469 return false 2470 } ) 2471 } 2472 }, 2473 registerPopup: function () { 2474 var $body = $( 'body' ), 2475 $registerform = $( '#penci-register-popup' ), 2476 $registerContainer = $registerform.closest( 2477 '.penci-popup-wrapper' ) 2478 2479 if ( $registerform.length ) { 2480 2481 var $allInput = $( 2482 '.penci_user_name,.penci_user_email,.penci_user_pass,.penci_user_pass_confirm' ) 2483 $allInput.on( 'focus', function () {
2484 $( this ).removeClass( 'invalid' ) 2485 } ) 2486 2487 $registerform.on( 'submit', function ( e ) { 2488 e.preventDefault() 2489 2490 var $this = $( this ), 2491 inputUsername = $this.find( '.penci_user_name' ), 2492 inputEmail = $this.find( '.penci_user_email' ), 2493 $inputPass = $this.find( '.penci_user_pass' ), 2494 $inputPassConfirm = $this.find( '.penci_user_pass_confirm' ), 2495 valUsername = inputUsername.val(), 2496 valEmail = inputEmail.val(), 2497 valPass = $inputPass.val(), 2498 valPassConfirm = $inputPassConfirm.val(), 2499 nonce = $this.find( '.penci_form_nonce' ).val(), 2500 gcapcha = $this.find( '.g-recaptcha-response' ) 2501 if ( gcapcha.length ) { 2502 var captcha = gcapcha.val() 2503 } else { 2504 var captcha = 'noexists' 2505 } 2506 2507 $allInput.removeClass( 'invalid' ) 2508 2509 if ( inputUsername.length > 0 && valUsername == '' ) { 2510 inputUsername.addClass( 'invalid' ) 2511 event.preventDefault() 2512 } 2513 2514 if ( inputEmail.length > 0 && valEmail == '' ) { 2515 inputEmail.addClass( 'invalid' ) 2516 event.preventDefault() 2517 } 2518 2519 if ( $inputPass.length > 0 && valPass == '' ) { 2520 $inputPass.addClass( 'invalid' ) 2521 event.preventDefault() 2522 } 2523 2524 if ( $inputPassConfirm.length > 0 && valPassConfirm == '' ) { 2525 $inputPassConfirm.addClass( 'invalid' ) 2526 event.preventDefault() 2527 } 2528 if ( valUsername == '' || valEmail == '' || valPass == '' || 2529 valPassConfirm == '' ) { 2530 return false 2531 } 2532 2533 $registerContainer.find( '.message' ).slideDown().remove() 2534 2535 // Password does not match the confirm password 2536 if ( valPassConfirm !== valPass ) { 2537 $inputPass.addClass( 'invalid' ) 2538 $inputPassConfirm.addClass( 'invalid' ) 2539 $registerContainer.children( '.penci-popup-register' ). 2540 append( ajax_var_more.errorPass ) 2541 event.preventDefault() 2542 2543 return false 2544 } 2545 $registerContainer.addClass( 'ajax-loading' ) 2546 2547 var data = { 2548 action: 'penci_register_ajax', 2549 fistName: $this.find( '.penci_first_name' ).val(), 2550 lastName: $this.find( '.penci_last_name' ).val(), 2551 username: valUsername, 2552 password: valPass, 2553 confirmPass: valPassConfirm, 2554 email: valEmail, 2555 security: nonce, 2556 captcha: captcha, 2557 } 2558 2559 $.post( ajax_var_more.url, data, function ( response ) { 2560 $registerContainer.removeClass( 'ajax-loading' ) 2561 $registerContainer.children( '.penci-popup-register' ). 2562 append( response.data ) 2563 if ( !response.success ) { 2564 return 2565 } 2566 window.location.href = window.location.href + '?singin=true' 2567 } ) 2568 2569 event.preventDefault() 2570 return false 2571 } ) 2572 2573 } 2574 }, 2575 login: function () { 2576 var $body = $( 'body' ), 2577 $loginform = $( '.penci-loginform' ), 2578 $loginContainer = $loginform.parent( '.penci-login-wrap' ) 2579 2580 if ( $loginform.length ) { 2581 $body.on( 'click', '.penci-user-register', function ( e ) { 2582 e.preventDefault() 2583 2584 var $this = $( this ), 2585 $parent = $this.closest( '.penci-login-register' ) 2586 2587 $parent.find( '.penci-login-wrap' ).addClass( 'hidden' ) 2588 $parent.find( '.penci-register-wrap' ).removeClass( 'hidden' ) 2589 } ) 2590 2591 $( '#penci-user-login,#penci-user-pass' ).on( 'focus', function () { 2592 $( this ).removeClass( 'invalid' ) 2593 } ) 2594 2595 $( '.penci-loginform' ).each( function () { 2596 $( this ).on( 'submit', function ( e ) { 2597 var $this = $( this ), 2598 $loginContainer = $this.parent( '.penci-login-wrap' ), 2599 inputUsername = $this.find( '#penci-user-login' ), 2600 inputPass = $this.find( '#penci-user-pass' ), 2601 valUsername = inputUsername.val(), 2602 valPass = inputPass.val(), 2603 nonce = $this.find( '.penci_form_nonce' ).val(), 2604 gcapcha = $this.find( '.g-recaptcha-response' ) 2605 if ( gcapcha.length ) { 2606 var captcha = gcapcha.val() 2607 } else { 2608 var captcha = 'noexists' 2609 } 2610 2611 if ( inputUsername.length > 0 && valUsername == '' ) {
2612 inputUsername.addClass( 'invalid' ) 2613 e.preventDefault() 2614 } 2615 2616 if ( inputPass.length > 0 && valPass == '' ) { 2617 inputPass.addClass( 'invalid' ) 2618 e.preventDefault() 2619 } 2620 2621 if ( valUsername == '' || valPass == '' ) { 2622 return false 2623 } 2624 2625 $loginContainer.parent().addClass( 'ajax-loading' ) 2626 $loginContainer.find( '.message' ).slideDown().remove() 2627 2628 var data = { 2629 action: 'penci_login_ajax', 2630 username: valUsername, 2631 password: valPass, 2632 captcha: captcha, 2633 security: nonce, 2634 remember: $loginContainer.find( '#rememberme' ).val(), 2635 } 2636 2637 $.post( ajax_var_more.url, data, function ( response ) { 2638 $loginContainer.parent().removeClass( 'ajax-loading' ) 2639 $loginContainer.append( response.data ) 2640 if ( !response.success ) { 2641 return 2642 } 2643 2644 window.location.href = window.location.href + '?singin=true' 2645 } ) 2646 2647 e.preventDefault() 2648 return false 2649 } ) 2650 } ) 2651 } 2652 }, 2653 register: function () { 2654 var $body = $( 'body' ), 2655 $registerform = $( '#penci-registration-form' ), 2656 $registerContainer = $registerform.closest( 2657 '.penci-register-wrap' ) 2658 2659 if ( !$registerform.length ) { 2660 return false 2661 } 2662 2663 $body.on( 'click', '.penci-user-login-here', function ( e ) { 2664 e.preventDefault() 2665 2666 var $this = $( this ), 2667 $parent = $this.closest( '.penci-login-register' ) 2668 2669 $parent.find( '.penci-login-wrap' ).removeClass( 'hidden' ) 2670 $parent.find( '.penci-register-wrap' ).addClass( 'hidden' ) 2671 2672 return false 2673 } ) 2674 2675 var $allInput = $( 2676 '.penci_user_name,.penci_user_email,.penci_user_pass,.penci_user_pass_confirm' ) 2677 $allInput.on( 'focus', function () { 2678 $( this ).removeClass( 'invalid' ) 2679 } ) 2680 2681 $( '.penci-registration-form' ).each( function () { 2682 $( this ).on( 'submit', function ( e ) { 2683 e.preventDefault() 2684 2685 var $this = $( this ), 2686 $registerContainer = $this.closest( '.penci-register-wrap' ), 2687 inputUsername = $this.find( '.penci_user_name' ), 2688 inputEmail = $this.find( '.penci_user_email' ), 2689 $inputPass = $this.find( '.penci_user_pass' ), 2690 $inputPassConfirm = $this.find( '.penci_user_pass_confirm' ), 2691 valUsername = inputUsername.val(), 2692 valEmail = inputEmail.val(), 2693 valPass = $inputPass.val(), 2694 valPassConfirm = $inputPassConfirm.val(), 2695 nonce = $this.find( '.penci_form_nonce' ).val(), 2696 gcapcha = $this.find( '.g-recaptcha-response' ) 2697 if ( gcapcha.length ) { 2698 var captcha = gcapcha.val() 2699 } else { 2700 var captcha = 'noexists' 2701 } 2702 2703 $allInput.removeClass( 'invalid' ) 2704 2705 if ( inputUsername.length > 0 && valUsername == '' ) { 2706 inputUsername.addClass( 'invalid' ) 2707 event.preventDefault() 2708 } 2709 2710 if ( inputEmail.length > 0 && valEmail == '' ) { 2711 inputEmail.addClass( 'invalid' ) 2712 event.preventDefault() 2713 } 2714 2715 if ( $inputPass.length > 0 && valPass == '' ) { 2716 $inputPass.addClass( 'invalid' ) 2717 event.preventDefault() 2718 } 2719 2720 if ( $inputPassConfirm.length > 0 && valPassConfirm == '' ) { 2721 $inputPassConfirm.addClass( 'invalid' ) 2722 event.preventDefault() 2723 } 2724 if ( valUsername == '' || valEmail == '' || valPass == '' || 2725 valPassConfirm == '' ) { 2726 return false 2727 } 2728 2729 $registerContainer.find( '.message' ).slideDown().remove() 2730 2731 // Password does not match the confirm password 2732 if ( valPassConfirm !== valPass ) { 2733 $inputPass.addClass( 'invalid' ) 2734 $inputPassConfirm.addClass( 'invalid' ) 2735 $registerContainer.append( ajax_var_more.errorPass ) 2736 event.preventDefault() 2737 2738 return false 2739 } 2740 $registerContainer.parent().addClass( 'ajax-loading' ) 2741 2742 var data = { 2743 action: 'penci_register_ajax', 2744 fistName: $this.find( '.penci_first_name' ).val(), 2745 lastName: $this.find( '.penci_last_name' ).val(), 2746 username: valUsername, 2747 password: valPass, 2748 confirmPass: valPassConfirm, 2749 email: valEmail, 2750 security: nonce, 2751 captcha: captcha, 2752 } 2753 2754 $.post( ajax_var_more.url, data, function ( response ) { 2755 $registerContainer.parent().removeClass( 'ajax-loading' ) 2756 $registerContainer.append( response.data ) 2757 if ( !response.success ) { 2758 return 2759 } 2760 window.location.href = window.location.href + '?singin=true' 2761 } ) 2762 2763 event.preventDefault() 2764 return false 2765 } ) 2766 } ) 2767 }, 2768 map: function () { 2769 if ( !$( '.penci-google-map' ).length ) { 2770 return false 2771 } 2772 $( '.penci-google-map' ).each( function () { 2773 2774 var map = $( this ), 2775 Option = map.data( 'map_options' ), 2776 mapID = map.attr( 'id' ) 2777 2778 var mapTypePre = google.maps.MapTypeId.ROADMAP 2779 switch ( Option.map_type ) { 2780 case'satellite': 2781 mapTypePre = google.maps.MapTypeId.SATELLITE 2782 break 2783 case'hybrid': 2784 mapTypePre = google.maps.MapTypeId.HYBRID 2785 break 2786 case'terrain': 2787 mapTypePre = google.maps.MapTypeId.TERRAIN 2788 } 2789 var latLng = new google.maps.LatLng( - 34.397, 150.644 ) 2790 var map = new google.maps.Map( document.getElementById( mapID ), {
2791 zoom: parseInt( Option.map_zoom ), 2792 center: latLng, 2793 mapTypeId: mapTypePre, 2794 panControl: Option.map_pan, 2795 zoomControl: Option.map_is_zoom, 2796 mapTypeControl: true, 2797 scaleControl: Option.map_scale, 2798 streetViewControl: Option.map_street_view, 2799 rotateControl: Option.map_rotate, 2800 overviewMapControl: Option.map_overview, 2801 scrollwheel: Option.map_scrollwheel, 2802 } ) 2803 var marker = new google.maps.Marker( { 2804 position: latLng, 2805 map: map, 2806 title: Option.marker_title, 2807 icon: Option.marker_img, 2808 } ) 2809 2810 if ( Option.info_window ) { 2811 var infoWindow = new google.maps.InfoWindow( { 2812 content: Option.info_window, 2813 } ) 2814 2815 google.maps.event.addListener( marker, 'click', function () { 2816 infoWindow.open( map, marker ) 2817 } ) 2818 } 2819 2820 if ( 'coordinates' == Option.map_using && Option.latitude && 2821 Option.longtitude ) { 2822 latLng = new google.maps.LatLng( Option.latitude, 2823 Option.longtitude ) 2824 map.setCenter( latLng ) 2825 marker.setPosition( latLng ) 2826 } else { 2827 var geocoder = new google.maps.Geocoder() 2828 geocoder.geocode( { 2829 address: Option.address, 2830 }, function ( results ) { 2831 var loc = results[0].geometry.location 2832 latLng = new google.maps.LatLng( loc.lat(), loc.lng() ) 2833 map.setCenter( latLng ) 2834 marker.setPosition( latLng ) 2835 } ) 2836 } 2837 } ) 2838 }, 2839 }, 2840 2841 PENCI.VideosList = { 2842 // Init the module 2843 init: function () { 2844 PENCI.VideosList.play() 2845 }, 2846 play: function () { 2847 if ( !$( '.penci-video_playlist' ).length ) { 2848 return false 2849 } 2850 $( '.penci-video_playlist' ).each( function ( idx, item ) { 2851 var $blockVideo = $( this ), 2852 $VideoF = $blockVideo.find( '.penci-video-frame' ) 2853 2854 var $height = $blockVideo.find( '.penci-video-nav' ).height(), 2855 $heightTitle = $blockVideo.find( 2856 '.penci-video-nav .penci-playlist-title' ).height() 2857 2858 $blockVideo.find( '.penci-video-playlist-nav' ). 2859 css( 'height', $height - $heightTitle ) 2860 // Init 2861 $VideoF.video() 2862 PENCI.VideosList.updateStatus( $blockVideo ) 2863 2864 // Show First video and remove the loader icon 2865 $VideoF.addVideoEvent( 'ready', function () { 2866 $VideoF.css( 'visibility', 'visible' ).fadeIn() 2867 $blockVideo.find( '.loader-overlay' ).remove() 2868 } ) 2869 // Play videos 2870 $blockVideo.on( 'click', '.penci-video-playlist-item', function () { 2871 var $thisVideo = $( this ), 2872 frameID = $thisVideo.data( 'name' ), 2873 $thisFrame = $( '#' + frameID ), 2874 videoSrc = $thisVideo.data( 'src' ), 2875 videoNum = $thisVideo.find( '.penci-video-number' ).text() 2876 2877 if ( $thisVideo.hasClass( 'is-playing' ) ) { 2878 $thisFrame.pauseVideo() 2879 return 2880 } 2881 2882 // Update the number of the playing video in the title section 2883 $blockVideo.find( '.penci-video-playing' ).text( videoNum ) 2884 2885 // Pause all Videos 2886 $blockVideo.find( '.penci-video-frame' ).each( function () { 2887 $( this ).pauseVideo().hide() 2888 } ) 2889 2890 // If the iframe not loaded before, add it 2891 if ( !$thisFrame.length ) { 2892 // Add the loader icon 2893 $blockVideo.find( '.fluid-width-video-wrapper' ).prepend( '' ) 2894 2895 $blockVideo.find( '.fluid-width-video-wrapper' ). 2896 append( '<iframe class="penci-video-frame" id="' + frameID + 2897 '" src="' + videoSrc + 2898 '" frameborder="0" width="100%"" height="434" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>' ) 2899 $thisFrame = $( '#' + frameID ) 2900 2901 $thisFrame.video() // reinit 2902 2903 $thisFrame.addVideoEvent( 'ready', 2904 function ( e, $thisFrame, video_type ) { 2905 $thisFrame.playVideo() 2906 $blockVideo.find( '.loader-overlay' ).remove() 2907 } ) 2908 } else { 2909 $thisFrame.playVideo() 2910 } 2911 2912 $thisFrame.css( 'visibility', 'visible' ).fadeIn() 2913 2914 PENCI.VideosList.updateStatus( $blockVideo ) 2915 2916 } ) 2917 } ) 2918 }, 2919 updateStatus: function ( $blockVideo ) { 2920 $blockVideo.find( '.penci-video-frame' ).each( function () { 2921 var $this = $( this ), 2922 $videoItem = $( '[data-name=\'' + $this.attr( 'id' ) + '\']' ) 2923 2924 $this.addVideoEvent( 'play', function () { 2925 $videoItem.removeClass( 'is-paused' ).addClass( 'is-playing' ) 2926 } ) 2927 2928 $this.addVideoEvent( 'pause', function () { 2929 $videoItem.removeClass( 'is-playing' ).addClass( 'is-paused' ) 2930 } ) 2931 2932 $this.addVideoEvent( 'finish', function () { 2933 $videoItem.removeClass( 'is-paused is-playing' ) 2934 } ) 2935 } ) 2936 }, 2937 }, 2938 2939 PENCI.JumtoRecipe = function () { 2940 2941 $( '.penci-jump-recipe' ).on( 'click', function ( e ) { 2942 e.preventDefault() 2943 var $closetMain = $( this ).closest( '.penci-single-block' ), 2944 id = $( this ).attr( 'href' ), 2945 $firstRecipe = $closetMain.find( id ).first() 2946 if ( $firstRecipe.length ) { 2947 var $scroll_top = $firstRecipe.offset().top, 2948 $nav_height = 30 2949 if ( $( '#navigation' ).length ) { 2950 $nav_height = $( '#navigation' ).height() + 30 2951 }
2951 else if ( $( '.pc-wrapbuilder-header' ).length ) { 2952 if ( window.matchMedia( '(max-width: 960px)' ).matches ) { 2953 var headermobile = $( '.penci_navbar_mobile' ) 2954 if ( !headermobile.hasClass( 'hide-scroll-down' ) ) { 2955 $nav_height = headermobile.height() + 30 2956 } 2957 } else { 2958 var headerdesktop = $( '.penci_builder_sticky_header_desktop' ) 2959 if ( headerdesktop.length && 2960 !headerdesktop.hasClass( 'hide-scroll-down' ) ) { 2961 $nav_height = headerdesktop.height() + 30 2962 } 2963 } 2964 } 2965 if ( $( 'body' ).hasClass( 'admin-bar' ) ) { 2966 $nav_height = $nav_height + 32 2967 } 2968 var $scroll_to = $scroll_top - $nav_height 2969 $( 'html,body' ).animate( { 2970 scrollTop: $scroll_to, 2971 }, 'fast' ) 2972 } 2973 } ) 2974 }, 2975 2976 /* Smart Lists 2977 ---------------------------------------------------------------*/ 2978 PENCI.SmartLists = function () { 2979 $( '.pcsml-dropdown' ).each( function () { 2980 var select = $( this ) 2981 select.on( 'change', function () { 2982 var url = this.value, 2983 curl = window.location.href 2984 2985 if ( url != curl && url !== undefined ) { 2986 window.location.href = url 2987 } 2988 } ) 2989 } ) 2990 }, 2991 2992 PENCI.Single_Loadmore = function () { 2993 var $wrapper_loadmore = $( '.penci-single-infiscroll' ) 2994 if ( $wrapper_loadmore.length ) { 2995 var adsHTML = $wrapper_loadmore.data( 'infiads' ) 2996 $( window ).on( 'scroll', $.debounce( 250, function () { 2997 var $lastArticle = $wrapper_loadmore.find( '.penci-single-block' ). 2998 last(), 2999 $windowScroll = $( window ).scrollTop(), 3000 $lastArticleTop = $lastArticle.offset().top, 3001 $dataURL = $lastArticle.data( 'prev-url' ) 3002 3003 if ( $lastArticle.hasClass( 'penci-single-infiblock-end' ) ) { 3004 $( '.penci-ldsingle' ).remove() 3005 } 3006 3007 if ( ( 3008 $windowScroll > $lastArticleTop 3009 ) && 3010 ( 3011 typeof $dataURL !== 'undefined' 3012 ) && ( 3013 typeof $dataURL !== '' 3014 ) && 3015 !$lastArticle.hasClass( 'penci-single-infiblock-end' ) ) { 3016 if ( !$wrapper_loadmore.hasClass( 'penci-disable-sendajax' ) ) { 3017 $wrapper_loadmore.addClass( 'penci-disable-sendajax' ) 3018 $.ajax( { 3019 url: $dataURL, 3020 type: 'GET', 3021 dataType: 'html', 3022 success: function ( result ) { 3023 var resultBlock = $( 3024 $( result ).find( '.penci-single-wrapper' ).html() ). 3025 css( 'opacity', 0 ). 3026 animate( { 'opacity': 1 }, 300 ) 3027 if ( ( 3028 typeof adsHTML !== 'undefined' 3029 ) && 3030 ( 3031 typeof adsHTML !== '' 3032 ) ) { 3033 $wrapper_loadmore.append( adsHTML ) 3034 } 3035 $wrapper_loadmore.append( resultBlock ) 3036 if ( resultBlock.find( '.penci_facebook_widget' ).length ) { 3037 try { 3038 FB.XFBML.parse() 3039 } catch ( ex ) { 3040 } 3041 } 3042 $wrapper_loadmore.removeClass( 'penci-disable-sendajax' ) 3043 3044 PENCI.featured_slider() 3045 PENCI.owl_slider() 3046 PENCI.fitvids() 3047 PENCI.sticky_sidebar() 3048 PENCI.lightbox() 3049 PENCI.masonry() 3050 PENCI.portfolio() 3051 PENCI.gallery() 3052 PENCI.Jarallax() 3053 PENCI.extraFunction.init() 3054 PENCI.VideosList.init() 3055 PENCI.JumtoRecipe() 3056 PENCI.shareexpand() 3057 PENCI.videofloat() 3058 3059 3060 var $review_process = $( '.penci-review-process' ), 3061 $review_piechart = $( '.penci-piechart' ) 3062 if ( $review_process.length ) { 3063 $( '.penci-review-process' ).each( function () { 3064 var $this = $( this ), 3065 $bar = $this.children(), 3066 $bar_w = $bar.data( 'width' ) * 10 3067 $this.one( 'inview', 3068 function ( event, isInView, visiblePartX, 3069 visiblePartY, 3070 ) { 3071 $bar.animate( { width: $bar_w + '%' }, 1000 ) 3072 } ) // bind inview 3073 } ) // each 3074 } 3075 3076 if ( $review_piechart.length ) { 3077 $( '.penci-piechart' ).each( function () { 3078 var $this = $( this ) 3079 $this.one( 'inview', 3080 function ( event, isInView, visiblePartX, 3081 visiblePartY, 3082 ) { 3083 var chart_args = { 3084 barColor: $this.data( 'color' ), 3085 trackColor: $this.data( 'trackcolor' ), 3086 scaleColor: false, 3087 lineWidth: $this.data( 'thickness' ), 3088 size: $this.data( 'size' ), 3089 animate: 1000, 3090 } 3091 $this.easyPieChart( chart_args ) 3092 } ) // bind inview 3093 } ) // each 3094 } 3095 $( 'body' ).trigger( 'single_loaded_more' ) 3096 }, 3097 } ) 3098 } 3099 } 3100 } ) ) 3101 3102 $( window ).bind( 'scroll touchstart', function () { 3103 // UPdate permalink 3104 var scrollTop = $( this ).scrollTop() 3105 var firstPost = $( '.penci-single-block' ) 3106 window.setTimeout( function () { 3107 var preScrollTop = scrollTop + 60 3108 var postsContainer = $( '.penci-single-block' ) 3109 var locationHref = window.location.href 3110 3111 var currentP = postsContainer.map( function () { 3112 if ( $( this ).offset().top < preScrollTop ) { 3113 return this 3114 } 3115 } ) 3116 3117 currentP = currentP[currentP.length - 1] 3118 var pid = $( currentP ).data( 'postid' ), 3119 plink = $( currentP ).data( 'current-url' ), 3120 ptitle = $( currentP ).data( 'post-title' ), 3121 pedit = $( currentP ).data( 'edit-post' ) 3122 3123 if ( typeof pid === 'undefined' || typeof pid === '' ) { 3124 pid = firstPost.data( 'postid' ) 3125 plink = firstPost.data( 'current-url' ) 3126 ptitle = firstPost.data( 'post-title' ) 3127 pedit = firstPost.data( 'edit-post' ) 3128 } 3129 3130 if ( locationHref !== plink ) { 3131 window.history.pushState( { 'pageTitle': ptitle }, '', plink ) 3132 if ( $( '#wpadminbar' ).length ) { 3133 $( '#wp-admin-bar-edit a' ).attr( 'href', pedit ) 3134 } 3135 if ( $( 'title' ).length ) { 3136 $( 'title' ).each( function () { 3137 $( this ).text( ptitle ) 3138 } ) 3139 } 3140 3141 if ( typeof _gaq !== 'undefined' && _gaq !== null ) {
3142 _gaq.push( ['_trackPageview', plink] ) 3143 } 3144 3145 if ( typeof ga !== 'undefined' && ga !== null ) { 3146 ga( 'send', 'pageview', plink ) 3147 } 3148 } 3149 3150 }, 100 ) 3151 } ) 3152 } 3153 } 3154 3155 /* Init functions 3156 ---------------------------------------------------------------*/ 3157 $( document ).ready( function () { 3158 PENCI.general() 3159 PENCI.cookie() 3160 PENCI.main_sticky() 3161 PENCI.featured_slider() 3162 PENCI.slick_slider() 3163 PENCI.owl_slider() 3164 PENCI.fitvids() 3165 PENCI.sticky_sidebar() 3166 PENCI.mega_menu() 3167 PENCI.mobile_menu() 3168 PENCI.toggleMenuHumburger() 3169 PENCI.lightbox() 3170 PENCI.masonry() 3171 PENCI.video_background() 3172 PENCI.portfolio() 3173 PENCI.gallery() 3174 PENCI.Jarallax() 3175 PENCI.RelatedPopup() 3176 PENCI.extraFunction.init() 3177 PENCI.VideosList.init() 3178 PENCI.JumtoRecipe() 3179 PENCI.Single_Loadmore() 3180 PENCI.fontsizeChanger() 3181 setTimeout( function () { 3182 PENCI.shareexpand() 3183 PENCI.fontsizeChanger() 3184 }, 100 ) 3185 PENCI.categories_lists() 3186 PENCI.blockheadinglist() 3187 PENCI.SmartLists() 3188 PENCI.videofloat() 3189 $( 'body' ).on( 'penci-block-heading', function () { 3190 PENCI.blockheadinglist() 3191 } ).on( 'penci-image-gallery', function () { 3192 PENCI.slick_slider() 3193 } ) 3194 $( 'body' ).on( 'el_featured_slider', function () { 3195 PENCI.slick_slider() 3196 PENCI.featured_slider() 3197 } ) 3198 $('body').on('slider-load',function ( ){ 3199 PENCI.owl_slider() 3200 }) 3201 $( 'body' ).on( 'penci_swiper_sliders', function () { 3202 PENCI.owl_slider() 3203 PENCI.slick_slider() 3204 } ) 3205 $( document ).on( 'pajax-tab-loaded', function () { 3206 PENCI.owl_slider() 3207 } ) 3208 $( window ).on( 'resize', function () { 3209 PENCI.sticky_sidebar() 3210 PENCI.blockheadinglist() 3211 PENCI.fontsizeChanger() 3212 PENCI.videofloat() 3213 setTimeout( function () { 3214 PENCI.shareexpand() 3215 }, 100 ) 3216 } ) 3217 $( window ).on ( 'scroll', function() { 3218 PENCI.fontsizeChanger() 3219 } ) 3220 $( document ).on( 'penci-mega-loaded', function () { 3221 PENCI.featured_slider() 3222 PENCI.owl_slider() 3223 PENCI.fitvids() 3224 PENCI.lightbox() 3225 PENCI.masonry() 3226 PENCI.portfolio() 3227 PENCI.gallery() 3228 PENCI.extraFunction.init() 3229 PENCI.VideosList.init() 3230 } ) 3231 } ) 3232 } 3233)( jQuery ) // EOF
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.