PageSourceSearch

https://appearasia.com/wp-content/themes/soledad/js/main.js?ver=8.2.9

js appearasia.com collected 2026-10-10 01:57:52 UTC 95,646 bytes, 2,312 lines download raw bytes

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