PageSourceSearch

https://www.bakingo.com/blog/wp-content/themes/soledad/soledad/js/main.js?ver=8.6.7

js bakingo.com collected 2026-09-24 10:39:20 UTC 134,679 bytes, 4,001 lines download raw bytes

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