PageSourceSearch

https://insaindia.res.in/hindi/wp-content/plugins/gutentor/assets/js/gutentor.js?ver=3.5.4

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