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