PageSourceSearch

https://2023ieeecama.org/wp-content/plugins/gutentor/assets/js/gutentor.js?ver=3.2.7

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