PageSourceSearch

https://cimec.ro/wp-content/plugins/gutentor/assets/js/gutentor.js?ver=3.3.8

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