1/* Debounce */ 2(function (b, c) { 3 var $ = b.jQuery || b.Cowboy || (b.Cowboy = {}), a; 4 $.throttle = a = function (e, f, j, i) { 5 var h, d = 0; 6 if (typeof f !== "boolean") { 7 i = j; 8 j = f; 9 f = c 10 } 11 12 function g() { 13 var o = this, m = +new Date() - d, n = arguments; 14 15 function l() { 16 d = +new Date(); 17 j.apply(o, n) 18 } 19 20 function k() { 21 h = c 22 } 23 24 if (i && !h) { 25 l() 26 } 27 h && clearTimeout(h); 28 if (i === c && m > e) { 29 l() 30 } else { 31 if (f !== true) { 32 h = setTimeout(i ? k : l, i === c ? e - m : e) 33 } 34 } 35 } 36 37 if ($.guid) { 38 g.guid = j.guid = j.guid || $.guid++ 39 } 40 return g 41 }; 42 $.debounce = function (d, e, f) { 43 return f === c ? a(d, e, false) : a(d, f, e !== false) 44 } 45})(this); 46 47/* global PENCILOCALIZE */ 48(function ($) { 49 "use strict"; 50 var PENCI = PENCI || {}; 51 52 /* General functions 53 ---------------------------------------------------------------*/ 54 PENCI.general = function () { 55 // Top search 56 $('.pcheader-icon a.search-click').on('click', function (e) { 57 var $this = $(this), 58 $closet = $this.closest('.wrapper-boxed'), 59 $pbcloset = $this.closest('.penci_nav_col'); 60 if ($closet.hasClass('header-search-style-showup')) { 61 $this.next().toggleClass('active'); 62 } else { 63 $this.next().fadeToggle(); 64 } 65 var opentimeout = setTimeout(function () { 66 $closet.find('.search-input').focus(); 67 if ($pbcloset.length) { 68 $pbcloset.find('.search-input').focus(); 69 } 70 }, 200, function () { 71 clearTimeout(opentimeout); 72 }); 73 $('body').addClass('search-open'); 74 e.stopPropagation(); 75 return false; 76 }); 77 78 $('.pcheader-icon .close-search').off().on('click', function (e) { 79 $(this).closest('.show-search').fadeToggle(); 80 $('body').removeClass('search-open'); 81 return false; 82 }); 83 84 $(document).keyup(function (e) { 85 var bd = $('body'); 86 if (e.key === "Escape" && bd.hasClass('pchds-overlay') && bd.hasClass('search-open')) { 87 bd.removeClass('search-open'); 88 $('.show-search').fadeToggle(); 89 } 90 }); 91 92 // Go to top 93 $('.go-to-top, .penci-go-to-top-floating').off().on('click', function () { 94 $('html, body').animate({scrollTop: 0}, 700); 95 return false; 96 }); 97 98 // Go to top button 99 var $goto_button = $('.penci-go-to-top-floating'); 100 if ($goto_button.length) { 101 $(document).on('scroll', $.debounce(200, function () { 102 var y = $(this).scrollTop(); 103 if (y > 300) { 104 $goto_button.addClass('show-up'); 105 } else { 106 $goto_button.removeClass('show-up'); 107 } 108 })); 109 } 110 111 // Call back fitvid when click load more button on buddypress 112 $('body.buddypress .activity .load-more a').on('click', function () { 113 $(document).ajaxStop(function () { 114 $(".container").fitVids(); 115 }); 116 }); 117 118 var owlcarousel = $('.penci-owl-carousel-slider, .featured-area .penci-owl-featured-area'); 119 if (owlcarousel.length) { 120 owlcarousel.on('mouseleave', function (e) { 121 var $this = $(this), 122 dataAuto = $this.data('auto'), 123 sliderSpeed = $this.data('speed'); 124 if (dataAuto === true) { 125 $this.trigger('stop.owl.autoplay'); 126 $this.trigger('play.owl.autoplay', sliderSpeed); 127 } 128 }); 129 } 130 131 return false;
132 } 133 134 /* Share Expand 135 ---------------------------------------------------------------*/ 136 PENCI.shareexpand = function () { 137 var tag = $('.tags-share-box'), 138 tagr = $('body.rtl .tags-share-box'), 139 tago = tag.offset(), 140 tagw = tag.outerWidth(), 141 btnw = tag.find('.post-share-expand').outerWidth(); 142 143 tag.find('.new-ver-share').each(function (index) { 144 if ($('body').hasClass('rtl')) { 145 return; 146 } 147 var out = tagw + tago.left - btnw * 2, 148 itemw = $(this).outerWidth(), 149 itemo = $(this).offset(); 150 151 if (itemo.left + itemw < out) { 152 $(this).addClass('show'); 153 } else { 154 $(this).addClass('auto-hidden'); 155 tag.find('.post-share-expand').addClass('showing'); 156 } 157 }); 158 159 tagr.find('.new-ver-share').each(function (index) { 160 var out = tago.left, 161 itemw = $(this).outerWidth(), 162 itemo = $(this).offset(); 163 164 if (itemo.left - itemw > out) { 165 $(this).addClass('show'); 166 } else { 167 $(this).addClass('auto-hidden'); 168 tag.find('.post-share-expand').addClass('showing'); 169 } 170 }); 171 172 $('.post-share-item.post-share-expand').on('click', function (e) { 173 e.preventDefault(); 174 var parent = $(this).closest('.post-share'); 175 parent.find('.auto-hidden').toggleClass('active'); 176 parent.toggleClass('showing-hidden'); 177 }); 178 179 tag.css('opacity', '1'); 180 } 181 182 /* Smooth Scroll */ 183 PENCI.smoothlinkscroll = function () { 184 $('a[href^="#"]').on('click', function (e) { 185 // e.preventDefault(); 186 187 var target = this.hash, 188 $target = $(target); 189 190 $('html, body').stop().animate({ 191 'scrollTop': $target.offset().top - 70 192 }, 900, 'swing', function () { 193 window.location.hash = target; 194 }); 195 }); 196 } 197 /* Cookie Law 198 ---------------------------------------------------------------*/ 199 PENCI.cookie = function () { 200 var wrapCookie = '.penci-wrap-gprd-law', 201 $wrapCookie = $(wrapCookie), 202 classAction = 'penci-wrap-gprd-law-close', 203 penciCookieName = 'penci_law_footer_new'; 204 205 if (!$wrapCookie.length) { 206 return false; 207 } 208 209 var penciCookie = { 210 set: function (name, value) { 211 var date = new Date(); 212 date.setTime(date.getTime() + (31536000000)); 213 var expires = "; expires=" + date.toGMTString(); 214 document.cookie = name + "=" + value + expires + "; path=/"; 215 }, 216 read: function (name) { 217 var namePre = name + "="; 218 var cookieSplit = document.cookie.split(';'); 219 for (var i = 0; i < cookieSplit.length; i++) { 220 var cookie = cookieSplit[i]; 221 while (cookie.charAt(0) == ' ') { 222 cookie = cookie.substring(1, cookie.length); 223 } 224 if (cookie.indexOf(namePre) === 0) { 225 return cookie.substring(namePre.length, cookie.length); 226 } 227 } 228 return null; 229 }, 230 erase: function (name) { 231 this.set(name, "", -1); 232 }, 233 exists: function (name) { 234 return ( 235 this.read(name) !== null 236 ); 237 } 238 }; 239 240 $wrapCookie.removeClass('penci-close-all'); 241 if (!penciCookie.exists(penciCookieName) || (penciCookie.exists(penciCookieName) && 1 == penciCookie.read(penciCookieName))) { 242 $wrapCookie.removeClass(classAction); 243 } else { 244 $wrapCookie.addClass(classAction); 245 } 246 247 $('.penci-gprd-accept, .penci-gdrd-show').on('click', function (e) { 248 e.preventDefault(); 249 250 var $this = $(this), 251 $parent_law = $this.closest(wrapCookie); 252 253 $parent_law.toggleClass(classAction); 254 255 if ($parent_law.hasClass(classAction)) { 256 penciCookie.set(penciCookieName, '2'); 257 } else { 258 penciCookie.set(penciCookieName, '1'); 259 } 260 261 return false;
262 }); 263 } 264 265 /* Sticky main navigation 266 ---------------------------------------------------------------*/ 267 PENCI.main_sticky = function () { 268 if ($("nav#navigation").length && $().pensticky && !$("nav#navigation").hasClass('penci-disable-sticky-nav')) { 269 var spaceTop = 0; 270 if ($('body').hasClass('admin-bar')) { 271 spaceTop = 32; 272 } 273 $("nav#navigation").each(function () { 274 $(this).pensticky({topSpacing: spaceTop}); 275 }); 276 } // sticky 277 } 278 279 /* Homepage Featured Slider 280 ---------------------------------------------------------------*/ 281 PENCI.featured_slider = function () { 282 if ($().owlCarousel) { 283 $('.featured-area .penci-owl-featured-area').each(function () { 284 var $this = $(this), 285 $style = $this.data('style'), 286 $auto = false, 287 $autotime = $this.data('autotime'), 288 $speed = $this.data('speed'), 289 $loop = $this.data('loop'), 290 $item = 1, 291 $nav = true, 292 $dots = false, 293 $rtl = false, 294 $items_desktop = 1, 295 $items_tablet = 1, 296 $items_tabsmall = 1, 297 $items_mobile = 1; 298 299 if ($style === 'style-2') { 300 $item = 2; 301 } else if ($style === 'style-28') { 302 $loop = true; 303 } 304 305 if ($('html').attr('dir') === 'rtl') { 306 $rtl = true; 307 } 308 if ($this.attr('data-auto') === 'true') { 309 $auto = true; 310 } 311 if ($this.attr('data-nav') === 'false') { 312 $nav = false; 313 } 314 if ($this.attr('data-dots') === 'true') { 315 $dots = true; 316 } 317 if ($this.attr('data-item')) { 318 $item = parseInt($this.data('item')); 319 } 320 if ($this.attr('data-desktop')) { 321 $items_desktop = parseInt($this.data('desktop')); 322 } 323 if ($this.attr('data-tablet')) { 324 $items_tablet = parseInt($this.data('tablet')); 325 } 326 if ($this.attr('data-tabsmall')) { 327 $items_tabsmall = parseInt($this.data('tabsmall')); 328 } 329 if ($this.attr('data-mobile')) { 330 $items_mobile = parseInt($this.data('mobile')); 331 } 332 333 var owl_args = { 334 rtl: $rtl, 335 loop: $loop, 336 margin: 0, 337 items: $item, 338 navSpeed: $speed, 339 dotsSpeed: $speed, 340 nav: $nav, 341 slideBy: $item, 342 mouseDrag: false, 343 lazyLoad: true, 344 dots: $dots, 345 navText: ['<i class="penciicon-left-chevron"></i>', '<i class="penciicon-right-chevron"></i>'], 346 autoplay: $auto, 347 autoplayTimeout: $autotime, 348 autoplayHoverPause: true, 349 autoplaySpeed: $speed, 350 responsive: { 351 0: { 352 items: $items_mobile, 353 slideBy: $items_mobile 354 }, 355 480: { 356 items: $items_tabsmall, 357 slideBy: $items_tabsmall 358 }, 359 768: { 360 items: $items_tablet, 361 slideBy: $items_tablet 362 }, 363 1170: { 364 items: $items_desktop, 365 slideBy: $items_desktop 366 } 367 } 368 } 369 370 if ($style === 'style-2') { 371 owl_args['center'] = true; 372 owl_args['margin'] = 10; 373 owl_args['autoWidth'] = true; 374 } else if ($style === 'style-28') { 375 owl_args['margin'] = 4; 376 owl_args['items'] = 6; 377 owl_args['autoWidth'] = true; 378 } else if ($style === 'style-38') { 379 owl_args['center'] = true; 380 owl_args['margin'] = 5; 381 owl_args['autoWidth'] = true; 382 } 383 384 $this.owlCarousel(owl_args); 385 386 $this.on('initialize.owl.carousel', function (event) { 387 $this.closest('.featured-area').addClass('penci-featured-loaded'); 388 }); 389 390 $this.on('changed.owl.carousel', function (event) { 391 /*$this.find('.penci-lazy').Lazy({ 392 effect: 'fadeIn', 393 effectTime: 200, 394 scrollDirection: 'both' 395 });*/ 396 //lazySizes.init(); 397 }); 398 }); 399 } // if owlcarousel
400 } 401 402 /* Owl Slider General 403 ---------------------------------------------------------------*/ 404 PENCI.owl_slider = function () { 405 if ($().owlCarousel) { 406 $('.penci-owl-carousel-slider').each(function () { 407 var $this = $(this), 408 $parent = $this.parent(), 409 $auto = true, 410 $dots = false, 411 $nav = true, 412 $loop = true, 413 $rtl = false, 414 $dataauto = $this.data('auto'), 415 $items_desktop = 1, 416 $items_tablet = 1, 417 $items_tabsmall = 1, 418 $items_mobile = 1, 419 $speed = 600, 420 $item = 1, 421 $margin = 0, 422 $autotime = 5000, 423 $datalazy = false; 424 425 if ($('html').attr('dir') === 'rtl') { 426 $rtl = true; 427 } 428 if ($this.attr('data-dots') === 'true') { 429 $dots = true; 430 } 431 if ($this.attr('data-loop') === 'false') { 432 $loop = false; 433 } 434 if ($this.attr('data-nav') === 'false') { 435 $nav = false; 436 } 437 438 if ($this.attr('data-margin')) { 439 $margin = parseInt($this.data('margin')); 440 } 441 if ($this.attr('data-desktop')) { 442 $items_desktop = parseInt($this.data('desktop')); 443 } 444 if ($this.attr('data-tablet')) { 445 $items_tablet = parseInt($this.data('tablet')); 446 } 447 if ($this.attr('data-tabsmall')) { 448 $items_tabsmall = parseInt($this.data('tabsmall')); 449 } 450 if ($this.attr('data-mobile')) { 451 $items_mobile = parseInt($this.data('mobile')); 452 } 453 if ($this.attr('data-speed')) { 454 $speed = parseInt($this.data('speed')); 455 } 456 if ($this.attr('data-autotime')) { 457 $autotime = parseInt($this.data('autotime')); 458 } 459 if ($this.attr('data-item')) { 460 $item = parseInt($this.data('item')); 461 } 462 if ($this.attr('data-lazy')) { 463 $datalazy = true; 464 } 465 466 var owl_args = { 467 loop: $loop, 468 rtl: $rtl, 469 margin: $margin, 470 items: $item, 471 slideBy: $item, 472 lazyLoad: $datalazy, 473 navSpeed: $speed, 474 dotsSpeed: $speed, 475 nav: $nav, 476 dots: $dots, 477 navText: ['<i class="penciicon-left-chevron"></i>', '<i class="penciicon-right-chevron"></i>'], 478 autoplay: $dataauto, 479 autoplayTimeout: $autotime, 480 autoHeight: true, 481 autoplayHoverPause: true, 482 autoplaySpeed: $speed, 483 responsive: { 484 0: { 485 items: $items_mobile, 486 slideBy: $items_mobile 487 }, 488 480: { 489 items: $items_tabsmall, 490 slideBy: $items_tabsmall 491 }, 492 768: { 493 items: $items_tablet, 494 slideBy: $items_tablet 495 }, 496 1170: { 497 items: $items_desktop, 498 slideBy: $items_desktop 499 } 500 } 501 }; 502 503 var amimation = $this.attr('data-anim'); 504 if (typeof amimation !== typeof undefined && amimation !== false) { 505 var $animIn = false, 506 $animOut = false, 507 $anim = $this.data('anim'); 508 509 if ($anim === 'slideInUp') { 510 $animIn = 'slideInUp'; 511 $animOut = 'slideOutUp'; 512 } else if ($anim === 'slideInRight') { 513 $animIn = 'TickerslideInRight'; 514 $animOut = 'TickerslideOutRight'; 515 } else if ($anim === 'fadeIn') { 516 $animIn = 'fadeIn'; 517 $animOut = 'fadeOut'; 518 } 519 owl_args['animateOut'] = $animOut; 520 owl_args['animateIn'] = $animIn; 521 } 522 523 $this.owlCarousel(owl_args); 524 525 $this.on('changed.owl.carousel', function (event) { 526 /*$this.find('.penci-lazy').Lazy({ 527 effect: 'fadeIn', 528 effectTime: 200, 529 scrollDirection: 'both' 530 });*/ 531 //lazySizes.init(); 532 }); 533 534 if ($parent.hasClass('penci-topbar-trending')) { 535 var $customNext = $parent.find(".penci-slider-next"), 536 $customPrev = $parent.find(".penci-slider-prev"); 537 $customNext.on('click', function (ev) { 538 ev.preventDefault(); 539 $this.trigger("next.owl.carousel"); 540 return false;
541 }); 542 $customPrev.on('click', function (ev) { 543 ev.preventDefault(); 544 $this.trigger("prev.owl.carousel"); 545 return false; 546 }); 547 } 548 }); 549 } // if owlcarousel 550 } 551 552 /* Fitvids 553 ---------------------------------------------------------------*/ 554 PENCI.fitvids = function () { 555 // Target your .container, .wrapper, .post, etc. 556 if ($().fitVids) { 557 $(".container").fitVids(); 558 } 559 } 560 561 /* Sticky sidebar 562 ----------------------------------------------------------------*/ 563 PENCI.sticky_sidebar = function () { 564 if ($().theiaStickySidebar) { 565 var top_margin = 80; 566 if ($('body').hasClass('admin-bar') && $('body').hasClass('penci-vernav-enable')) { 567 top_margin = 52; 568 } else if (!$('body').hasClass('admin-bar') && $('body').hasClass('penci-vernav-enable')) { 569 top_margin = 20; 570 } else if ($('body').hasClass('admin-bar') && !$('body').hasClass('penci-vernav-enable')) { 571 top_margin = 112; 572 } 573 574 if ($('.pc-wrapbuilder-header').length) { 575 var headerdesktop = $('.penci_builder_sticky_header_desktop'); 576 top_margin = 20; 577 if (headerdesktop.length && !headerdesktop.hasClass('hide-scroll-down')) { 578 top_margin = headerdesktop.height() + 20; 579 } 580 if ($('body').hasClass('admin-bar')) { 581 top_margin = top_margin + 32; 582 } 583 } 584 585 if ($('.penci-vc-sticky-sidebar > .penci-vc-row > .penci-vc-column').length) { 586 $('.penci-vc-sticky-sidebar > .penci-vc-row > .penci-vc-column').theiaStickySidebar({ 587 additionalMarginTop: top_margin, 588 'minWidth': 961 589 }); 590 } 591 592 if ($('.penci-enSticky .penci-sticky-sb').length) { 593 $('.penci-enSticky .penci-sticky-sb,.penci-enSticky .penci-sticky-ct').theiaStickySidebar({ 594 additionalMarginTop: top_margin, 595 'minWidth': 961 596 }); 597 } 598 $('#main.penci-main-sticky-sidebar, #sidebar.penci-sticky-sidebar').theiaStickySidebar({ 599 // settings 600 additionalMarginTop: top_margin 601 }); 602 } // if sticky 603 } 604 605 /* Mega menu 606 ----------------------------------------------------------------*/ 607 PENCI.mega_menu = function () { 608 // Hover parent 609 $('#navigation ul.menu > li.penci-mega-menu').on('mouseenter', function () { 610 var $this = $(this), 611 $row_active = $this.find('.row-active'), 612 $rowsLazy = $row_active.find('.penci-lazy'); 613 $row_active.fadeIn('200').css('display', 'inline-block'); 614 /*$rowsLazy.Lazy({ 615 effect: 'fadeIn', 616 effectTime: 300, 617 scrollDirection: 'both' 618 });*/ 619 //lazySizes.init(); 620 }); 621 622 $('#navigation .penci-mega-child-categories a').on('mouseenter', function () { 623 if (!$(this).hasClass('cat-active')) { 624 var $this = $(this), 625 $row_active = $this.data('id'), 626 $parentA = $this.parent().children('a'), 627 $parent = $this.closest('.penci-megamenu'), 628 $rows = $this.closest('.penci-megamenu').find('.penci-mega-latest-posts').children('.penci-mega-row'), 629 $rowsLazy = $rows.find('.penci-lazy'); 630 $parentA.removeClass('cat-active'); 631 $this.addClass('cat-active'); 632 $rows.hide(); 633 $rows.removeClass('row-active'); 634 $parent.find('.' + $row_active).fadeIn('300').css('display', 'inline-block').addClass('row-active'); 635 /*$rowsLazy.Lazy({ 636 effect: 'fadeIn', 637 effectTime: 300, 638 scrollDirection: 'both' 639 });*/ 640 //lazySizes.init(); 641 } 642 }); 643 } 644 645 /* Mobile menu responsive 646 ----------------------------------------------------------------*/ 647 PENCI.mobile_menu = function () { 648 // Add indicator 649 $('#sidebar-nav .menu li.menu-item-has-children > a').append('<u class="indicator"><i class="fa fa-angle-down"></i></u>'); 650 651 // Toggle menu when click show/hide menu 652 $('#navigation .button-menu-mobile').on('click', function () { 653 $('body').addClass('open-sidebar-nav'); 654 }); 655 656 // indicator click 657 $('#sidebar-nav .menu li a .indicator').on('click', function (e) { 658 if ($('body').hasClass('penci-vernav-cparent')) { 659 return; 660 } 661 var $this = $(this); 662 e.preventDefault(); 663 $this.children().toggleClass('fa-angle-up'); 664 $this.parent().next().slideToggle('fast'); 665 }); 666 667 $('.penci-vernav-cparent #sidebar-nav .menu li.menu-item-has-children > a').on('click', function (e) { 668 var $this = $(this); 669 e.preventDefault(); 670 $this.children().children().toggleClass('fa-angle-up'); 671 $this.next().slideToggle('fast'); 672 }); 673 674 // Close sidebar nav 675 $('#close-sidebar-nav').on('click', function () { 676 $('body').removeClass('open-sidebar-nav'); 677 }); 678 } 679 680 PENCI.toggleMenuHumburger = function () { 681 var $menuhumburger = $('.penci-menu-hbg'); 682 if ($menuhumburger.length) { 683 var $body = $('body'), 684 $button = $('.penci-vernav-toggle,.penci-menuhbg-toggle,#penci-close-hbg,.penci-menu-hbg
684-overlay'), 685 sidebarClass = 'penci-menuhbg-open'; 686 687 // Add indicator 688 $('.penci-menu-hbg .menu li.menu-item-has-children > a').append('<u class="indicator"><i class="fa fa-angle-down"></i></u>'); 689 690 // indicator click 691 $('.penci-menu-hbg .menu li a .indicator').on('click', function (e) { 692 if ($('body').hasClass('penci-hbg-cparent')) { 693 return; 694 } 695 var $this = $(this); 696 e.preventDefault(); 697 $this.children().toggleClass('fa-angle-up'); 698 $this.parent().next().slideToggle('fast'); 699 }); 700 701 $('.penci-hbg-cparent .penci-menu-hbg .menu li.menu-item-has-children > a').on('click', function (e) { 702 var $this = $(this); 703 e.preventDefault(); 704 $this.children().children().toggleClass('fa-angle-up'); 705 $this.next().slideToggle('fast'); 706 }); 707 708 // Click to show mobile menu 709 $button.on('click', function (e) { 710 e.preventDefault(); 711 712 if ($body.hasClass(sidebarClass)) { 713 $body.removeClass(sidebarClass); 714 $button.removeClass('active'); 715 716 return; 717 } 718 e.stopPropagation(); // Do not trigger click event on '.site' below 719 $body.addClass(sidebarClass); 720 $button.addClass('active'); 721 722 /*$('.penci-menu-hbg .penci-lazy').Lazy({ 723 effect: 'fadeIn', 724 effectTime: 300, 725 scrollDirection: 'both' 726 });*/ 727 //lazySizes.init(); 728 }); 729 730 // Scroll menu hamburger and callback lazyload 731 $menuhumburger.on('scroll', $.debounce(150, function () { 732 /*$('.penci-menu-hbg .penci-lazy').Lazy({ 733 effect: 'fadeIn', 734 effectTime: 300, 735 scrollDirection: 'both' 736 });*/ 737 //lazySizes.init(); 738 })); 739 } 740 } 741 742 /* Light box 743 ----------------------------------------------------------------*/ 744 PENCI.lightbox = function () { 745 if ($().magnificPopup) { 746 $('a[data-rel^="penci-gallery-image-content"], .penci-enable-lightbox .gallery-item a').magnificPopup({ 747 type: 'image', 748 closeOnContentClick: true, 749 closeBtnInside: false, 750 fixedContentPos: true, 751 image: { 752 verticalFit: true, 753 titleSrc: 'data-cap' 754 }, 755 gallery: { 756 enabled: true 757 }, 758 zoom: { 759 enabled: false, 760 duration: 300 761 } 762 }); 763 764 $('a[data-rel^="penci-gallery-bground-content"]').magnificPopup({ 765 type: 'image', 766 closeOnContentClick: true, 767 closeBtnInside: false, 768 fixedContentPos: true, 769 image: { 770 verticalFit: true, 771 }, 772 gallery: { 773 enabled: true 774 } 775 }); 776 777 778 // Enable lightbox videos 779 $('.penci-other-layouts-lighbox').magnificPopup({ 780 type: 'iframe', 781 mainClass: 'mfp-fade', 782 fixedContentPos: true, 783 closeBtnInside: false, 784 closeOnContentClick: true 785 }); 786 787 if ($('.penci-image-gallery').length) { 788 $('.penci-image-gallery').each(function () { 789 var $this = $(this), 790 id = $this.attr('id'); 791 792 $('#' + id + ' a.penci-gallery-ite').magnificPopup({ 793 type: 'image', 794 closeOnContentClick: true, 795 closeBtnInside: false, 796 fixedContentPos: true, 797 image: { 798 verticalFit: true, 799 titleSrc: 'data-cap' 800 }, 801 gallery: { 802 enabled: true 803 } 804 }); 805 }); 806 } 807 808 if ($('.penci-post-gallery-container').length) { 809 $('.penci-post-gallery-container').each(function () { 810 var $this = $(this), 811 id = $this.attr('id'); 812 813 $('#' + id + ' a.penci-gallery-ite').magnificPopup({ 814 type: 'image', 815 closeOnContentClick: true, 816 closeBtnInside: false, 817 fixedContentPos: true, 818 image: { 819 verticalFit: true, 820 titleSrc: 'data-cap' 821 }, 822 gallery: { 823 enabled: true 824 } 825 }); 826 }); 827 } 828 829 } // if magnificPopup exists 830 } 831 832 /* Masonry layout 833 ----------------------------------------------------------------*/ 834 PENCI.masonry = function () { 835 var $masonry_container = $('.penci-masonry, .penci-bgstyle-2 .penci-biggrid-data'); 836 if ($masonry_container.length) { 837 $masonry_container.each(function () { 838 var $this = $(this); 839 $this.imagesLoaded(function () { 840 // initialize isotope 841 $this.isotope({ 842 itemSelector: '.item-masonry', 843 transitionDuration: '.55s', 844 layoutMode: 'masonry' 845 }); 846 }); 847 }); 848 } 849 } 850
851 /* Video Background 852 ----------------------------------------------------------------*/ 853 PENCI.video_background = function () { 854 var $penci_videobg = $('#penci-featured-video-bg'); 855 if ($penci_videobg.length) { 856 $($penci_videobg).each(function () { 857 var $this = $(this), 858 $src = $this.data('videosrc'), 859 $startime = $this.data('starttime'), 860 $jarallaxArgs = { 861 videoSrc: $src, 862 videoStartTime: $startime, 863 videoPlayOnlyVisible: false 864 }; 865 866 jarallax($this, $jarallaxArgs); 867 $('.featured-area').addClass('loaded-wait'); 868 setTimeout(function () { 869 $('.featured-area').addClass('loaded-animation'); 870 }, 1500); 871 }); 872 } 873 } 874 875 /* Portfolio 876 ----------------------------------------------------------------*/ 877 PENCI.portfolio = function () { 878 var $penci_portfolio = $('.penci-portfolio'); 879 880 881 if ($().isotope && $penci_portfolio.length) { 882 $('.penci-portfolio').each(function () { 883 var $this = $(this), 884 unique_id = $(this).attr('id'), 885 DataFilter = null; 886 887 if (typeof (portfolioDataJs) != "undefined" && portfolioDataJs !== null) { 888 for (var e in portfolioDataJs) { 889 890 if (portfolioDataJs[e].instanceId == unique_id) { 891 var DataFilter = portfolioDataJs[e]; 892 } 893 } 894 } 895 896 $this.imagesLoaded(function () { 897 $this.isotope({ 898 itemSelector: '.portfolio-item', 899 animationEngine: 'best-available', 900 animationOptions: { 901 duration: 250, 902 queue: false 903 } 904 }); // isotope 905 906 $this.addClass('loaded'); 907 908 $('.portfolio-item .inner-item-portfolio').each(function () { 909 var $this = $(this); 910 $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) { 911 $this.addClass('animated'); 912 }); // inview 913 }); // each 914 915 var location = window.location.hash.toString(); 916 if (location.length) { 917 location = location.replace('#', ''); 918 location.match(/:/); 919 var Mlocation = location.match(/^([^:]+)/)[1]; 920 location = location.replace(Mlocation + ":", ""); 921 922 if (location.length > 1) { 923 924 var $termActive = $afilter.filter('[data-term="' + location + '"]'), 925 portfolioItem = $this.find('.portfolio-item'), 926 $buttonLoadMore = $this.parent().find('.penci-pagenavi-shortcode'); 927 928 if ($termActive.length) { 929 930 liFilter.removeClass('active'); 931 $termActive.parent().addClass('active'); 932 $this.isotope({filter: '.penci-' + location}); 933 934 var dataTerm = $termActive.data("term"), 935 p = {}; 936 937 DataFilter.currentTerm = dataTerm; 938 $.each(DataFilter.countByTerms, function (t, e) { 939 p[t] = 0 940 }); 941 942 portfolioItem.each(function (t, e) { 943 $.each(($(e).data("terms") + "").split(" "), function (t, e) { 944 p[e]++; 945 }) 946 }); 947 948 var show_button = 'number' == typeof p[dataTerm] && p[dataTerm] == DataFilter.countByTerms[dataTerm]; 949 if ($buttonLoadMore.length) { 950 if (portfolioItem.length !== DataFilter.count && !show_button) { 951 $buttonLoadMore.show(); 952 } else { 953 $buttonLoadMore.hide(); 954 } 955 } 956 } 957 } 958 } 959 }); // imagesloaded 960 961 // Filter items when filter link is clicked 962 var $filter = $this.parent().find('.penci-portfolio-filter'), 963 $afilter = $filter.find('a'), 964 liFilter = $filter.find('li'); 965 966 liFilter.on('click', function () { 967 968 var self = $(this), 969 term = self.find('a').data("term"), 970 selector = self.find("a").attr('data-filter'), 971 $e_dataTerm = $filter.find('a').filter('[data-term="' + term + '"]'), 972 portfolioItem = $this.find('.portfolio-item'), 973 $buttonLoadMore = $this.parent().find('.penci-pagenavi-shortcode'), 974 scrollTop = $(window).scrollTop(); 975 976 liFilter.removeClass('active'); 977 self.addClass('active'); 978 979 $this.parent().find('.penci-ajax-more-button').attr('data-cat', term); 980 981 $this.isotope({filter: selector}); 982 983 if ($e_dataTerm.length) { 984 window.location.hash = "*" == term ? "" : term; 985 986 $(window).scrollTop(scrollTop); 987 } 988 989 var p = {}; 990 DataFilter.currentTerm = term; 991 $.each(DataFilter.countByTerms, function (t, e) { 992 p[t] = 0 993 }); 994 995 portfolioItem.each(function (t, e) { 996 $.each(($(e).data("terms") + "").split(" "), function (t, e) { 997 p[e]++; 998 }) 999 }); 1000 1001 var show_button = 'number' == typeof p[term] && p[term] == DataFilter.countByTerms[term]; 1002 if ($buttonLoadMore.length) { 1003 if (portfolioItem.length !== DataFilter.count && !show_button) { 1004 $buttonLoadMore.show(); 1005 } else { 1006 $buttonLoadMore.hide(); 1007 } 1008 } 1009 1010 return false;
1011 }); 1012 1013 PENCI.portfolioLoadMore.loadMore($this, DataFilter); 1014 PENCI.portfolioLoadMore.infinityScroll(DataFilter); 1015 1016 }); // each .penci-portfolio 1017 1018 } // end if isotope & portfolio 1019 1020 1021 var $btnLoadMore = $('.penci-plf-loadmore'); 1022 if (!$().isotope || !$btnLoadMore.length) { 1023 return false; 1024 } 1025 } 1026 1027 PENCI.portfolioLoadMore = { 1028 btnLoadMore: $('.penci-plf-loadmore'), 1029 loadMore: function ($pfl_wapper, DataFilter) { 1030 var self = this; 1031 $('body').on('click', '.penci-ajax-more-button', function (event) { 1032 self.actionLoadMore($(this), $pfl_wapper, DataFilter); 1033 }); 1034 }, 1035 infinityScroll: function (DataFilter) { 1036 var self = this, 1037 $handle = $('.penci-plf-loadmore'), 1038 $button_load = $handle.find('.penci-ajax-more-button'); 1039 1040 if ($handle.hasClass('penci-infinite-scroll')) { 1041 $(window).on('scroll', function () { 1042 var hT = $button_load.offset().top, 1043 hH = $button_load.outerHeight(), 1044 wH = $(window).height(), 1045 wS = $(this).scrollTop(); 1046 1047 if ((wS > (hT + hH - wH)) && $button_load.length) { 1048 var $pfl_wapper = $button_load.closest('.penci-portfolio'); 1049 self.actionLoadMore($button_load, $pfl_wapper, DataFilter); 1050 } 1051 }).trigger('scroll'); 1052 } 1053 }, 1054 actionLoadMore: function ($button_load, $pfl_wapper, DataFilter) { 1055 if ($button_load.hasClass('loading-portfolios')) { 1056 return false; 1057 } 1058 1059 $button_load.addClass('loading-portfolios'); 1060 1061 var mesNoMore = $button_load.data('mes_no_more'), 1062 mes = $button_load.data('mes'); 1063 1064 DataFilter.pflShowIds = []; 1065 1066 $button_load.closest('.wrapper-penci-portfolio').find('.portfolio-item').each(function (t, e) { 1067 DataFilter.pflShowIds.push($(e).data('pflid')); 1068 }); 1069 1070 var data = { 1071 action: 'penci_pfl_more_post_ajax', 1072 datafilter: DataFilter, 1073 nonce: ajax_var_more.nonce 1074 }; 1075 $.post(ajax_var_more.url, data, function (response) { 1076 if (!response.data.items) { 1077 $button_load.find('.ajax-more-text').html(mesNoMore); 1078 $button_load.removeClass('loading-portfolios'); 1079 1080 $button_load.closest('.wrapper-penci-portfolio').find('.penci-portfolio-filter li.active').addClass('loadmore-finish'); 1081 1082 setTimeout(function () { 1083 $button_load.parent().parent().hide(); 1084 $button_load.find('.ajax-more-text').html(mes); 1085 }, 1200); 1086 1087 return false; 1088 } 1089 1090 var $wrap_content = $button_load.closest('.wrapper-penci-portfolio').find('.penci-portfolio'), 1091 $data = $(response.data.items); 1092 1093 $wrap_content.find('.inner-portfolio-posts').append($data); 1094 $wrap_content.isotope('appended', $data).imagesLoaded(function () { 1095 $wrap_content.isotope('layout'); 1096 }); 1097 1098 /*$('.penci-lazy').Lazy({ 1099 effect: 'fadeIn', 1100 effectTime: 300, 1101 scrollDirection: 'both' 1102 });*/ 1103 //lazySizes.init(); 1104 1105 $(".container").fitVids(); 1106 1107 $('a[data-rel^="penci-gallery-image-content"]').magnificPopup({ 1108 type: 'image', 1109 closeOnContentClick: true, 1110 closeBtnInside: false, 1111 fixedContentPos: true, 1112 image: { 1113 verticalFit: true 1114 }, 1115 gallery: { 1116 enabled: true 1117 }, 1118 zoom: { 1119 enabled: false, 1120 duration: 300 1121 } 1122 }); 1123 1124 $wrap_content.addClass('loaded'); 1125
1126 $('.portfolio-item .inner-item-portfolio').each(function () { 1127 var $this = $(this); 1128 $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) { 1129 $this.addClass('animated'); 1130 }); // inview 1131 }); // each 1132 1133 $button_load.removeClass('loading-portfolios'); 1134 }); 1135 1136 $.ajax({ 1137 type: 'POST', 1138 dataType: 'html', 1139 url: ajax_var_more.url, 1140 data: 'datafilter=' + DataFilter + '&action=penci_pfl_more_post_ajax&nonce=' + ajax_var_more.nonce, 1141 success: function (data) { 1142 1143 }, 1144 error: function (jqXHR, textStatus, errorThrown) { 1145 console.log(jqXHR + " :: " + textStatus + " :: " + errorThrown); 1146 } 1147 1148 }); 1149 } 1150 } 1151 1152 /* Gallery 1153 ----------------------------------------------------------------*/ 1154 PENCI.gallery = function () { 1155 var $justified_gallery = $('.penci-post-gallery-container.justified'); 1156 var $masonry_gallery = $('.penci-post-gallery-container.masonry'); 1157 if ($().justifiedGallery && $justified_gallery.length) { 1158 $('.penci-post-gallery-container.justified').each(function () { 1159 var $this = $(this); 1160 $this.justifiedGallery({ 1161 rowHeight: $this.data('height'), 1162 lastRow: 'nojustify', 1163 margins: $this.data('margin'), 1164 randomize: false 1165 }); 1166 }); // each .penci-post-gallery-container 1167 } 1168 1169 if ($().isotope && $masonry_gallery.length) { 1170 1171 $('.penci-post-gallery-container.masonry .item-gallery-masonry').each(function () { 1172 var $this = $(this).children(); 1173 if ($this.attr('data-cap') && !$this.hasClass('added-caption')) { 1174 var $title = $this.attr('data-cap'); 1175 if ($title !== 'undefined') { 1176 $this.children().append('<div class="caption">' + $title + '</div>'); 1177 $this.addClass('added-caption'); 1178 } 1179 1180 } 1181 }); 1182 } 1183 1184 if ($masonry_gallery.length) { 1185 $masonry_gallery.each(function () { 1186 var $this = $(this); 1187 $this.imagesLoaded(function () { 1188 // initialize isotope 1189 $this.isotope({ 1190 itemSelector: '.item-gallery-masonry', 1191 transitionDuration: '.55s', 1192 layoutMode: 'masonry' 1193 }); 1194 1195 $this.addClass('loaded'); 1196 1197 $('.penci-post-gallery-container.masonry .item-gallery-masonry').each(function () { 1198 var $this = $(this); 1199 $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) { 1200 $this.children().addClass('animated'); 1201 }); // inview 1202 }); // each 1203 }); 1204 }); 1205 } 1206 }, 1207 1208 /* Jarallax 1209 ----------------------------------------------------------------*/ 1210 PENCI.Jarallax = function () { 1211 if (!$.fn.jarallax || !$('.penci-jarallax').length) { 1212 return false; 1213 } 1214 $('.penci-jarallax').each(function () { 1215 var $this = $(this), 1216 $jarallaxArgs = {}; 1217 1218 $this.imagesLoaded({background: true}, function () { 1219 jarallax($this, $jarallaxArgs); 1220 }); 1221 }); 1222 }, 1223 1224 /* Related Popup 1225 ----------------------------------------------------------------*/ 1226 PENCI.RelatedPopup = function () { 1227 if ($('.penci-rlt-popup').length) { 1228 var rltpopup = $('.penci-rlt-popup'), 1229 rltclose = $('.penci-rlt-popup .penci-close-rltpopup'), 1230 rltlazy = rltpopup.find('.penci-lazy'); 1231 1232 $('body').on('inview', '.penci-flag-rlt-popup', function (event, isInView, visiblePartX, visiblePartY) { 1233 if (!rltpopup.hasClass('rltpopup-notshow-again') && isInView) {
1234 rltpopup.addClass('rltpopup-show-up'); 1235 rltclose.on("click", function (e) { 1236 e.preventDefault(); 1237 rltpopup.removeClass('rltpopup-show-up').addClass('rltpopup-notshow-again'); 1238 }); 1239 /*rltlazy.Lazy({ 1240 effect: 'fadeIn', 1241 effectTime: 300, 1242 scrollDirection: 'both' 1243 });*/ 1244 //lazySizes.init(); 1245 } 1246 }); 1247 rltclose.on("click", function (e) { 1248 e.preventDefault(); 1249 rltpopup.removeClass('rltpopup-show-up').addClass('rltpopup-notshow-again'); 1250 }); 1251 } 1252 }, 1253 1254 PENCI.extraFunction = { 1255 init: function () { 1256 this.counterUp(); 1257 this.progressBar(); 1258 this.loginPopup(); 1259 this.recoverPassPopup(); 1260 this.registerPopup(); 1261 this.login(); 1262 this.register(); 1263 this.map(); 1264 }, 1265 progressBar: function () { 1266 if ($('.penci-review-process').length) { 1267 $('.penci-review-process').each(function () { 1268 var $this = $(this), 1269 $bar = $this.children(), 1270 $bar_w = $bar.data('width') * 10; 1271 $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) { 1272 $bar.animate({width: $bar_w + '%'}, 1000); 1273 }); // bind inview 1274 }); // each 1275 } 1276 1277 if ($.fn.easyPieChart && $('.penci-piechart').length) { 1278 $('.penci-piechart').each(function () { 1279 var $this = $(this); 1280 $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) { 1281 var chart_args = { 1282 barColor: $this.data('color'), 1283 trackColor: $this.data('trackcolor'), 1284 scaleColor: false, 1285 lineWidth: $this.data('thickness'), 1286 size: $this.data('size'), 1287 animate: 1000 1288 }; 1289 $this.easyPieChart(chart_args); 1290 }); // bind inview 1291 }); // each 1292 } 1293 }, 1294 counterUp: function () { 1295 var $counterup = $('.penci-counterup-number'); 1296 1297 if (!$.fn.counterUp || !$counterup.length) { 1298 return false; 1299 } 1300 1301 $counterup.each(function () { 1302 var $this = $(this); 1303 1304 $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) { 1305 setTimeout(function () { 1306 $({countNum: $this.text()}).animate( 1307 { 1308 countNum: $this.attr('data-count') 1309 }, 1310 1311 { 1312 duration: 2000, 1313 easing: 'linear', 1314 step: function () { 1315 $this.text(Math.floor(this.countNum)); 1316 }, 1317 complete: function () { 1318 $this.text(this.countNum); 1319 } 1320 } 1321 ); 1322 }, $this.attr('data-delay')); 1323 1324 }); // bind inview 1325 }); 1326 }, 1327 loginPopup: function () { 1328 var $body = $('body'), 1329 $loginform = $('#penci-loginpopform'), 1330 $loginContainer = $loginform.closest('.penci-popup-wrapper'); 1331 1332 if ($loginform.length) { 1333 1334 $('.penci-login-popup-btn a').magnificPopup({ 1335 type: 'inline', 1336 midClick: true, 1337 removalDelay: 600, 1338 mainClass: 'penci-popup-animation' 1339 }); 1340 1341 $body.on('click', '.penci-lostpassword-btn', function (e) { 1342 var $this = $(this), 1343 $parent = $this.closest('.penci-popup-wrapper'); 1344 1345 $parent.children('.penci-popup-passreset').slideDown('normal'); 1346 $parent.children('.penci-popup-login').slide
1346Up('normal'); 1347 e.preventDefault(); 1348 return false; 1349 }); 1350 1351 $body.on('click', '.penci-register-popup-btn', function (e) { 1352 var $this = $(this), 1353 $parent = $this.closest('.penci-popup-wrapper'); 1354 1355 $parent.children('.penci-popup-register').slideDown('normal'); 1356 $parent.children('.penci-popup-login').slideUp('normal'); 1357 e.preventDefault(); 1358 return false; 1359 }); 1360 1361 $body.on('click', '.penci-login-popup-btn', function (e) { 1362 var $this = $(this), 1363 $parent = $this.closest('.penci-popup-wrapper'); 1364 1365 $parent.children('.penci-popup-login').slideDown('normal'); 1366 $parent.children('.penci-popup-register').slideUp('normal'); 1367 $parent.children('.penci-popup-passreset').slideUp('normal'); 1368 1369 e.preventDefault(); 1370 return false; 1371 }); 1372 1373 $('#penci_user, #penci_pass').on('focus', function () { 1374 $(this).removeClass('invalid'); 1375 }); 1376 1377 $loginform.on('submit', function (e) { 1378 var $this = $(this), 1379 inputUsername = $this.find('#penci_user'), 1380 inputPass = $this.find('#penci_pass'), 1381 valUsername = inputUsername.val(), 1382 valPass = inputPass.val(), 1383 nonce = $this.find('.penci_form_nonce').val(), 1384 gcapcha = $this.find('.g-recaptcha-response'); 1385 if (gcapcha.length) { 1386 var captcha = gcapcha.val(); 1387 } else { 1388 var captcha = 'noexists'; 1389 } 1390 1391 if (inputUsername.length > 0 && valUsername == '') { 1392 inputUsername.addClass('invalid'); 1393 e.preventDefault(); 1394 } 1395 1396 if (inputPass.length > 0 && valPass == '') { 1397 inputPass.addClass('invalid'); 1398 e.preventDefault(); 1399 } 1400 1401 if (valUsername == '' || valPass == '') { 1402 return false; 1403 } 1404 1405 $loginContainer.addClass('ajax-loading'); 1406 $loginContainer.find('.message').slideDown().remove(); 1407 1408 var data = { 1409 action: 'penci_login_ajax', 1410 username: valUsername, 1411 password: valPass, 1412 captcha: captcha, 1413 security: nonce, 1414 remember: $loginContainer.find('#remembermepopup').val() 1415 }; 1416 1417 $.post(ajax_var_more.url, data, function (response) { 1418 $loginContainer.removeClass('ajax-loading'); 1419 $loginContainer.children('.penci-popup-login').append(response.data); 1420 if (!response.success) { 1421 return; 1422 } 1423 1424 window.location.href = window.location.href + "?singin=true"; 1425 }); 1426 1427 e.preventDefault(); 1428 return false; 1429 }); 1430 } 1431 }, 1432 recoverPassPopup: function () { 1433 var $body = $('body'), 1434 $recoveryform = $('#penci-passreset-popup'), 1435 $recoveryContainer = $recoveryform.closest('.penci-popup-wrapper'); 1436 1437 if ($recoveryform.length) { 1438 1439 $('.penci_user_email').on('focus', function () { 1440 $(this).removeClass('invalid'); 1441 }); 1442 1443 $recoveryform.on('submit', function (e) { 1444 e.preventDefault(); 1445 1446 var $this = $(this), 1447 inputUsername = $this.find('.penci_user_email'), 1448 valUsername = inputUsername.val(), 1449 nonce = $this.find('.penci_form_nonce').val(), 1450 gcapcha = $this.find('.g-recaptcha-response'); 1451 if (gcapcha.length) { 1452 var captcha = gcapcha.val(); 1453 } else { 1454 var captcha = 'noexists'; 1455 } 1456 1457 if (inputUsername.length > 0 && valUsername == '') { 1458 inputUsername.addClass('invalid'); 1459 1460 e.preventDefault(); 1461 return false;
1462 } 1463 1464 $recoveryContainer.addClass('ajax-loading'); 1465 $recoveryContainer.find('.message').slideDown().remove(); 1466 1467 var data = { 1468 action: 'penci_resetpass_ajax', 1469 security: nonce, 1470 username: valUsername, 1471 captcha: captcha 1472 }; 1473 1474 $.post(ajax_var_more.url, data, function (response) { 1475 $recoveryContainer.removeClass('ajax-loading'); 1476 $recoveryContainer.children('.penci-popup-passreset').append(response.data); 1477 1478 return; 1479 }); 1480 1481 event.preventDefault(); 1482 return false; 1483 }); 1484 } 1485 }, 1486 registerPopup: function () { 1487 var $body = $('body'), 1488 $registerform = $('#penci-register-popup'), 1489 $registerContainer = $registerform.closest('.penci-popup-wrapper'); 1490 1491 if ($registerform.length) { 1492 1493 var $allInput = $('.penci_user_name,.penci_user_email,.penci_user_pass,.penci_user_pass_confirm'); 1494 $allInput.on('focus', function () { 1495 $(this).removeClass('invalid'); 1496 }); 1497 1498 $registerform.on('submit', function (e) { 1499 e.preventDefault(); 1500 1501 var $this = $(this), 1502 inputUsername = $this.find('.penci_user_name'), 1503 inputEmail = $this.find('.penci_user_email'), 1504 $inputPass = $this.find('.penci_user_pass'), 1505 $inputPassConfirm = $this.find('.penci_user_pass_confirm'), 1506 valUsername = inputUsername.val(), 1507 valEmail = inputEmail.val(), 1508 valPass = $inputPass.val(), 1509 valPassConfirm = $inputPassConfirm.val(), 1510 nonce = $this.find('.penci_form_nonce').val(), 1511 gcapcha = $this.find('.g-recaptcha-response'); 1512 if (gcapcha.length) { 1513 var captcha = gcapcha.val(); 1514 } else { 1515 var captcha = 'noexists'; 1516 } 1517 1518 $allInput.removeClass('invalid'); 1519 1520 if (inputUsername.length > 0 && valUsername == '') { 1521 inputUsername.addClass('invalid'); 1522 event.preventDefault(); 1523 } 1524 1525 if (inputEmail.length > 0 && valEmail == '') { 1526 inputEmail.addClass('invalid'); 1527 event.preventDefault(); 1528 } 1529 1530 if ($inputPass.length > 0 && valPass == '') { 1531 $inputPass.addClass('invalid'); 1532 event.preventDefault(); 1533 } 1534 1535 if ($inputPassConfirm.length > 0 && valPassConfirm == '') { 1536 $inputPassConfirm.addClass('invalid'); 1537 event.preventDefault(); 1538 } 1539 if (valUsername == '' || valEmail == '' || valPass == '' || valPassConfirm == '') { 1540 return false; 1541 } 1542 1543 $registerContainer.find('.message').slideDown().remove(); 1544 1545 // Password does not match the confirm password 1546 if (valPassConfirm !== valPass) { 1547 $inputPass.addClass('invalid'); 1548 $inputPassConfirm.addClass('invalid'); 1549 $registerContainer.children('.penci-popup-register').append(ajax_var_more.errorPass); 1550 event.preventDefault(); 1551 1552 return false;
1553 } 1554 $registerContainer.addClass('ajax-loading'); 1555 1556 1557 var data = { 1558 action: 'penci_register_ajax', 1559 fistName: $this.find('.penci_first_name').val(), 1560 lastName: $this.find('.penci_last_name').val(), 1561 username: valUsername, 1562 password: valPass, 1563 confirmPass: valPassConfirm, 1564 email: valEmail, 1565 security: nonce, 1566 captcha: captcha 1567 }; 1568 1569 $.post(ajax_var_more.url, data, function (response) { 1570 $registerContainer.removeClass('ajax-loading'); 1571 $registerContainer.children('.penci-popup-register').append(response.data); 1572 if (!response.success) { 1573 return; 1574 } 1575 window.location.href = window.location.href + "?singin=true"; 1576 }); 1577 1578 event.preventDefault(); 1579 return false; 1580 }); 1581 1582 } 1583 }, 1584 login: function () { 1585 var $body = $('body'), 1586 $loginform = $('.penci-loginform'), 1587 $loginContainer = $loginform.parent('.penci-login-wrap'); 1588 1589 if ($loginform.length) { 1590 $body.on('click', '.penci-user-register', function (e) { 1591 e.preventDefault(); 1592 1593 var $this = $(this), 1594 $parent = $this.closest('.penci-login-register'); 1595 1596 $parent.find('.penci-login-wrap').addClass('hidden'); 1597 $parent.find('.penci-register-wrap').removeClass('hidden'); 1598 }); 1599 1600 $('#penci-user-login,#penci-user-pass').on('focus', function () { 1601 $(this).removeClass('invalid'); 1602 }); 1603 1604 $('.penci-loginform').each(function () { 1605 $(this).on('submit', function (e) { 1606 var $this = $(this), 1607 $loginContainer = $this.parent('.penci-login-wrap'), 1608 inputUsername = $this.find('#penci-user-login'), 1609 inputPass = $this.find('#penci-user-pass'), 1610 valUsername = inputUsername.val(), 1611 valPass = inputPass.val(), 1612 nonce = $this.find('.penci_form_nonce').val(), 1613 gcapcha = $this.find('.g-recaptcha-response'); 1614 if (gcapcha.length) { 1615 var captcha = gcapcha.val(); 1616 } else { 1617 var captcha = 'noexists'; 1618 } 1619 1620 if (inputUsername.length > 0 && valUsername == '') { 1621 inputUsername.addClass('invalid'); 1622 e.preventDefault(); 1623 } 1624 1625 if (inputPass.length > 0 && valPass == '') { 1626 inputPass.addClass('invalid'); 1627 e.preventDefault(); 1628 } 1629 1630 if (valUsername == '' || valPass == '') { 1631 return false; 1632 } 1633 1634 $loginContainer.parent().addClass('ajax-loading'); 1635 $loginContainer.find('.message').slideDown().remove(); 1636 1637 var data = { 1638 action: 'penci_login_ajax', 1639 username: valUsername, 1640 password: valPass, 1641 captcha: captcha, 1642 security: nonce, 1643 remember: $loginContainer.find('#rememberme').val() 1644 }; 1645 1646 $.post(ajax_var_more.url, data, function (response) { 1647 $loginContainer.parent().removeClass('ajax-loading'); 1648 $loginContainer.append(response.data); 1649 if (!response.success) { 1650 return; 1651 } 1652 1653 window.location.href = window.location.href + "?singin=true"; 1654 }); 1655 1656 e.preventDefault(); 1657 return false;
1658 }); 1659 }); 1660 } 1661 }, 1662 register: function () { 1663 var $body = $('body'), 1664 $registerform = $('#penci-registration-form'), 1665 $registerContainer = $registerform.closest('.penci-register-wrap'); 1666 1667 if (!$registerform.length) { 1668 return false; 1669 } 1670 1671 $body.on('click', '.penci-user-login-here', function (e) { 1672 e.preventDefault(); 1673 1674 var $this = $(this), 1675 $parent = $this.closest('.penci-login-register'); 1676 1677 $parent.find('.penci-login-wrap').removeClass('hidden'); 1678 $parent.find('.penci-register-wrap').addClass('hidden'); 1679 1680 return false; 1681 }); 1682 1683 var $allInput = $('.penci_user_name,.penci_user_email,.penci_user_pass,.penci_user_pass_confirm'); 1684 $allInput.on('focus', function () { 1685 $(this).removeClass('invalid'); 1686 }); 1687 1688 1689 $('.penci-registration-form').each(function () { 1690 $(this).on('submit', function (e) { 1691 e.preventDefault(); 1692 1693 var $this = $(this), 1694 $registerContainer = $this.closest('.penci-register-wrap'), 1695 inputUsername = $this.find('.penci_user_name'), 1696 inputEmail = $this.find('.penci_user_email'), 1697 $inputPass = $this.find('.penci_user_pass'), 1698 $inputPassConfirm = $this.find('.penci_user_pass_confirm'), 1699 valUsername = inputUsername.val(), 1700 valEmail = inputEmail.val(), 1701 valPass = $inputPass.val(), 1702 valPassConfirm = $inputPassConfirm.val(), 1703 nonce = $this.find('.penci_form_nonce').val(), 1704 gcapcha = $this.find('.g-recaptcha-response'); 1705 if (gcapcha.length) { 1706 var captcha = gcapcha.val(); 1707 } else { 1708 var captcha = 'noexists'; 1709 } 1710 1711 $allInput.removeClass('invalid'); 1712 1713 if (inputUsername.length > 0 && valUsername == '') { 1714 inputUsername.addClass('invalid'); 1715 event.preventDefault(); 1716 } 1717 1718 if (inputEmail.length > 0 && valEmail == '') { 1719 inputEmail.addClass('invalid'); 1720 event.preventDefault(); 1721 } 1722 1723 if ($inputPass.length > 0 && valPass == '') { 1724 $inputPass.addClass('invalid'); 1725 event.preventDefault(); 1726 } 1727 1728 if ($inputPassConfirm.length > 0 && valPassConfirm == '') { 1729 $inputPassConfirm.addClass('invalid'); 1730 event.preventDefault(); 1731 } 1732 if (valUsername == '' || valEmail == '' || valPass == '' || valPassConfirm == '') { 1733 return false; 1734 } 1735 1736 $registerContainer.find('.message').slideDown().remove(); 1737 1738 // Password does not match the confirm password 1739 if (valPassConfirm !== valPass) { 1740 $inputPass.addClass('invalid'); 1741 $inputPassConfirm.addClass('invalid'); 1742 $registerContainer.append(ajax_var_more.errorPass); 1743 event.preventDefault(); 1744 1745 return false; 1746 } 1747 $registerContainer.parent().addClass('ajax-loading'); 1748 1749 1750 var data = { 1751 action: 'penci_register_ajax', 1752 fistName: $this.find('.penci_first_name').val(), 1753 lastName: $this.find('.penci_last_name').val(), 1754 username: valUsername, 1755 password: valPass, 1756 confirmPass: valPassConfirm, 1757 email: valEmail, 1758 security: nonce, 1759 captcha: captcha 1760 }; 1761 1762 $.post(ajax_var_more.url, data, function (response) { 1763 $registerContainer.parent().removeClass('ajax-loading'); 1764 $registerContainer.append(response.data); 1765 if (!response.success) { 1766 return; 1767 } 1768 window.location.href = window.location.href + "?singin=true"; 1769 }); 1770 1771 event.preventDefault(); 1772 return false;
1773 }); 1774 }); 1775 }, 1776 map: function () { 1777 if (!$('.penci-google-map').length) { 1778 return false; 1779 } 1780 $('.penci-google-map').each(function () { 1781 1782 var map = $(this), 1783 Option = map.data("map_options"), 1784 mapID = map.attr('id'); 1785 1786 1787 var mapTypePre = google.maps.MapTypeId.ROADMAP; 1788 switch (Option.map_type) { 1789 case"satellite": 1790 mapTypePre = google.maps.MapTypeId.SATELLITE; 1791 break; 1792 case"hybrid": 1793 mapTypePre = google.maps.MapTypeId.HYBRID; 1794 break; 1795 case"terrain": 1796 mapTypePre = google.maps.MapTypeId.TERRAIN 1797 } 1798 var latLng = new google.maps.LatLng(-34.397, 150.644); 1799 var map = new google.maps.Map(document.getElementById(mapID), { 1800 zoom: parseInt(Option.map_zoom), 1801 center: latLng, 1802 mapTypeId: mapTypePre, 1803 panControl: Option.map_pan, 1804 zoomControl: Option.map_is_zoom, 1805 mapTypeControl: true, 1806 scaleControl: Option.map_scale, 1807 streetViewControl: Option.map_street_view, 1808 rotateControl: Option.map_rotate, 1809 overviewMapControl: Option.map_overview, 1810 scrollwheel: Option.map_scrollwheel 1811 }); 1812 var marker = new google.maps.Marker({ 1813 position: latLng, 1814 map: map, 1815 title: Option.marker_title, 1816 icon: Option.marker_img 1817 }); 1818 1819 if (Option.info_window) { 1820 var infoWindow = new google.maps.InfoWindow({ 1821 content: Option.info_window 1822 }); 1823 1824 google.maps.event.addListener(marker, "click", function () { 1825 infoWindow.open(map, marker); 1826 }); 1827 } 1828 1829 if ('coordinates' == Option.map_using && Option.latitude && Option.longtitude) { 1830 latLng = new google.maps.LatLng(Option.latitude, Option.longtitude); 1831 map.setCenter(latLng); 1832 marker.setPosition(latLng); 1833 } else { 1834 var geocoder = new google.maps.Geocoder(); 1835 geocoder.geocode({ 1836 address: Option.address 1837 }, function (results) { 1838 var loc = results[0].geometry.location; 1839 latLng = new google.maps.LatLng(loc.lat(), loc.lng()); 1840 map.setCenter(latLng); 1841 marker.setPosition(latLng); 1842 }); 1843 } 1844 }); 1845 }, 1846 }, 1847 1848 PENCI.VideosList = { 1849 // Init the module 1850 init: function () { 1851 PENCI.VideosList.play(); 1852 }, 1853 play: function () { 1854 if (!$('.penci-video_playlist').length) { 1855 return false; 1856 } 1857 $('.penci-video_playlist').each(function (idx, item) { 1858 var $blockVideo = $(this), 1859 $VideoF = $blockVideo.find('.penci-video-frame'); 1860 1861 var $height = $blockVideo.find('.penci-video-nav').height(), 1862 $heightTitle = $blockVideo.find('.penci-video-nav .penci-playlist-title').height() 1863 1864 $blockVideo.find('.penci-video-playlist-nav').css('height', $height - $heightTitle); 1865 // Init 1866 $VideoF.video(); 1867 PENCI.VideosList.updateStatus($blockVideo); 1868 1869 // Show First video and remove the loader icon 1870 $VideoF.addVideoEvent('ready', function () { 1871 $VideoF.css('visibility', 'visible').fadeIn(); 1872 $blockVideo.find('.loader-overlay').remove(); 1873 }); 1874 // Play videos 1875 $blockVideo.on('click', '.penci-video-playlist-item', function () { 1876 var $thisVideo = $(this), 1877 frameID = $thisVideo.data('name'), 1878 $thisFrame = $('#' + frameID), 1879 videoSrc = $thisVideo.data('src'), 1880 videoNum = $thisVideo.find('.penci-video-number').text(); 1881 1882 if ($thisVideo.hasClass('is-playing')) { 1883 $thisFrame.pauseVideo(); 1884 return; 1885 } 1886 1887 // Update the number of the playing video in the title section 1888 $blockVideo.find('.penci-video-playing').text(videoNum); 1889 1890 // Pause all Videos 1891 $blockVideo.find('.penci-video-frame').each(function () { 1892 $(this).pauseVideo().hide(); 1893 }) 1894 1895 // If the iframe not loaded before, add it 1896 if (!$thisFrame.length) { 1897 // Add the loader icon 1898 $blockVideo.find('.fluid-width-video-wrapper').prepend(''); 1899 1900 $blockVideo.find('.fluid-width-video-wrapper').append('<iframe class="penci-video-frame" id="' + frameID + '" src="' + videoSrc + '" frameborder="0" width="100%"" height="434" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'); 1901 $thisFrame = $('#' + frameID); 1902 1903 $thisFrame.video(); // reinit 1904 1905 $thisFrame.addVideoEvent('ready', function (e, $thisFrame, video_type) { 1906 $thisFrame.playVideo(); 1907 $blockVideo.find('.loader-overlay').remove(); 1908 }); 1909 } else { 1910 $thisFrame.playVideo(); 1911 } 1912 1913 $thisFrame.css('visibility', 'visible').fadeIn(); 1914 1915 PENCI.VideosList.updateStatus($blockVideo); 1916 1917 }); 1918 }); 1919 }, 1920 updateStatus: function ($blockVideo) { 1921 $blockVideo.find('.penci-video-frame').each(function () { 1922 var $this = $(this), 1923 $videoItem = $("[data-name='" + $this.attr('id') + "']"); 1924 1925 $this.addVideoEvent('play', function () { 1926 $videoItem.removeClass('is-paused').addClass('is-playing'); 1927 }); 1928 1929 $this.addVideoEvent('pause', function () { 1930 $videoItem.removeClass('is-playing').addClass('is-paused'); 1931 }); 1932 1933 $this.addVideoEvent('finish', function () { 1934 $videoItem.removeClass('is-paused is-playing'); 1935 }); 1936 }); 1937 } 1938 }, 1939 1940 PENCI.JumtoRecipe = function () { 1941 1942 1943 $(".penci-jump-recipe").on('click', function (e) { 1944 e.preventDefault(); 1945 var $closetMain = $(this).closest('.penci-single-block'), 1946 id = $(this).attr("href"), 1947 $firstRecipe = $closetMain.find(id).first(); 1948 if ($firstRecipe.length) { 1949 var $scroll_top = $firstRecipe.offset().top, 1950 $nav_height = 30; 1951 if ($('#navigation').length) { 1952 $nav_height = $('#navigation').height() + 30; 1953 }
1953 else if ($('.pc-wrapbuilder-header').length) { 1954 if (window.matchMedia("(max-width: 960px)").matches) { 1955 var headermobile = $('.penci_navbar_mobile'); 1956 if (!headermobile.hasClass('hide-scroll-down')) { 1957 $nav_height = headermobile.height() + 30; 1958 } 1959 } else { 1960 var headerdesktop = $('.penci_builder_sticky_header_desktop'); 1961 if (headerdesktop.length && !headerdesktop.hasClass('hide-scroll-down')) { 1962 $nav_height = headerdesktop.height() + 30; 1963 } 1964 } 1965 } 1966 if ($("body").hasClass('admin-bar')) { 1967 $nav_height = $nav_height + 32; 1968 } 1969 var $scroll_to = $scroll_top - $nav_height; 1970 $('html,body').animate({ 1971 scrollTop: $scroll_to 1972 }, 'fast'); 1973 } 1974 }); 1975 }, 1976 1977 PENCI.Single_Loadmore = function () { 1978 var $wrapper_loadmore = $('.penci-single-infiscroll'); 1979 if ($wrapper_loadmore.length) { 1980 var adsHTML = $wrapper_loadmore.data('infiads'); 1981 $(window).on('scroll', $.debounce(250, function () { 1982 var $lastArticle = $wrapper_loadmore.find('.penci-single-block').last(), 1983 $windowScroll = $(window).scrollTop(), 1984 $lastArticleTop = $lastArticle.offset().top, 1985 $dataURL = $lastArticle.data('prev-url'); 1986 1987 if ($lastArticle.hasClass('penci-single-infiblock-end')) { 1988 $('.penci-ldsingle').remove(); 1989 } 1990 1991 if (($windowScroll > $lastArticleTop) && (typeof $dataURL !== 'undefined') && (typeof $dataURL !== '') && !$lastArticle.hasClass('penci-single-infiblock-end')) { 1992 if (!$wrapper_loadmore.hasClass('penci-disable-sendajax')) { 1993 $wrapper_loadmore.addClass('penci-disable-sendajax'); 1994 $.ajax({ 1995 url: $dataURL, 1996 type: "GET", 1997 dataType: "html", 1998 success: function (result) { 1999 var resultBlock = $($(result).find('.penci-single-wrapper').html()).css('opacity', 0).animate({'opacity': 1}, 300); 2000 if ((typeof adsHTML !== 'undefined') && (typeof adsHTML !== '')) { 2001 $wrapper_loadmore.append(adsHTML); 2002 } 2003 $wrapper_loadmore.append(resultBlock); 2004 if (resultBlock.find('.penci_facebook_widget').length == 1) { 2005 FB.XFBML.parse(); 2006 } 2007 $wrapper_loadmore.removeClass('penci-disable-sendajax'); 2008 2009 // Lazyload 2010 /*$('.penci-lazy').Lazy({ 2011 effect: 'fadeIn', 2012 effectTime: 300, 2013 scrollDirection: 'both', 2014 });*/ 2015 //lazySizes.init(); 2016 2017 PENCI.featured_slider(); 2018 PENCI.owl_slider(); 2019 PENCI.fitvids(); 2020 PENCI.sticky_sidebar(); 2021 PENCI.lightbox(); 2022 PENCI.masonry(); 2023 PENCI.portfolio(); 2024 PENCI.gallery(); 2025 PENCI.Jarallax(); 2026 PENCI.extraFunction.init();
2027 PENCI.VideosList.init(); 2028 PENCI.JumtoRecipe(); 2029 var owlcarousel = $('.penci-owl-carousel-slider, .featured-area .penci-owl-featured-area'); 2030 if (owlcarousel.length) { 2031 owlcarousel.on('mouseleave', function (e) { 2032 var $this = $(this), 2033 dataAuto = $this.data('auto'), 2034 sliderSpeed = $this.data('speed'); 2035 if (dataAuto === true) { 2036 $this.trigger('stop.owl.autoplay'); 2037 $this.trigger('play.owl.autoplay', sliderSpeed); 2038 } 2039 }); 2040 } 2041 2042 var $review_process = $('.penci-review-process'), 2043 $review_piechart = $('.penci-piechart'); 2044 if ($review_process.length) { 2045 $('.penci-review-process').each(function () { 2046 var $this = $(this), 2047 $bar = $this.children(), 2048 $bar_w = $bar.data('width') * 10; 2049 $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) { 2050 $bar.animate({width: $bar_w + '%'}, 1000); 2051 }); // bind inview 2052 }); // each 2053 } 2054 2055 if ($review_piechart.length) { 2056 $('.penci-piechart').each(function () { 2057 var $this = $(this); 2058 $this.one('inview', function (event, isInView, visiblePartX, visiblePartY) { 2059 var chart_args = { 2060 barColor: $this.data('color'), 2061 trackColor: $this.data('trackcolor'), 2062 scaleColor: false, 2063 lineWidth: $this.data('thickness'), 2064 size: $this.data('size'), 2065 animate: 1000 2066 }; 2067 $this.easyPieChart(chart_args); 2068 }); // bind inview 2069 }); // each 2070 } 2071 } 2072 }); 2073 } 2074 } 2075 })); 2076 2077 $(window).bind('scroll touchstart', function () { 2078 // UPdate permalink 2079 var scrollTop = $(this).scrollTop(); 2080 var firstPost = $('.penci-single-block'); 2081 window.setTimeout(function () { 2082 var preScrollTop = scrollTop + 60; 2083 var postsContainer = $('.penci-single-block'); 2084 var locationHref = window.location.href; 2085 2086 var currentP = postsContainer.map(function () { 2087 if ($(this).offset().top < preScrollTop) 2088 return this; 2089 }); 2090 2091 currentP = currentP[currentP.length - 1]; 2092 var pid = $(currentP).data('postid'), 2093 plink = $(currentP).data('current-url'), 2094 ptitle = $(currentP).data('post-title'), 2095 pedit = $(currentP).data('edit-post'); 2096 2097 if (typeof pid === 'undefined' || typeof pid === '') { 2098 pid = firstPost.data('postid'); 2099 plink = firstPost.data('current-url'); 2100 ptitle = firstPost.data('post-title'); 2101 pedit = firstPost.data('edit-post'); 2102 } 2103 2104 if (locationHref !== plink) { 2105 window.history.pushState({"pageTitle": ptitle}, '', plink); 2106 if ($('#wpadminbar').length) { 2107 $('#wp-admin-bar-edit a').attr('href', pedit); 2108 } 2109 if ($('title').length) { 2110 $('title').each(function () { 2111 $(this).text(ptitle); 2112 }); 2113 } 2114 2115 if (typeof _gaq !== 'undefined' && _gaq !== null) {
2116 _gaq.push(['_trackPageview', plink]); 2117 } 2118 2119 if (typeof ga !== 'undefined' && ga !== null) { 2120 ga('send', 'pageview', plink); 2121 } 2122 } 2123 2124 }, 100); 2125 }); 2126 } 2127 }; 2128 2129 2130 /* Init functions 2131 ---------------------------------------------------------------*/ 2132 $(document).ready(function () { 2133 PENCI.general(); 2134 PENCI.cookie(); 2135 PENCI.main_sticky(); 2136 PENCI.featured_slider(); 2137 PENCI.owl_slider(); 2138 PENCI.fitvids(); 2139 PENCI.sticky_sidebar(); 2140 PENCI.mega_menu(); 2141 PENCI.mobile_menu(); 2142 PENCI.toggleMenuHumburger(); 2143 PENCI.lightbox(); 2144 PENCI.masonry(); 2145 PENCI.video_background(); 2146 PENCI.portfolio(); 2147 PENCI.gallery(); 2148 PENCI.Jarallax(); 2149 PENCI.RelatedPopup(); 2150 PENCI.extraFunction.init(); 2151 PENCI.VideosList.init(); 2152 PENCI.JumtoRecipe(); 2153 PENCI.Single_Loadmore(); 2154 PENCI.shareexpand(); 2155 $(window).on('resize', function () { 2156 PENCI.sticky_sidebar(); 2157 }); 2158 $(document).on('penci-mega-loaded', function () { 2159 PENCI.general(); 2160 PENCI.featured_slider(); 2161 PENCI.owl_slider(); 2162 PENCI.fitvids(); 2163 PENCI.lightbox(); 2164 PENCI.masonry(); 2165 PENCI.portfolio(); 2166 PENCI.gallery(); 2167 PENCI.extraFunction.init(); 2168 PENCI.VideosList.init(); 2169 }); 2170 }); 2171})(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.