PageSourceSearch

https://www.lacsop.org/wp-content/plugins/gutentor/assets/js/gutentor.js?ver=3.2.5

js lacsop.org collected 2026-09-25 07:07:35 UTC 71,027 bytes, 1,784 lines download raw bytes

1(function($) {
2    let gDocument = $(document),
3        gProgressBarE = $('.gutentor-element-progressbar'),
4        counter_element = $('.gutentor-element-counter'),
5        gWindow = $(window),
6        gBody = $('body'),
7        gWindowWidth = gWindow.width(),
8        gM11Init = false,
9        gFlexInit = false;
10
11    /*Gutentor gBooleanVal*/
12    function gBooleanVal(val) {
13        if (typeof val === 'boolean') {
14            return val;
15        }
16        return (val === 'true');
17    }
18
19    function gSlick(gThis) {
20        let gss = {}; /*Slick Setting*/
21        if (gThis[0].hasAttribute('data-dots')) {
22            gss.dots = gBooleanVal(gThis.data('dots'));
23        }
24        if (gThis[0].hasAttribute('data-arrows')) {
25            gss.arrows = gBooleanVal(gThis.data('arrows'));
26        }
27        if (gThis[0].hasAttribute('data-infinite')) {
28            gss.infinite = gBooleanVal(gThis.data('infinite'));
29        }
30        if (gThis[0].hasAttribute('data-speed')) {
31            gss.speed = parseInt(gThis.data('speed'));
32        }
33        if (gThis[0].hasAttribute('data-slideitemdesktop')) {
34            gss.slidesToShow = parseInt(gThis.data('slideitemdesktop'));
35        }
36        if (gThis[0].hasAttribute('data-slidescroll-desktop')) {
37            gss.slidesToScroll = parseInt(gThis.data('slidescroll-desktop'));
38        }
39        if (gThis[0].hasAttribute('data-nextarrow')) {
40            gss.nextArrow = '<span class="slick-next"><i class="' + gThis.data('nextarrow') + '"></i></span>';
41        } else {
42            gss.nextArrow = '<span class="slick-next"><i class="fas fa-angle-right"></i></span>';
43        }
44        if (gThis[0].hasAttribute('data-prevarrow')) {
45            gss.prevArrow = '<span class="slick-prev"><i class="' + gThis.data('prevarrow') + '"></i></span>';
46        } else {
47            gss.prevArrow = '<span class="slick-prev"><i class="fas fa-angle-left"></i></span>';
48        }
49        if (gThis[0].hasAttribute('data-autoplay')) {
50            gss.autoplay = gBooleanVal(gThis.data('autoplay'));
51            if (gThis[0].hasAttribute('data-autoplayspeed')) {
52                gss.autoplaySpeed = parseInt(gThis.data('autoplayspeed'));
53            }
54            if (gThis[0].hasAttribute('data-pauseonfocus')) {
55                gss.pauseOnFocus = gBooleanVal(gThis.data('pauseonfocus'));
56            }
57            if (gThis[0].hasAttribute('data-pauseonhover')) {
58                gss.pauseOnHover = gBooleanVal(gThis.data('pauseonhover'));
59            }
60        }
61        if (gThis[0].hasAttribute('data-draggable')) {
62            gss.draggable = gBooleanVal(gThis.data('draggable'));
63        }
64        if (gThis[0].hasAttribute('data-fade')) {
65            gss.fade = gBooleanVal(gThis.data('fade'));
66        }
67        if (gThis[0].hasAttribute('data-blockimagesliderfade')) {
68            gss.fade = gBooleanVal(gThis.data('blockimagesliderfade'));
69        }
70        if (gThis[0].hasAttribute('data-cmondesktop')) {
71            gss.centerMode = gBooleanVal(gThis.data('cmondesktop'));
72            if(gBooleanVal(gThis.data('cmondesktop'))){
73                if (gThis[0].hasAttribute('data-cmpaddingdesktop')) {
74                    gss.centerPadding = gThis.data('cmpaddingdesktop');
75                }
76            }
77        }
78
79        /*Responsive Setting*/
80        let rTgss = {},
81            rMgss = {};
82        if (gThis[0].hasAttribute('data-slideitemtablet')) {
83            rTgss.slidesToShow = parseInt(gThis.data('slideitemtablet'));
84        }
85        if (gThis[0].hasAttribute('data-slidescroll-tablet')) {
86            rTgss.slidesToScroll = parseInt(gThis.data('slidescroll-tablet'));
87        }
88        if (gThis[0].hasAttribute('data-dotstablet')) {
89            rTgss.dots = gBooleanVal(gThis.data('dotstablet'));
90        }
91        if (gThis[0].hasAttribute('data-arrowstablet')) {
92            rTgss.arrows = gBooleanVal(gThis.data('arrowstablet'));
93        }
94        if (gThis[0].hasAttribute('data-cmontablet')) {
95            rTgss.centerMode = gBooleanVal(gThis.data('cmontablet'));
96            if(gBooleanVal(gThis.data('cmontablet'))){
97                if (gThis[0].hasAttribute('data-cmpaddingtablet')) {
98                    rTgss.centerPadding = gThis.data('cmpaddingtablet');
99                }
100            }
101        }
102
103        /*Responsive mobile*/
104        if (gThis[0].hasAttribute('data-slideitemmobile')) {
105            rMgss.slidesToShow = parseInt(gThis.data('slideitemmobile'));
106        }
107        if (gThis[0].hasAttribute('data-slidescroll-mobile')) {
108            rMgss.slidesToScroll = parseInt(gThis.data('slidescroll-mobile'));
109        }
110        if (gThis[0].hasAttribute('data-dotsmobile')) {
111            rMgss.dots = gBooleanVal(gThis.data('dotsmobile'));
112        }
113        if (gThis[0].hasAttribute('data-arrowsmobile')) {
114            rMgss.arrows = gBooleanVal(gThis.data('arrowsmobile'));
115        }
116        if (gThis[0].hasAttribute('data-cmonmobile')) {
117            rMgss.centerMode = gBooleanVal(gThis.data('cmonmobile'));
118            if(gBooleanVal(gThis.data('cmonmobile'))){
119                if (gThis[0].hasAttribute('data-cmpaddingmobile')) {
120                    rMgss.centerPadding = gThis.data('cmpaddingmobile');
121                }
122            }
123        }
124        let rTSettings = {
125                breakpoint: 1024,
126                settings: rTgss
127            },
128            rMSettings = {
129                breakpoint: 480,
130                settings: rMgss
131            };
132
133        gss.responsive = [];
134        gss.responsive.push(rTSettings);
135        gss.responsive.push(rMSettings);
136
137        /*Arrow Position*/
138        if (gThis[0].hasAttribute('data-arrowspositiondesktop') && 'gutentor-slick-a-default-desktop' !== gThis.data('arrowspositiondesktop')) {
139            gss.appendArrows = gThis.siblings('.gutentor-slick-arrows');
140        }
141        /*RTL*/
142        if (gBody.hasClass('rtl')) {
143            gss.rtl = true;
144        }
145        /*Finally call Slick*/
146        if(gThis.hasClass('slick-initialized')) {
147            gThis.slick('refresh')
148        }
149        else{
150            gThis.slick(gss);
151        }
152    }
153
154    /*Magnific Popup
155    * gThis
156    * isI => is image
157    * isG => is gallery
158    * */
159    function gMagnificPopup(gThis, isI = false, isG = false) {
160        let gma = {};
161        if (isI) {
162            gma = {
163                type: 'image',
164                closeBtnInside: false,
165                fixedContentPos: false
166            };
167        } else {
168            gma = {
169                type: 'iframe',
170                mainClass: 'mfp-fade',
171                removalDelay: 160,
172                preloader: false,
173                fixedContentPos: false,
174            };
175        }
176        if (isG) {
177            gma.gallery = {
178                enabled: true,
179                navigateByImgClick: true,
180                preload: [0, 1] // Will preload 0 - before current, and 1 after the current image
181            };
182            gma.callbacks = {
183                elementParse: function(item) {
184
185                    if (item.el[0].getAttribute("data-media-type") === 'g-popup-video') {
186                        item.type = 'iframe';
187                    } else {
188                        item.type = 'image';
189                    }
190
191                }
192            }
193        }
194        gThis.magnificPopup(gma);
195
196    }
197
198    /*easyPieChart*/
199    function gEasyPieChart(gThis) {
200        let gea = {
201            barColor: gThis.data('barcolor'),
202            trackColor: gThis.data('trackcolor'),
203            scaleColor: gThis.data('scalecolor'),
204            size: gThis.data('size'),
205            lineCap: gThis.data('linecap'),
206            animate: gThis.data('animate'),
207            lineWidth: gThis.data('linewidth'),
208        };
209        gThis.easyPieChart(gea);
210    }
211
212    /*CountUP*/
213    function gCountUp(gThis) {
214        let startValue = parseInt(gThis.data('start')),
215            endValue = parseInt(gThis.data('end')),
216            duration = parseInt(gThis.data('duration')),
217            nCountUp = new CountUp(gThis[0], startValue, endValue, 0, duration);
218
219        nCountUp.start();
220    }
221    function gIsEleInView(elem) {
222        let docViewTop = $(window).scrollTop(),
223            docViewBottom = docViewTop + $(window).height(),
224            elemTop = $(elem).offset().top,
225            elemBottom = elemTop + $(elem).height();
226
227        return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
228    }
229
230    function gTriggerCountUp(gThis){
231        if( gIsEleInView(gThis) ){
232            if( !gThis.hasClass('g-c-loaded')){
233                gThis.addClass('g-c-loaded')
234                gCountUp(gThis)
235            }
236        }
237    }
238
239    function gTriggerPieChart(gThis){
240        if( gIsEleInView(gThis) ){
241            if( !gThis.hasClass('g-c-loaded')){
242                gThis.addClass('g-c-loaded')
243                gEasyPieChart(gThis)
244            }
245        }
246    }
247
248    function gAddLoaded(gThis){
249        if( gIsEleInView(gThis) ){
250            if( !gThis.hasClass('g-c-loaded')){
251                gThis.addClass('g-c-loaded')
252                gThis.css('width', gThis.attr("data-width") + "%");
253            }
254        }
255    }
256
257    function gCountAndBar($wrap = null){
258        if( $wrap ){
259            /*CountUP Trigger*/
260            $wrap.find('.gutentor-single-item-number,.gutentor-counter-number-main').each(function() {
261                gTriggerCountUp($(this))
262            });
263
264            /*easyPieChart Trigger*/
265            $wrap.find('.gutentor-progressbar-circular,.gutentor-element-progressbar-circular').each(function() {
266                gTriggerPieChart($(this))
267            });
268
269            /*easyPieChart Trigger*/
270            $wrap.find('.gutentor-porgress-bar-item .progressbar,.gutentor-element-progressbar-box .gutentor-element-progressbar-horizontal').each(function() {
271                gAddLoaded($(this))
272            });
273        }
274        else{
275            /*CountUP Trigger*/
276            $('.gutentor-single-item-number,.gutentor-counter-number-main').each(function() {
277                gTriggerCountUp($(this))
278            });
279
280            /*easyPieChart Trigger*/
281            $('.gutentor-progressbar-circular,.gutentor-element-progressbar-circular').each(function() {
282                gTriggerPieChart($(this))
283            });
284
285            /*easyPieChart Trigger*/
286            $('.gutentor-porgress-bar-item .progressbar,.gutentor-element-progressbar-box .gutentor-element-progressbar-horizontal').each(function() {
287                gAddLoaded($(this))
288            });
289        }
290
291    }
292    gCountAndBar()
293    $(window).scroll( function(){
294        gCountAndBar()
295    });
296    /*Count Down*/
297    function gCountDown(gThis) {
298
299        // Set the date we're counting down to
300        let gutentor_event_date = gThis.data('eventdate');
301        if (gutentor_event_date === undefined || gutentor_event_date === null) {
302            gThis.html("<span>Please set validate Date and time for countdown </span>");
303            return false;
304        }
305        let expired_text = gThis.data('expiredtext'),
306            gutentor_day = gThis.find('.day'),
307            gutentor_hour = gThis.find('.hour'),
308            gutentor_min = gThis.find('.min'),
309            gutentor_sec = gThis.find('.sec'),
310            gutentor_date_time = gutentor_event_date.split('T');
311        if (gutentor_date_time.length !== 2) {
312            return false;
313        }
314        let date_collection = gutentor_date_time[0],
315            time_collection = gutentor_date_time[1],
316            date_explode = date_collection.split('-');
317
318        if (date_explode.length !== 3) {
319            return false;
320        }
321
322        let time_explode = time_collection.split(':');
323        if (time_explode.length !== 3) {
324            return false;
325        }
326
327        let gutentor_year_value = parseInt(date_explode[0]),
328            gutentor_month_value = parseInt(date_explode[1]) - 1,
329            gutentor_day_value = parseInt(date_explode[2]),
330            gutentor_hour_value = parseInt(time_explode[0]),
331            gutentor_minutes_value = parseInt(time_explode[1]),
332            gutentor_second_value = parseInt(time_explode[2]),
333            countDownDate = new Date(gutentor_year_value, gutentor_month_value, gutentor_day_value, gutentor_hour_value, gutentor_minutes_value, gutentor_second_value, 0).getTime();
334
335        // Update the count down every 1 second
336        let x = setInterval(function() {
337
338            // Get todays date and time
339            let now = new Date().getTime();
340
341            // Find the distance between now an the count down date
342            let distance = countDownDate - now;
343
344            // Time calculations for days, hours, minutes and seconds
345            let days = Math.floor(distance / (1000 * 60 * 60 * 24));
346            let hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
347            let minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
348            let seconds = Math.floor((distance % (1000 * 60)) / 1000);
349
350            // Display the result in the element
351            gutentor_day.html(days);
352            gutentor_hour.html(hours);
353            gutentor_min.html(minutes);
354            gutentor_sec.html(seconds);
355            // If the count down is finished, write some text
356            if (distance < 0) {
357                clearInterval(x);
358                gThis.html("<span>" + expired_text + "</span>");
359            }
360        }, 1000);
361    }
362
363    /*Tabs*/
364    function gTabs() {
365        gDocument.on('click', '.gutentor-tabs-list', function() {
366            let thisTabInside = $(this),
367                gutentorSingleItemIndex = thisTabInside.data('index'),
368                gTabsC = thisTabInside.closest('.gutentor-tabs'),
369                gTabsContentWrap = gTabsC.next('.gutentor-tabs-content-wrap'),
370                gTabsSingleContent = gTabsContentWrap.find('.' + gutentorSingleItemIndex);
371
372            gTabsSingleContent.siblings().removeClass('gutentor-tab-content-active');
373            thisTabInside.siblings().removeClass('gutentor-tab-active');
374
375            gTabsSingleContent.addClass('gutentor-tab-content-active');
376            thisTabInside.addClass('gutentor-tab-active');
377        });
378    }
379
380    /*show more block*/
381    function gShowMoreBlock(className) {
382        gDocument.on('click', className, function(e) {
383            e.preventDefault();
384            if (className === '.gutentor-show-more-button') {
385                $(this).closest('.gutentor-single-item-content').addClass('show-more-content');
386            }
387            else if(className === '.gutentor-show-less-action-button') {
388                $(this).closest('.gutentor-single-item-content').removeClass('show-more-content');
389            }
390            else if(className === '.gutentor-adv-s-m-btn'){
391                $(this).closest('.g-m-advance-show-more').addClass('g-show-more-content');
392            }
393            else if(className === '.gutentor-adv-s-l-btn'){
394                $(this).closest('.g-m-advance-show-more').removeClass('g-show-more-content');
395            }
396        });
397    }
398
399    /*API*/
400    function gP4GetLoader(type) {
401        let gP4Loader;
402        switch (type) {
403            case 'gp4-animation-1':
404                gP4Loader = '<div class="gutentor-loading-wrap"></div>';
405                break;
406            case 'gp4-animation-2':
407                gP4Loader = '<div class="gutentor-loading-wrap"><div class="gutentor-loading-2"><div></div><div></div><div></div></div></div>';
408                break;
409            case 'gp4-animation-3':
410                gP4Loader = '<div class="gutentor-loading-wrap"><div class="gutentor-loading-3"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div></div>';
411                break;
412            case 'gp4-animation-4':
413                gP4Loader = '<div class="gutentor-loading-wrap"></div>';
414                break;
415            case 'gp4-animation-5':
416                gP4Loader = '<div class="gutentor-loading-wrap"><div class="gutentor-loading-5"></div></div>';
417                break;
418            default:
419                gP4Loader = '';
420                break;
421        }
422        return gP4Loader;
423    }
424
425    function gApi(gAB, gParam, gAppend = false) {
426        gParam.innerBlockType = gAB.data('i-b');
427        gParam.blockId = gAB.find('.gutentor-post-module').data('gbid');
428        gParam.postId = gAB.data('gpid');
429
430        /*Globally Add Tax and Term Data*/
431        if (gAB.find('.gutentor-filter-navigation').length) {
432            gParam.gTax = gAB.find('.gutentor-filter-navigation').data('gtax');
433            gParam.gTerm = gAB.find('.gutentor-filter-item-active').children().attr('data-gterm');
434            if( 'gAll' === gParam.gTerm ){
435                gParam.allOpt = gAB.find('.gutentor-filter-item-active').children().attr('data-all-opt');
436            }
437        } else {
438            gParam.gTax = 'default';
439            gParam.gTerm = 'default';
440        }
441        if (!gParam.paged) {
442            gParam.paged = 1;
443        }
444        /*Search Field*/
445        if (gAB.find('.g-fm-search').length){
446            gParam.s = gAB.find('.g-fm-search').val();
447        }
448
449        $.ajax({
450            type: 'GET',
451            url: gutentorLS.restUrl + 'gutentor-self-api/v1/gadvancedb',
452            data: gParam,
453            beforeSend: function(xhr) {
454                gAB.addClass(gAB.data('l-ani'));
455                xhr.setRequestHeader('X-WP-Nonce', gutentorLS.restNonce);
456                gAB.removeClass('gutentor-loaded');
457                gAB.find('.gutentor-post-module .grid-container').append(gP4GetLoader(gAB.data('l-ani')));
458            },
459        }).done(function(data) {
460            if (!gAppend) {
461                gAB.find('.gutentor-post-module').replaceWith(data.pBlog);
462            } else {
463                gAB.find('.gutentor-post-module .grid-container .grid-row').append($(data.pBlog).find('.grid-container .grid-row').html());
464
465            }
466
467            gAB.find('.gutentor-pagination')
468                .children() //Select all the children of the parent
469                .not(':first-child') //Unselect the first child
470                .not(':last-child') //Unselect the last child
471                .remove();
472
473            let paged = parseInt(gParam.paged),
474                max_num_pages = parseInt(data.max_num_pages);
475
476            gAB.find('.gutentor-pagination').children('.gutentor-pagination-prev')
477                .after(data.pagination)
478                .children().attr('data-gpage', paged > 1 ? paged - 1 : 1);
479            gAB.attr('data-maxnumpages', max_num_pages);
480            gAB.find('.gutentor-pagination').children('.gutentor-pagination-next')
481                .children().attr('data-gpage', max_num_pages > paged ? paged + 1 : max_num_pages);
482
483            /*disabled class*/
484            if (paged <= 1) {
485                gAB.find('.gutentor-pagination').children('.gutentor-pagination-prev').children().addClass('gutentor-disabled');
486                gAB.find('.gutentor-navigation').find('.g-nav-prev').addClass('gutentor-disabled');
487            } else {
488                gAB.find('.gutentor-pagination').children('.gutentor-pagination-prev').children().removeClass('gutentor-disabled');
489                gAB.find('.gutentor-navigation').find('.g-nav-prev').removeClass('gutentor-disabled');
490            }
491            if (max_num_pages <= paged) {
492                gAB.find('.gutentor-pagination').children('.gutentor-pagination-next').children().addClass('gutentor-disabled');
493                gAB.find('.gutentor-navigation').find('.g-nav-next').addClass('gutentor-disabled');
494
495                /*for load more disabled class*/
496                gAB.find('.gutentor-post-footer.g-ap-load-more-template a.gutentor-button').addClass('gutentor-disabled');
497
498            } else {
499                gAB.find('.gutentor-pagination').children('.gutentor-pagination-next').children().removeClass('gutentor-disabled');
500                gAB.find('.gutentor-navigation').find('.g-nav-next').removeClass('gutentor-disabled');
501
502                /*for load more disabled class*/
503                gAB.find('.gutentor-post-footer.g-ap-load-more-template a.gutentor-button').removeClass('gutentor-disabled');
504            }
505            gAB.find('.gutentor-post-module').each(function() {
506                gReloadMasonry($(this));
507            });
508        }).fail(function(jqXHR, textStatus, errorThrown) {
509            console.log(jqXHR + " :: " + textStatus + " :: " + errorThrown);
510        }).always(function() {
511            $('.g-edd-cart .edd-no-js').hide();
512            $('.g-edd-cart .edd-add-to-cart').addClass('edd-has-js');
513            gAB.removeClass(gAB.data('l-ani'));
514            gAB.addClass('gutentor-loaded');
515            gAB.find('.gutentor-post-module .grid-container').find('.gutentor-loading-wrap').remove();
516
517        });
518    }
519    /*Filter Cats*/
520    gDocument.on('click', '.gutentor-filter-navigation .gutentor-filter-item>a', function(e) {
521        e.preventDefault();
522
523        let gThis = $(this),
524            gList = gThis.closest('.gutentor-filter-list'),
525            gAB = gThis.closest('.gutentor-advanced-post-module');
526
527        if (gThis.parent().hasClass('gutentor-filter-item-active')) {
528            return false;
529        }
530        gList.find('.gutentor-filter-item').removeClass('gutentor-filter-item-active');
531        gThis.parent().addClass('gutentor-filter-item-active');
532
533        /*for load more reset pagination */
534        gAB.find('.gutentor-post-footer.g-ap-load-more-template a.gutentor-button').removeAttr('data-gpage');
535
536        /*Search reset*/
537        if (gAB.find('.g-fm-search').length){
538            gAB.find('.g-fm-search').val('');
539        }
540
541        gApi(
542            gAB, {}
543        )
544    });
545    /*Numeric Pagination*/
546    gDocument.on('click', '.gutentor-pagination a', function(e) {
547        e.preventDefault();
548
549        let gThis = $(this),
550            gAB = gThis.closest('.gutentor-advanced-post-module');
551
552        if (gThis.hasClass('gutentor-disabled')) {
553            return false;
554        }
555        if (gThis.parent().hasClass('gutentor-pagination-active')) {
556            return false;
557        }
558        let currentPage = gThis.parent().siblings('.gutentor-pagination-active').children().attr('data-gpage');
559
560        if (currentPage == gThis.attr('data-gpage')) {
561            return false;
562        }
563        let gParam = {
564            paged: gThis.attr('data-gpage'),
565        };
566        if (parseInt(gAB.attr('data-maxnumpages')) < parseInt(gParam.paged)) {
567            return false;
568        }
569        gApi(
570            gAB,
571            gParam
572        )
573    });
574    /*Navigation*/
575    gDocument.on('click', '.gutentor-navigation a', function(e) {
576        e.preventDefault();
577
578        let gThis = $(this),
579            gNav = gThis.closest('.gutentor-navigation'),
580            gAB = gThis.closest('.gutentor-advanced-post-module');
581
582        if (gThis.hasClass('gutentor-disabled')) {
583            return false;
584        }
585        let current_page = parseInt(gNav.attr('data-gpage')),
586            nextPage;
587        if (gThis.hasClass('g-nav-prev')) {
588            nextPage = current_page - 1;
589        } else {
590            nextPage = current_page + 1;
591        }
592        let gParam = {
593            paged: nextPage
594        };
595
596        gNav.attr('data-gpage', nextPage);
597        gApi(
598            gAB,
599            gParam
600        )
601    });
602    /*Load More*/
603    gDocument.on('click', '.gutentor-post-footer.g-ap-load-more-template a.gutentor-button', function(e) {
604        e.preventDefault();
605
606        let gThis = $(this),
607            gAB = gThis.closest('.gutentor-advanced-post-module');
608
609        if (gThis.hasClass('gutentor-disabled')) {
610            return false;
611        }
612
613        if (!gThis.attr('data-gpage')) {
614            gThis.attr('data-gpage', 2);
615        }
616        let gParam = {
617            paged: gThis.attr('data-gpage')
618        };
619        gThis.attr('data-gpage', parseInt(gThis.attr('data-gpage')) + 1)
620        gApi(
621            gAB,
622            gParam,
623            true
624        )
625    });
626    /*Search Icon*/
627    gDocument.on('click', '.g-search-icon', function(e) {
628        e.preventDefault();
629
630        let gThis = $(this),
631            gAB = gThis.closest('.gutentor-advanced-post-module');
632
633        /*commented on request of a user*/
634        /*https://wordpress.org/support/topic/post-module-header-search-keywords/#post-15077989*/
635        /* if( !gAB.find('.g-fm-search').val()){
636            return false;
637        }*/
638        gApi(
639            gAB, {}
640        )
641    });
642
643    /*Search Enter*/
644    $( document ).on(
645        'keydown',
646        '.gutentor-advanced-post-module .g-fm-search',
647        function(e){
648            let key   = e.which;
649            if (key === 13) {
650                e.preventDefault();
651
652                let gThis = $(this),
653                    gAB = gThis.closest('.gutentor-advanced-post-module');
654                /*commented on request of a user*/
655                /*https://wordpress.org/support/topic/post-module-header-search-keywords/#post-15077989*/
656                /*  if( !gAB.find('.g-fm-search').val()){
657                    return false;
658                }*/
659
660                gApi(
661                    gAB, {}
662                )
663            }
664        }
665    );
666
667    /*Advanced popup*/
668    function gAdvPopupOpen(gma,gThis){
669        if( gThis.attr('devices')){
670            let devices  = JSON.parse(gThis.attr('devices'));
671            if( Array.isArray(devices)){
672                if( devices.includes('desktop') && window.screen.width > 991){
673                    $.magnificPopup.open(gma);
674                }
675                else if( devices.includes('mobile') && window.screen.width < 768){
676                    $.magnificPopup.open(gma);
677                }
678                else if( devices.includes('tablet') && window.screen.width >= 767 && window.screen.width <= 991){
679                    $.magnificPopup.open(gma);
680                }
681            }
682
683        }
684        else{
685            $.magnificPopup.open(gma);
686        }
687    }
688
689    let gIdleTime;
690    function gSetIdleTime(gma,gThis) {
691        window.onload = resetTimer;
692        window.onmousemove = resetTimer;
693        window.onmousedown = resetTimer;  // catches touchscreen presses as well
694        window.ontouchstart = resetTimer; // catches touchscreen swipes as well
695        window.ontouchmove = resetTimer;  // required by some devices
696        window.onclick = resetTimer;      // catches touchpad clicks as well
697        window.onkeydown = resetTimer;
698        window.addEventListener('scroll', resetTimer, true); // improved; see comments
699
700        function resetTimer() {
701            clearTimeout(gIdleTime);
702            if( gThis.attr('timing')){
703                gIdleTime = setTimeout(function() {
704                    if( !gThis.attr('g-adv-popup-open')){
705                        gAdvPopupOpen(gma,gThis);
706                        gThis.attr('g-adv-popup-open',true)
707                    }
708                }, parseFloat(gThis.attr('timing'))*1000);
709            }
710        }
711    }
712
713    function gInitAdvPopup(){
714
715        function gIsTrue(val){
716            if(val && val == '1'){
717                return true;
718            }
719            return false;
720        }
721
722        let gma = {},
723            gIndex = {},
724            gCss = {},
725            sideCss = '';
726        $('.g-adv-popup').each(function(i) {
727            let gThis = $(this),
728                gMainClass = 'g-adv-popup-mfp ';
729            gIndex[i] = {};
730            gma[i] = {};
731            gCss[i] = '.gadvpopupwow{visibility:hidden;}';
732            if( gThis.attr('closeBtnCol') ){
733                gCss[i] += '.'+gThis.attr('id')+'-mfp'+' .mfp-close{color:'+gThis.attr('closeBtnCol')+';}';
734            }
735            if( gThis.attr('bgCol') || gThis.attr('bgGradient')){
736                let bgType = gThis.attr('bgType') ? gThis.attr('bgType') 
736: '',
737                    bgcolor = bgType === 'solid' && gThis.attr('bgCol') ? gThis.attr('bgCol') : '',
738                    bgGradient = bgType === 'gradient' && gThis.attr('bgGradient') ? gThis.attr('bgGradient') : '',
739                    bgGradient2 = bgType === 'solid' && bgcolor ? 'none' : '',
740                    bgcolor2 = bgType === 'gradient' && gThis.attr('bgGradient') ? 'transparent' : '';
741                gCss[i] +=  '.gutentor-active .mfp-bg{'+GutentorGenerateCSS('background-color',bgcolor)+GutentorGenerateCSS('background-image',bgGradient2)+GutentorGenerateCSS('background-image',bgGradient)+GutentorGenerateCSS('background-color',bgcolor2)+'}';
742            }
743            gMainClass += gThis.attr('id')+'-mfp ';
744            gma[i] = {
745                type: 'inline',
746                items: {
747                    src: '#'+gThis.attr('id')
748                },
749            };
750            if( gThis.attr('type')){
751                gMainClass += 'g-adv-popup-'+gThis.attr('type')+' ';
752                if( 'modal' === gThis.attr('wval') ){
753                    gma[i].modal = true;
754                }
755                if( 'modal' === gThis.attr('type')){
756                    if( gThis.attr('wval') && gThis.attr('wunit') ){
757                        gCss[i] += '.'+gThis.attr('id')+'-mfp'+' .mfp-container .mfp-content{width:'+gThis.attr('wval')+gThis.attr('wunit')+';}';
758                    }
759                }
760
761                if( 'side' === gThis.attr('type') && gThis.attr('side')){
762                    if( (gThis.attr('x') || gThis.attr('y')) && gThis.attr('sideunit') ){
763                        if('top-left' === gThis.attr('side')){
764                            sideCss += 'left:'+gThis.attr('x')+gThis.attr('sideunit')+' !important;';
765                            sideCss += 'top:'+gThis.attr('y')+gThis.attr('sideunit')+' !important;';
766                        }
767                        else if('top-right' === gThis.attr('side')){
768                            sideCss += 'right:'+gThis.attr('x')+gThis.attr('sideunit')+' !important;';
769                            sideCss += 'top:'+gThis.attr('y')+gThis.attr('sideunit')+' !important;';
770                        }
771                        else if('bottom-left' === gThis.attr('side')){
772                            sideCss += 'left:'+gThis.attr('x')+gThis.attr('sideunit')+' !important;';
773                            sideCss += 'bottom:'+gThis.attr('y')+gThis.attr('sideunit')+' !important;';
774                        }
775                        else if('bottom-right' === gThis.attr('side')){
776                            sideCss += 'right:'+gThis.attr('x')+gThis.attr('sideunit')+' !important;';
777                            sideCss += 'bottom:'+gThis.attr('y')+gThis.attr('sideunit')+' !important;';
778                        }
779                    }
780                    if( gThis.attr('wval') && gThis.attr('wunit') ){
781                        sideCss += 'width:'+gThis.attr('wval')+gThis.attr('wunit')+';';
782                    }
783                    gCss[i] += '.'+gThis.attr('id')+'-mfp'+' {'+sideCss+'}';
784                    gMainClass += 'g-adv-popup-side-'+gThis.attr('side')+' ';
785                }
786
787            }
788            if( gMainClass){
789                gma[i].mainClass = gMainClass;
790            }
791            gma[i].closeOnBgClick = gIsTrue(gThis.attr('closeonbgclick'));
792            gma[i].closeBtnInside = gIsTrue(gThis.attr('closebtninside'));
793            gma[i].showCloseBtn = gIsTrue(gThis.attr('showclosebtn'));
794            gma[i].enableEscapeKey = gIsTrue(gThis.attr('enableescapekey'));
795            gma[i].fixedContentPos = gIsTrue(gThis.attr('fixedcontentpos'));
796            gma[i].fixedBgPos = gIsTrue(gThis.attr('fixedbgpos'));
797
798            if( !gma[i].closeBtnInside && $('body').hasClass('admin-bar')){
799                gCss[i] += '.'+gThis.attr('id')+'-mfp'+' {top:32px !important;}';
800            }
801            gma[i].callbacks = {
802                beforeOpen: function() {
803                    if(gCss[i]){
804                        $("head").append('<style id="gutentor-adv-popup-style">'+gCss[i]+'</style>');
805                    }
806                    if( gThis.attr('animation')){
807                        this.st.mainClass = this.st.mainClass +' animated ' +gThis.attr('animation');
808                    }
809                },
810                open: function() {
811                    gRefreshJS($('.mfp-container'));
812                    /*WOW*/
813                    if (typeof WOW !== 'undefined') {
814                        let wow = new WOW(
815                            {
816                                boxClass:     'gadvpopupwow'
817                            }
818                        );
819                        wow.init();
820                    }
821                    $('.mfp-bg').removeClass(this.st.mainClass);
822
823                    if( 'top' === gThis.attr('type') || 'bottom' === gThis.attr('type') || 'side' === gThis.attr('type')){
824                        $('.mfp-bg').remove();
825                    }
826                },
827                close: function() {
828                    $('#gutentor-adv-popup-style').remove();
829                }
830            };
831
832
833            if( gThis.attr('trigger')){
834                if( 'load' === gThis.attr('trigger') ){
835                    if( gThis.attr('timing')){
836                        setTimeout(function() {
837                            gAdvPopupOpen(gma[i],gThis);
838                        }, parseFloat(gThis.attr('timing'))*1000);
839                    }
840                    else{
841                        gAdvPopupOpen(gma[i],gThis);
842                    }
843                }
844                else if( 'click' === gThis.attr('trigger') ){
845                    gDocument.on('click', '.'+gThis.attr('clickclass'), function(e) {
846                        e.preventDefault();
847                        gAdvPopupOpen(gma[i],gThis);
848                    });
849                }
850                else if( 'idle' === gThis.attr('trigger') ){
851                    gSetIdleTime(gma[i], gThis);
852                }
853                else if( 'scroll' === gThis.attr('trigger') ){
854                    gIndex[i].lastScrollTop = 0;
855                    gIndex[i].open = false;
856                    gIndex[i].lastDirection = '';
857                    gIndex[i].scrollDistance = $(window).scrollTop();
858                    gIndex[i].triggerDistance = 0;
859                    if( gThis.attr('sval') ){
860                        gIndex[i].triggerDistance = parseInt(gThis.attr('sval'));
861                        if( gThis.attr('sunit') && "%" === gThis.attr('sunit') ){
862                            gIndex[i].triggerDistance = $(window).height()*gIndex[i].triggerDistance/100;
863                        }
864                        $(window).scroll(function(event){
865                            if( !gIndex[i].open){
866                                let st = $(this).scrollTop();
867                                if (st > gIndex[i].lastScrollTop){
868                                    if( 'downscroll' !== gIndex[i].lastDirection){
869                                        gIndex[i].scrollDistance = gIndex[i].scrollDistance - (st - gIndex[i].lastScrollTop);
870                                    }
871                                    else{
872                                        gIndex[i].scrollDistance = gIndex[i].scrollDistance + (st - gIndex[i].lastScrollTop);
873                                    }
874                                    gIndex[i].lastDirection = 'downscroll';
875                                    if( 'top' === gThis.attr('direction') ){
876                                        if( gIndex[i].scrollDistance > gIndex[i].triggerDistance   ){
877                                            gAdvPopupOpen(gma[i],gThis);
878                                            gIndex[i].open = true;
879                                        }
880                                    }
881                                } else {
882                                    if( 'upscroll' !== gIndex[i].lastDirection){
883                                        gIndex[i].scrollDistance = gIndex[i].scrollDistance - (st - gIndex[i].lastScrollTop);
884                                    }
885                                    else{
886                                        gIndex[i].scrollDistance = gIndex[i].scrollDistance + (gIndex[i].lastScrollTop - st);
887                                    }
888                                    gIndex[i].lastDirection = 'upscroll';
889                                    if( 'bottom' === gThis.attr('direction') ){
890                                        if( gIndex[i].scrollDistance > gIndex[i].triggerDistance   ){
891                                            gAdvPopupOpen(gma[i],gThis);
892                                            gIndex[i].open = true;
893                                        }
894                                    }
895                                }
896                                gIndex[i].lastScrollTop = st;
897                            }
898                        });
899
900                    }
901                }
902            }
903
904        });
905    }
906    function gAdvPopupData() {
907
908        let gAllScripts = [],
909            gAllStyles = [];
910
911        function getAllScripts(){
912            let scripts = window.document.getElementsByTagName('script');
913            $(scripts).each(function() {
914                if( $(this).attr('src')){
915                    gAllScripts.push($(this).attr('src'));
916                }
917            });
918        }
919        getAllScripts();
920
921        function getAllStyles(){
922            let links = window.document.getElementsByTagName('link');
923            $(links).each(function() {
924                if( $(this).attr('href')){
925                    gAllStyles.push($(this).attr('href'));
926                }
927            });
928        }
929        getAllStyles();
930
931        function filterContent(filterContent){
932            filterContent.find('script').each(function() {
933                if( !gAllScripts.includes($(this).attr('src'))){
934                    if( $(this).attr('src')){
935                        $('head').append("<script type='text/javascript' src='"+$(this).attr('src')+"' />");
936                    }
937                }
938                $(this).remove();
939
940            });
941            filterContent.find('link').each(function() {
942                if( !gAllStyles.includes($(this).attr('href'))){
943                    if( $(this).attr('href') && $(this).attr('rel') && 'stylesheet' === $(this).attr('rel')){
944                        $('head').append("<link rel='stylesheet' href='"+$(this).attr('href')+"' />");
945                    }
946                }
947                $(this).remove();
948            });
949            filterContent.find('.wow').addClass('gadvpopupwow').removeClass('wow');
950
951            gBody.append(filterContent);
952            gInitAdvPopup();
953        }
954
955        if( 'ajax' != gutentorLS.adv_popup_load ){
956            filterContent($('.g-adv-popup'));
957        }
958        else{
959            let gParam = {
960                condition: gutentorLS.condition
961            };
962            $.ajax({
963                type: 'GET',
964                url: gutentorLS.restUrl + 'gutentor-self-api/v1/popup',
965                data: gParam,
966                beforeSend: function(xhr) {
967                    xhr.setRequestHeader('X-WP-Nonce', gutentorLS.restNonce);
968                },
969            }).done(function(data) {
970                data && data.map((item, i) =>{
971                    let dataContent =  $(item);
972                    filterContent(dataContent);
973                });
974            }).fail(function(jqXHR, textStatus, errorThrown) {
975                console.log(jqXHR + " :: " + textStatus + " :: " + errorThrown);
976            }).always(function() {
977
978            });
979
980        }
981
982    }
983
984
985    function GutentorGenerateCSS( prop, value ) {
986        if( value){
987            return (
988                `${prop}: ${value};`
989            );
990        }
991        return '';
992    }
993
994    /*Page Disabled for Pagination*/
995    function gPageDisabled(gThis){
996        let gAB = gThis.closest('.gutentor-advanced-post-module');
997        if (gAB.attr('data-maxnumpages') && parseInt(gAB.attr('data-maxnumpages')) < 2) {
998            gThis.addClass('gutentor-disabled');
999        } else {
1000            gThis.removeClass('gutentor-disabled');
1001        }
1002    }
1003
1004    /*Popover Block*/
1005    /*show popover content block*/
1006    function gPopOver(){
1007        gDocument.on('mouseenter', '.g-m-popover.g-po-e-hover .g-m-popover-normal', function(e) {
1008            $(this).next('.g-m-popover-content').removeClass('d-none');
1009        });
1010        gDocument.on('mouseleave', '.g-m-popover.g-po-e-hover .g-m-popover-normal', function(e) {
1011            $(this).next('.g-m-popover-content').addClass('d-none');
1012        });
1013        gDocument.on('click', '.g-m-popover.g-po-e-hover .g-m-popover-normal', function(e) {
1014            e.preventDefault();
1015        });
1016        gDocument.on('click', '.g-m-popover.g-po-e-click .g-m-popover-normal', function(e) {
1017            $(this).next('.g-m-popover-content').toggleClass('d-none');
1018            e.preventDefault();
1019        })
1020        $('.g-m-popover.g-m-popover-c-on').find('.g-m-popover-content').removeClass('d-none');
1021    }
1022
1023    /*Acme Ticker*/
1024    function gAcmeTicker(gThis){
1025        let news_ticker_data = gThis.find('.gutentor-news-ticker-data'),
1026            news_ticker_Pause = gThis.find('.gutentor-news-ticker-controls').find('.gutentor-news-ticker-pause'),
1027            news_ticker_up = gThis.find('.gutentor-news-ticker-controls').find('.gutentor-news-ticker-prev'),
1028            news_ticker_down = gThis.find('.gutentor-news-ticker-controls').find('.gutentor-news-ticker-next');
1029        let options = {
1030            type: "horizontal",
1031            direction: "right",
1032            speed: 600,
1033            controls: {
1034                toggle: news_ticker_Pause /*Can be used for vertical/horizontal/marquee/typewriter*/
1035            },
1036        };
1037        if (gThis.attr('data-type')) {
1038            options.type = gThis.attr('data-type');
1039            if (gThis.attr('data-type') !== 'marquee') {
1040                options.controls.prev = news_ticker_up;
1041                options.controls.next = news_ticker_down;
1042            }
1043        }
1044        if (gThis.attr('data-direction')) {
1045            options.direction = gThis.attr('data-direction');
1046        }
1047        if (gThis.attr('data-speed')) {
1048            options.speed = Number(gThis.attr('data-speed'));
1049        }
1050        if (gThis.attr('data-pauseOnHover')) {
1051            options.pauseOnHover = ('1' === gThis.attr('data-pauseOnHover'));
1052        }
1053        news_ticker_data.AcmeTicker(options);
1054    }
1055
1056    function gEddCartIcon(gThis){
1057        let icon = gThis.attr('data-icon'),
1058            button_class = gThis.find('.gutentor-button');
1059        if (button_class.hasClass('gutentor-icon-before')) {
1060            button_class.prepend('<i class="gutentor-button-icon ' + icon + '" ></i>');
1061        }
1062        if (button_class.hasClass('gutentor-icon-after')) {
1063            button_class.append('<i class="gutentor-button-icon ' + icon + '" ></i>');
1064        }
1065    }
1066
1067    function gFlexMenu(gThis){
1068        /*FlexMenu ( Responsive Menu)*/
1069        if (typeof $.fn.flexMenu !== 'undefined') {
1070            if (gThis.length) {
1071                gThis.flexMenu({
1072                    threshold: 0,
1073                    cutoff: 0,
1074                    linkText: '<span class="screen-reader-text">More</span>',
1075                    linkTextAll: '<span class="screen-reader-text">More</span>',
1076                    linkTitle: '',
1077                    linkTitleAll: '',
1078                    showOnHover: (gWindowWidth > 991 ? true : false)
1079                });
1080                if( !gFlexInit ){
1081                    gDocument.click(function(e){
1082                        let flexMenuPopup = $('ul.flexMenu-popup');
1083                        if(!(
1084                            $(e.target).closest('li.flexMenu-viewMore ').length > 0  ||
1085                            !flexMenuPopup.length ||
1086                            !flexMenuPopup.is(":visible")
1087                        )) {
1088                            $('li.flexMenu-viewMore > a').trigger('click');
1089                        }
1090                    });
1091                }
1092                gFlexInit = true;
1093
1094            }
1095        }
1096    }
1097
1098    function gRefreshJS($wrap){
1099        /*Counter and Bar*/
1100        gCountAndBar($wrap)
1101
1102        /*Initilized disabled*/
1103        $wrap.find('.gutentor-post-footer.g-ap-load-more-template a.gutentor-button').each(function() {
1104            gPageDisabled($(this))
1105        });
1106
1107        /*Slick*/
1108        if (typeof $.fn.slick !== 'undefined') {
1109            $wrap.find('.gutentor-slider-wrapper').each(function() {
1110                gSlick($(this))
1111            });
1112            $wrap.find('.gutentor-module-slider-row').each(function() {
1113                gSlick($(this))
1114            });
1115            $wrap.find('.gutentor-carousel-row').each(function() {
1116                gSlick($(this))
1117            });
1118            $wrap.find('.gutentor-image-carousel-row').each(function() {
1119                gSlick($(this))
1120            });
1121            $wrap.find('.gutentor-module-carousel-row').each(function() {
1122                gSlick($(this))
1123            });
1124        }
1125
1126        // Gutentor Countdown
1127        $wrap.find('.gutentor-countdown-wrapper').each(function() {
1128            gCountDown($(this));
1129        });
1130
1131        // gutentor popover blocks
1132        gPopOver();
1133
1134        /*Acme Ticker*/
1135        if (typeof $.fn.AcmeTicker !== 'undefined') {
1136            $wrap.find('.gutentor-post-module-p5').each(function() {
1137                gAcmeTicker($(this));
1138            });
1139        }
1140
1141        /*edd add to cart*/
1142        $wrap.find('.g-edd-cart').each(function() {
1143            gEddCartIcon($(this))
1144        });
1145
1146        /*Flex*/
1147        gFlexMenu($wrap.find('.g-responsive-menu'))
1148
1149        /*Filter*/
1150        gFilter();
1151
1152        /*sticky sidebar*/
1153        if (typeof $.fn.theiaStickySidebar !== 'undefined') {
1154            $wrap.find('.gutentor-enable-sticky-column').each(function() {
1155                gTheiaStickySidebar($(this))
1156            });
1157        }
1158
1159        /*Video Autoplay*/
1160        gVideoAutoplay();
1161
1162        //Gutentor Gallery Box
1163        if (typeof $.fn.imagesLoaded !== 'undefined') {
1164            let galleryWrapper = $wrap.find('.gutentor-gallery-wrapper');
1165            galleryWrapper.each(function() {
1166                gGalleryMasonry($(this));
1167            });
1168            let postModule = $('.gutentor-post-module-p1');
1169            postModule.each(function() {
1170                gPostModuleMasonry($(this));
1171            });
1172        }
1173
1174        /*Isotop Refresh*/
1175        if( !gM11Init){
1176            gM11();
1177        }
1178        if (typeof $.fn.isotope !== 'undefined') {
1179            if ($wrap.find('.g-gm-item-wrap').hasClass('isotope')) {
1180                $wrap.find('.g-gm-item-wrap').isotope('reloadItems').isotope();
1181            }
1182            if ($wrap.find('.gutentor-filter-item-wrap').hasClass('isotope')) {
1183                $wrap.find('.gutentor-filter-item-wrap').isotope('reloadItems').isotope();
1184            }
1185        }
1186        /*masonry Refresh*/
1187        $wrap.find('.gutentor-gallery-wrapper').each(function() {
1188            let masonryBoxes = $(this);
1189            if (masonryBoxes.hasClass('enable-masonry')) {
1190                let container = masonryBoxes.find('.full-width-row');
1191                container.masonry({
1192                    itemSelector: '.gutentor-gallery-item',
1193                });
1194            }
1195        });
1196        $wrap.find('.gutentor-post-module-p1').each(function() {
1197            let masonryBoxes = $(this);
1198            if (masonryBoxes.hasClass('g-masonry')) {
1199                let container = masonryBoxes.find('.grid-row');
1200                container.masonry({
1201                    itemSelector: '.gutentor-post',
1202                });
1203            }
1204        });
1205        $wrap.find('.g-gm-module').each(function(i, item) {
1206            let thisFilterWrap = $(this);
1207            if (thisFilterWrap.hasClass('g-on-masonry')) {
1208                let container = thisFilterWrap.find('.g-gm-item-wrap');
1209                container.masonry({
1210                    itemSelector: '.g-gm-col ',
1211                });
1212            }
1213        })
1214    }
1215
1216    /*Document ready function*/
1217    gDocument.ready(function() {
1218
1219        /*Gutentor Advanced Popup*/
1220        if ('is_admin' in gutentorLS &&
1221            'is_on_adv_popup' in gutentorLS &&
1222            'adv_popup_load' in gutentorLS &&
1223            gutentorLS.is_on_adv_popup &&
1224            !gutentorLS.is_admin){
1225            gAdvPopupData();
1226        }
1227
1228        /*Magnific Popup close*/
1229        gDocument.on('click', '.g-adv-popup-close', function(e) {
1230            e.preventDefault();
1231            $.magnificPopup.close();
1232        });
1233
1234        /*WOW*/
1235        if (typeof WOW !== 'undefined') {
1236            new WOW().init();
1237        }
1238        /*Magnific Popup*/
1239        /* video popup and button link popup */
1240        $('.gutentor-video-popup-holder').each(function() {
1241            gMagnificPopup($(this))
1242        });
1243        $('.g-v-btn').each(function() {
1244            gMagnificPopup($(this))
1245        });
1246        $('.g-v-fp-btn').each(function() {
1247            gMagnificPopup($(this))
1248        });
1249        $('.gutentor-element-button-link-popup').each(function() {
1250            gMagnificPopup($(this))
1251        });
1252
1253        /*Initilized disabled*/
1254        $('.gutentor-post-footer.g-ap-load-more-template a.gutentor-button').each(function() {
1255            gPageDisabled($(this))
1256        });
1257
1258        /*Slick*/
1259        if (typeof $.fn.slick !== 'undefined') {
1260            $('.gutentor-slider-wrapper').each(function() {
1261                gSlick($(this))
1262            });
1263            $('.gutentor-module-slider-row').each(function() {
1264                gSlick($(this))
1265            });
1266            $('.gutentor-carousel-row').each(function() {
1267                gSlick($(this))
1268            });
1269            $('.gutentor-image-carousel-row').each(function() {
1270                gSlick($(this))
1271            });
1272            $('.gutentor-module-carousel-row').each(function() {
1273                gSlick($(this))
1274            });
1275        }
1276
1277        /*Accordion*/
1278        gDocument.on('click', '.gutentor-accordion-heading', function(e) {
1279
1280            var gThis = $(this),
1281                accordion_content = gThis.closest('.gutentor-accordion-wrap'),
1282                accordion_item = gThis.closest('.gutentor-single-item'),
1283                accordion_details = accordion_item.find('.gutentor-accordion-body'),
1284                accordion_all_items = accordion_content.siblings('.gutentor-accordion-wrap');
1285
1286            accordion_all_items.each(function() {
1287                $(this).find('.gutentor-accordion-body').slideUp();
1288                $(this).find('.gutentor-accordion-heading').removeClass('active');
1289            });
1290
1291            if (accordion_details.is(":visible")) {
1292                accordion_details.slideUp().removeClass('gutentor-active-body');
1293                gThis.removeClass('active');
1294
1295            } else {
1296                accordion_details.slideDown().addClass('gutentor-active-body');
1297                gThis.addClass('active');
1298            }
1299            e.preventDefault();
1300        });
1301
1302        /* Module Accordion*/
1303        function moduleAccordion(gThis){
1304            let a_g_p = gThis.closest('.gutentor-module-accordion'),
1305                a_item = gThis.closest('.gutentor-module-accordion-item'),
1306                a_details = a_item.find('.gutentor-module-accordion-body'),
1307                a_o_items = a_item.siblings('.gutentor-module-accordion-item'),
1308                a_i_wrap = gThis.find('.gutentor-module-accordion-icon');
1309
1310            a_o_items.removeClass('gutentor-module-accordion-active');
1311
1312            if (a_g_p.hasClass('gutentor-module-accordion-enable-toggle')){
1313                a_o_items.each(function() {
1314                    $(this).find('.gutentor-module-accordion-body').slide
1314Up();
1315                    $(this).find('.gutentor-module-accordion-icon').removeClass('gutentor-module-accordion-icon-active');
1316                });
1317            }
1318            if (a_details.is(":visible")) {
1319                a_details.slideUp();
1320                a_i_wrap.removeClass('gutentor-module-accordion-icon-active');
1321                a_details.removeClass('gutentor-module-accordion-icon-active');
1322                a_item.removeClass('gutentor-module-accordion-active');
1323            } else {
1324                a_details.slideDown();
1325                a_details.addClass('gutentor-module-accordion-icon-active');
1326                a_i_wrap.addClass('gutentor-module-accordion-icon-active');
1327                a_item.addClass('gutentor-module-accordion-active');
1328
1329                gRefreshJS(a_details);
1330            }
1331        }
1332        gDocument.on('click', '.gutentor-module-accordion-item-heading', function(e) {
1333            moduleAccordion($(this))
1334            e.preventDefault();
1335        });
1336        gDocument.on('keypress', '.gutentor-module-accordion-item-heading', function(e) {
1337            if( e.keyCode == 13 ){
1338                moduleAccordion($(this))
1339                e.preventDefault();
1340            }
1341        });
1342
1343        /* Table of content Accordion*/
1344        gDocument.on('click', '.g-toc-header', function(e) {
1345            let gThis = $(this),
1346                toc_parent = gThis.closest('.gutentor-module-table-of-contents'),
1347                toc_body = toc_parent.find('.g-toc-body');
1348            if(toc_parent.hasClass('g-enable-collapsible')){
1349                if (toc_body.is(":visible")) {
1350                    toc_body.slideUp();
1351                    gThis.removeClass('g-collapsible-active');
1352                } else {
1353                    gThis.addClass('g-collapsible-active');
1354                    toc_body.slideDown();
1355                }
1356            }
1357            e.preventDefault();
1358        });
1359
1360        /* Module Tab*/
1361        function moduleTabs(gThis){
1362            let gThisIndex = gThis.index(),
1363                gThisWrap = gThis.closest('.gutentor-module-tabs-wrap'),
1364                gThisWrapID = gThisWrap.data('id'),
1365                gThisContentID = '.gm-tc-' + gThisWrapID;
1366            if (gThis.hasClass('gutentor-tabs-nav-active')) {
1367                return;
1368            }
1369            gThis.addClass('gutentor-tabs-nav-active');
1370            gThis.siblings().removeClass('gutentor-tabs-nav-active');
1371            gThisWrap.find(gThisContentID).eq(gThisIndex).siblings().removeClass('gutentor-tabs-content-active');
1372            gThisWrap.find(gThisContentID).eq(gThisIndex).addClass('gutentor-tabs-content-active');
1373
1374            /*Slick Fixed*/
1375            gRefreshJS(gThisWrap.find(gThisContentID).eq(gThisIndex));
1376        }
1377        gDocument.on('click', '.gutentor-module-tabs-item', function(e) {
1378            moduleTabs($(this));
1379            e.preventDefault();
1380        });
1381        gDocument.on('keypress', '.gutentor-module-tabs-item', function(e) {
1382            if( e.keyCode == 13 ){
1383                moduleTabs($(this))
1384                e.preventDefault();
1385            }
1386        });
1387
1388        /*Counter*/
1389        gDocument.on('click', '.gutentor-countup-wrap', function() {
1390            $(this).addClass('gutentor-countup-open');
1391        });
1392        gDocument.on('click', '.gutentor-countup-box-close', function() {
1393            $('.gutentor-countup-box').addClass('hide-input');
1394            $(this).hide();
1395        });
1396        gDocument.on('click', '.gutentor-countup', function() {
1397            $('.gutentor-countup-box').removeClass('hide-input');
1398        });
1399
1400        // Gutentor Countdown
1401        $('.gutentor-countdown-wrapper').each(function() {
1402            gCountDown($(this));
1403        });
1404
1405        // gutentor popover blocks
1406        gPopOver();
1407
1408        /*Flex Menu*/
1409        gFlexMenu($('.g-responsive-menu'))
1410
1411        /*Show more Block*/
1412        gShowMoreBlock('.gutentor-show-more-button');
1413        gShowMoreBlock('.gutentor-show-less-action-button');
1414        gShowMoreBlock('.gutentor-adv-s-m-btn');
1415        gShowMoreBlock('.gutentor-adv-s-l-btn');
1416
1417
1418        /*Acme Ticker*/
1419        if (typeof $.fn.AcmeTicker !== 'undefined') {
1420            $('.gutentor-post-module-p5').each(function() {
1421                gAcmeTicker($(this));
1422            });
1423            /*Pause fixed*/
1424            $(document).on('acmeTickerToggle', function(e, thisTicker) {
1425                $(thisTicker).closest('.gutentor-news-ticker').toggleClass('gutentor-ticker-pause')
1426            });
1427        }
1428        /*Tabs*/
1429        gTabs();
1430
1431        /*edd add to cart*/
1432        $('.g-edd-cart').each(function() {
1433            gEddCartIcon($(this))
1434        });
1435    });
1436
1437    /*Filter Module*/
1438    function gM11() {
1439        let buttonM11Filters = {},
1440            buttonM11Filter = {},
1441            m11Regex = {},
1442            m11FilWrap = $('.g-fm-module'),
1443            currentFilter;
1444        if (m11FilWrap.length) {
1445            m11FilWrap.find('.g-gm-item-wrap').isotope({
1446                itemSelector: '.g-gm-col',
1447                layoutMode: 'fitRows',
1448                filter: function() {
1449                    let gThis = $(this),
1450                        searchResult = currentFilter && m11Regex[currentFilter] ? gThis.text().match(m11Regex[currentFilter]) : true,
1451                        buttonResult = currentFilter && buttonM11Filter[currentFilter] ? gThis.is(buttonM11Filter[currentFilter]) : true;
1452
1453                    return searchResult && buttonResult;
1454                },
1455            });
1456        }
1457        gDocument.on('click', '.g-fm-fi', function() {
1458            $(this).siblings().removeClass('g-fm-active');
1459            $(this).addClass('g-fm-active');
1460
1461            let masonryBoxes = $(this).closest('.g-fm-module');
1462            currentFilter = masonryBoxes.attr('data-filter-number');
1463            let gThis = $(this);
1464            // get group key
1465            let btnGroup = gThis.parents('.g-fm-fis'),
1466                filterGroup = btnGroup.attr('data-filter-group');
1467
1468            // set filter for group
1469            if (buttonM11Filters[currentFilter] === undefined) {
1470                buttonM11Filters[currentFilter] = {};
1471            }
1472            buttonM11Filters[currentFilter][filterGroup] = gThis.attr('data-filter');
1473            // combine filters
1474            if (buttonM11Filter[currentFilter] === undefined) {
1475                buttonM11Filter[currentFilter] = {};
1476            }
1477            buttonM11Filter[currentFilter] = gConcatValues(buttonM11Filters[currentFilter]);
1478            // Isotope arrange
1479            let this_grid_wrapper = gThis.closest('.g-fm-module').find('.g-gm-item-wrap');
1480            this_grid_wrapper.isotope();
1481        });
1482
1483        $('.g-gm-module').find('.grid-container').each(function() {
1484            let str = $( ".g-nothing-found-text" ).text();
1485            str =  str ? str : 'Nothing Found!!!!';
1486            let html = '<div class="g-nothing-found">'+str+'</div>';
1487            $(this).append(html);
1488            $('.g-nothing-found').hide();
1489        });
1490
1491        //filter search
1492        function filterSearchEvent(thisData) {
1493            let masonryBoxes = thisData.closest('.g-fm-module');
1494            currentFilter = masonryBoxes.attr('data-filter-number');
1495            m11Regex[currentFilter] = new RegExp(thisData.val(), 'gi');
1496            let this_grid_wrapper = thisData.closest('.g-fm-module').find('.g-gm-item-wrap');
1497
1498            this_grid_wrapper.isotope();
1499            // display message box if no filtered items
1500            if ( !this_grid_wrapper.data('isotope').filteredItems.length ) {
1501                $('.g-nothing-found').show();
1502            }
1503            else{
1504                $('.g-nothing-found').hide();
1505            }
1506        }
1507
1508        /* use value of search field to filter*/
1509        $('.g-fm-module .g-fm-search').keyup(gDebounce(function() {
1510            filterSearchEvent($(this))
1511        }));
1512        $('.g-fm-module .g-fm-search').on("search", function() {
1513            filterSearchEvent($(this))
1514        });
1515
1516        // flatten object by concatting values
1517        function gConcatValues(obj) {
1518            let value = '';
1519            for (let prop in obj) {
1520                value += obj[prop];
1521            }
1522            return value;
1523        }
1524
1525        // gDebounce so filtering doesn't happen every millisecond
1526        function gDebounce(fn, threshold) {
1527            let timeout;
1528            threshold = threshold || 100;
1529            return function gDebounced() {
1530                clearTimeout(timeout);
1531                let args = arguments;
1532                let _this = this;
1533
1534                function delayed() {
1535                    fn.apply(_this, args);
1536                }
1537                timeout = setTimeout(delayed, threshold);
1538            };
1539        }
1540
1541        gDocument.find('.g-fm-module').each(function(i, item) {
1542            let thisFilterWrap = $(this);
1543            thisFilterWrap.attr('data-filter-number', i);
1544        });
1545        gDocument.find('.g-gm-module').each(function(i, item) {
1546            let thisFilterWrap = $(this);
1547            if (thisFilterWrap.hasClass('g-on-masonry')) {
1548                let container = thisFilterWrap.find('.g-gm-item-wrap');
1549                container.isotope({ layoutMode: 'masonry' })
1550            }
1551            let thisFilterWrapPopup = $(this);
1552            if (thisFilterWrapPopup.hasClass('g-on-popup')) {
1553                let container = thisFilterWrapPopup.find('.g-gm-item-wrap');
1554                if (typeof $.fn.imagesLoaded !== 'undefined') {
1555                    container.imagesLoaded(function() {
1556                        thisFilterWrapPopup.fadeIn('slow');
1557                        container.masonry({
1558                            itemSelector: '.g-gm-col ',
1559                        });
1560                    });
1561                }
1562            }
1563            let popupIcon = thisFilterWrapPopup.find('.g-gm-popup'),
1564                popupMediaType = popupIcon.attr('data-media-type');
1565            if(popupMediaType === 'g-popup-img'){
1566                gMagnificPopup(popupIcon,true, true);
1567            }
1568            else{
1569                gMagnificPopup(popupIcon,false, true);
1570            }
1571        });
1572
1573        gM11Init = true;
1574    }
1575
1576    /*Gallery Gutenberg Module Popup Link
1577    * gMagnificPopup initilize above */
1578    gDocument.on('click', '.g-gm-popup', function(e) {
1579        e.preventDefault();
1580        $(this).magnificPopup.open()
1581    });
1582
1583    /*Gallery Wrapper Masonry*/
1584    function gGalleryMasonry(masonryBoxes){
1585        if (masonryBoxes.hasClass('enable-masonry')) {
1586            let container = masonryBoxes.find('.full-width-row');
1587
1588            container.imagesLoaded(function() {
1589                masonryBoxes.fadeIn('slow');
1590                container.masonry({
1591                    itemSelector: '.gutentor-gallery-item',
1592                });
1593            });
1594
1595        }
1596        gMagnificPopup(masonryBoxes.find('.image-gallery'), true, true);
1597    }
1598
1599    function gPostModuleMasonry(masonryBoxes){
1600        if (masonryBoxes.hasClass('g-masonry')) {
1601            let container = masonryBoxes.find('.grid-row');
1602            container.imagesLoaded(function() {
1603                masonryBoxes.fadeIn('slow');
1604                container.masonry({
1605                    itemSelector: '.gutentor-post',
1606                });
1607            });
1608        }
1609    }
1610
1611    function gReloadMasonry(masonryBoxes){
1612        if (masonryBoxes.hasClass('g-masonry')) {
1613            let container = masonryBoxes.find('.grid-row');
1614            container.imagesLoaded(function() {
1615                container.masonry('destroy');
1616            });
1617        }
1618        gPostModuleMasonry(masonryBoxes)
1619    }
1620
1621    /*Video Autoplay */
1622    function gVideoAutoplay() {
1623        let videos = document.getElementsByClassName("gutentor-bg-video"),
1624            i;
1625        for (i = 0; i < videos.length; i++) {
1626            if (videos[i].hasAttribute("autoplay")) {
1627                if (!videos[i].playing) {
1628                    if (!videos[i].hasAttribute("muted")) {
1629                        videos[i].muted = true;
1630                    }
1631                    videos[i].play();
1632                }
1633            }
1634
1635        }
1636    }
1637
1638    /*Filter*/
1639    function gFilter(){
1640        //Gutentor filter Box
1641        let buttonFilters = {},
1642            buttonFilter = {},
1643            qsRegex = {},
1644            filter_wrap = $('.gutentor-filter-item-wrap'),
1645            currentFilter;
1646        if (filter_wrap.length) {
1647            filter_wrap.isotope({
1648                itemSelector: '.gutentor-gallery-item',
1649                layoutMode: 'fitRows',
1650                filter: function() {
1651                    let gThis = $(this);
1652                    let searchResult = currentFilter && qsRegex[currentFilter] ? gThis.text().match(qsRegex[currentFilter]) : true;
1653                    let buttonResult = currentFilter && buttonFilter[currentFilter] ? gThis.is(buttonFilter[currentFilter]) : true;
1654                    return searchResult && buttonResult;
1655                },
1656            });
1657        }
1658        gDocument.on('click', '.gutentor-filter-btn', function() {
1659            $(this).siblings().removeClass('gutentor-filter-btn-active');
1660            $(this).addClass('gutentor-filter-btn-active');
1661
1662            let masonryBoxes = $(this).closest('.gutentor-filter-wrapper');
1663            currentFilter = masonryBoxes.attr('data-filter-number');
1664            let gThis = $(this);
1665            // get group key
1666            let $buttonGroup = gThis.parents('.gutentor-filter-group'),
1667                filterGroup = $buttonGroup.attr('data-filter-group');
1668
1669            // set filter for group
1670            if (buttonFilters[currentFilter] === undefined) {
1671                buttonFilters[currentFilter] = {};
1672            }
1673            buttonFilters[currentFilter][filterGroup] = gThis.attr('data-filter');
1674            // combine filters
1675            if (buttonFilter[currentFilter] === undefined) {
1676                buttonFilter[currentFilter] = {};
1677            }
1678            buttonFilter[currentFilter] = concatValues(buttonFilters[currentFilter]);
1679            // Isotope arrange
1680            let this_grid_wrapper = $(this).closest('.gutentor-filter-container').next('.gutentor-filter-item-wrap');
1681            this_grid_wrapper.isotope();
1682        });
1683        // use value of search field to filter
1684        $('.gutentor-search-filter').keyup(debounce(function() {
1685            let masonryBoxes = $(this).closest('.gutentor-filter-wrapper');
1686            currentFilter = masonryBoxes.attr('data-filter-number');
1687            qsRegex[currentFilter] = new RegExp($(this).val(), 'gi');
1688            let this_grid_wrapper = $(this).closest('.gutentor-filter-container').next('.gutentor-filter-item-wrap');
1689
1690            this_grid_wrapper.isotope();
1691        }));
1692
1693        // flatten object by concatting values
1694        function concatValues(obj) {
1695            let value = '';
1696            for (let prop in obj) {
1697                value += obj[prop];
1698            }
1699            return value;
1700        }
1701
1702        // debounce so filtering doesn't happen every millisecond
1703        function debounce(fn, threshold) {
1704            let timeout;
1705            threshold = threshold || 100;
1706            return function debounced() {
1707                clearTimeout(timeout);
1708                let args = arguments;
1709                let _this = this;
1710
1711                function delayed() {
1712                    fn.apply(_this, args);
1713                }
1714                timeout = setTimeout(delayed, threshold);
1715            };
1716        }
1717
1718        gDocument.find('.gutentor-filter-wrapper').each(function(i, item) {
1719            let thisFilterWrap = $(this);
1720            thisFilterWrap.attr('data-filter-number', i);
1721            gMagnificPopup(thisFilterWrap.find('.image-gallery'), true, true);
1722
1723            let container = thisFilterWrap.find('.gutentor-filter-item-wrap');
1724
1725            if (thisFilterWrap.hasClass('enable-masonry')) {
1726                container.isotope({ layoutMode: 'masonry' })
1727            }
1728        });
1729    }
1730
1731    /*Sticky Sidebar*/
1732    function gTheiaStickySidebar(gThis){
1733        let stickyChildren = gThis.find('.grid-row:first').children('.gutentor-single-column'),
1734            mTop = gThis.attr('data-top'),
1735            mBottom = gThis.attr('data-bottom');
1736
1737        stickyChildren.theiaStickySidebar({
1738            // Settings
1739            additionalMarginTop: parseInt(mTop),
1740            additionalMarginBottom: parseInt(mBottom),
1741        });
1742    }
1743    /*Window Load*/
1744    gWindow.on('load', function() {
1745        //Gutentor Gallery Box
1746        if (typeof $.fn.imagesLoaded !== 'undefined') {
1747            let galleryWrapper = $('.gutentor-gallery-wrapper');
1748            galleryWrapper.each(function() {
1749                gGalleryMasonry($(this));
1750            });
1751            let postModule = $('.gutentor-post-module-p1');
1752            postModule.each(function() {
1753                gPostModuleMasonry($(this));
1754            });
1755        }
1756
1757        /*Filter*/
1758        gFilter();
1759
1760        /*sticky sidebar*/
1761        if (typeof $.fn.theiaStickySidebar !== 'undefined') {
1762            $('.gutentor-enable-sticky-column').each(function() {
1763                gTheiaStickySidebar($(this))
1764            });
1765        }
1766
1767        /*WooCommerce added cart*/
1768
1769        $(document.body).on('added_to_cart', function(e, button) {
1770            setTimeout(function() {
1771                $('.gutentor-woo-add-to-cart .added_to_cart.wc-forward').addClass('gutentor-button button gutentor-post-button');
1772            }, 1);
1773
1774        });
1775
1776        if (typeof $.fn.isotope !== 'undefined') {
1777            /*m11 filter*/
1778            gM11();
1779        }
1780
1781        /*Video Autoplay*/
1782        gVideoAutoplay();
1783    });
1784})(jQuery);

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.