PageSourceSearch

https://insurgenciamagisterial.com/wp-content/themes/soledad/js/main.js?ver=8.6.2

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