PageSourceSearch

https://medspark.ai/wp-content/themes/foxiz/assets/js/global.js?ver=2.6.3

js medspark.ai collected 2026-10-05 12:15:31 UTC 88,062 bytes, 2,988 lines download raw bytes

1/**  FOXIZ MAN SCRIPT */
2var FOXIZ_MAIN_SCRIPT = (function (Module, $) {
3		'use strict';
4
5		Module.initParams = function () {
6			this.yesStorage = this.isStorageAvailable();
7			this.themeSettings = typeof foxizParams !== 'undefined' ? foxizParams : {};
8			this.galleriesData = typeof foxizGalleriesData !== 'undefined' ? foxizGalleriesData : {};
9			this.ajaxURL = typeof foxizCoreParams !== 'undefined' ? foxizCoreParams.ajaxurl || '' : '';
10			this.ajaxData = {};
11			this.siteAccessFlag = false;
12			this._document = $(document);
13			this._body = $('body');
14			this._window = $(window);
15			this.html = $('html, body');
16			this.outerHTML = $('html');
17			this.iOS = /(iPad|iPhone|iPod)/g.test(navigator.userAgent);
18			this.wPoint = {};
19			this.sticky = {};
20			this.eSticky = {};
21			this.YTPlayers = {};
22			this.articleData = [];
23			this.readIndicatorPercent = 0;
24			this.isProgress = false;
25			this.readIndicator = $('#reading-progress');
26			this.popupNewsletterEl = $('#rb-popup-newsletter');
27
28			this.personailizeUID = (typeof FOXIZ_CORE_SCRIPT !== "undefined" && FOXIZ_CORE_SCRIPT.personailizeUID !== undefined)
29				? FOXIZ_CORE_SCRIPT.personailizeUID
30				: 'u0';
31		}
32
33		Module.init = function () {
34			this.initParams();
35			this.syncLayoutLike();
36			this.topSpacing();
37			this.siteAccessDetector();
38			this.headerDropdown();
39			this.mobileCollapse();
40			this.initSubMenuPos();
41			this.privacyTrigger();
42			this.popupNewsletter();
43			this.documentClick();
44			this.backTop();
45			this.readIndicatorInit();
46			this.fontResizer();
47			this.breakingNews();
48			this.sliders();
49			this.carousels();
50			this.liveSearch();
51			this.personalizeBlocks();
52			this.personalizeCategories();
53			this.likeToggle();
54			this.singleInfiniteLoadNext();
55			this.loginPopup();
56			this.popupTemplate();
57			this.loadYoutubeIframe();
58			this.browserResize();
59			this.footerSlideUp();
60			this.cartNotification();
61			this.newsNotification();
62			this.tocToggle();
63			this.delayLoad();
64			this.showPostComment();
65			this.replyReview();
66			this.paginationNextPrev();
67			this.paginationLoadMore();
68			this.paginationInfinite();
69			this.productQuantity();
70			this.readingCollect();
71			this.liveBlog();
72			this.neededReloadFuncs();
73		}
74
75		Module.neededReloadFuncs = function () {
76			this.hoverTipsy();
77			this.scrollToComment();
78			this.usersRating();
79			this.singleGallery();
80			this.floatingVideo();
81			this.videoPreview();
82			this.floatingVideoRemove();
83			this.scrollTableContent();
84			this.singleScrollRefresh();
85			this.playerAutoPlay();
86			this.hoverEffects();
87			this.highlightShares();
88			this.galleryLightbox();
89			this.singleFeaturedLightbox();
90			this.accordion();
91			this.resIframeClassic();
92			this.taxBasedAccordion();
93		}
94
95		Module.reInitAll = function () {
96
97			this._window.trigger('load');
98			this.syncLayoutLike();
99			if (typeof FOXIZ_PERSONALIZE !== 'undefined') {
100				FOXIZ_PERSONALIZE.syncPersonalizeLayout();
101			}
102			if (typeof RB_REACTION !== 'undefined') {
103				RB_REACTION.syncReactLayout();
104			}
105			this.neededReloadFuncs();
106			Waypoint.refreshAll();
107		}
108
109		/** sync layout & reload features */
110		Module.reloadBlockFunc = function () {
111			this._window.trigger('load');
112
113			if (typeof FOXIZ_PERSONALIZE !== 'undefined') {
114				FOXIZ_PERSONALIZE.syncLayoutBookmarks();
115			}
116			this.syncLayoutLike();
117			this.videoPreview();
118			this.hoverTipsy();
119			Waypoint.refreshAll();
120		}
121
122		Module.initElementor = function () {
123			if ('undefined' !== typeof initDarkMode && !FOXIZ_MAIN_SCRIPT.editorDarkModeInit) {
124				FOXIZ_MAIN_SCRIPT.editorDarkModeInit = true;
125				initDarkMode();
126			}
127			FOXIZ_MAIN_SCRIPT.breakingNews();
128			FOXIZ_MAIN_SCRIPT.carousels();
129			FOXIZ_MAIN_SCRIPT.sliders();
130		}
131
132		Module.isRTL = function () {
133			return this._body.hasClass('rtl');
134		}
135
136		Module.animationFrame = function (callback) {
137			const func = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
138				window.webkitRequestAnimationFrame || this.animationFrameFallback
139			func.call(window, callback)
140		}
141
142		Module.animationFrameFallback = function (callback) {
143			window.setTimeout(callback, 1000 / 60)
144		}
145
146		/**
147		 *
148		 * @returns {boolean}
149		 */
150		Module.isStorageAvailable = function () {
151			let storage;
152			try {
153				storage = window['localStorage'];
154				storage.setItem('__rbStorageSet', 'x');
155				storage.removeItem('__rbStorageSet');
156				return true;
157			} catch (e) {
158				return false;
159			}
160		}
161
162		/**
163		 * set localStorage
164		 * @param key
165		 * @param data
166		 */
167		Module.setStorage = function (key, data) {
168			this.yesStorage && localStorage.setItem(key, typeof data === 'string' ? data : JSON.stringify(data));
169		}
170
171		/**
172		 * get localStorage
173		 * @param key
174		 * @param defaultValue
175		 * @returns {any}
176		 */
177		Module.getStorage = function (key, defaultValue) {
178			if (!this.yesStorage) return null;
179			const data = localStorage.getItem(key);
180			if (data === null) return defaultValue;
181			try {
182				return JSON.parse(data);
183			} catch (e) {
184				return data;
185			}
186		}
187
188		/**
189		 * delelte localStorage
190		 * @param key
191		 */
192		Module.deleteStorage = function (key) {
193			this.yesStorage && localStorage.removeItem(key);
194		}
195
196		/**
197		 *
198		 * @param id
199		 * @param value
200		 * @param ttl
201		 * @constructor
202		 */
203		Module.SetTTLStorage = function (id, value, ttl) {
204			const data = {
205				value: value,
206				ttl: Date.now() + ttl * 3600000
207			};
208
209			this.setStorage(id, data);
210		}
211
212		/**
213		 *
214		 * @param id
215		 * @returns {null|*}
216		 */
217		Module.getTTLStorage = function (id) {
218
219			const data = this.getStorage(id);
220			if (data && Date.now() <= data.ttl) {
221				return data.value;
222			}
223			this.deleteStorage(id);
224			return null;
225		};
226
227		/** on load */
228		Module.delayLoad = function () {
229			const self = this;
230
231			setTimeout(function () {
232				self.stickyNavBar();
233				self.stickyHeaderBuilder();
234			}, 50)
235		}
236
237		/** resize */
238		Module.browserResize = function () {
239			const self = this;
240
241			self._window.on('resize', function () {
242				self.topSpacing();
243				self.calcSubMenuPos();
244			})
245		}
246
247		/* ================================ HEADERS ================================ */
248		Module.hoverTipsy = function () {
249
250			if (!$.fn.rbTipsy) {
251				return false;
252			}
253
254			this._body.find('[data-copy]').rbTipsy({
255				title: 'data-copy',
256				fade: true,
257				opacity: 1,
258				trigger: 'hover',
259				gravity: 's'
260			});
261
262			if (window.innerWidth > 1024) {
263				this._body.find('#site-header [data-title]').rbTipsy({
264					title: 'data-title',
265					fade: true,
266					opacity: 1,
267					trigger: 'hover',
268					gravity: 'n'
269				});
270
271				this._body.find('.site-wrap [data-title]').rbTipsy({
272					title: 'data-title',
273					fade: true,
274					opacity: 1,
275					trigger: 'hover',
276					gravity: 's'
277				});
278			}
279		}
280
281		/** font resizer */
282		Module.fontResizer = function () {
283			const self = this;
284			let size = self.yesStorage ? sessionStorage.getItem('rubyResizerStep') : 1;
285
286			self._body.on('click', '.font-resizer-trigger', function (e) {
287				e.preventDefault();
288				e.stopPropagation();
289				size++;
290				if (3 < size) {
291					size = 1;
292					self._body.removeClass('medium-entry-size big-entry-size')
293				} else {
294					if (2 == size) {
295						self._body.addClass('medium-entry-size').removeClass('big-entry-size');
296					} else {
297						self._body.addClass('big-entry-size').removeClass('medium-entry-size')
298					}
299				}
300
301				self.yesStorage && sessionStorage.setItem('rubyResizerStep', size);
302			});
303		}
304
305		/** hover */
306		Module.hoverEffects = function () {
307			const selectors = $('.effect-fadeout');
308
309			if (selectors.length === 0) {
310				return;
311			}
312			selectors.off('mouseenter mouseleave').on('mouseenter', function (e) {
313				e.stopPropagation();
314				const target = $(this);
315				if (!target.hasClass('activated')) {
316					target.addClass('activated');
317				}
318			}).on('mouseleave', function () {
319				$(this).removeClass('activated');
320			});
321		}
322
323		Module.videoPreview = function () {
324			let playPromise;
325
326			$('.preview-trigger').on('mouseenter', function () {
327				const target = $(this);
328				const wrap = target.find('.preview-video');
329				if (!wrap.hasClass('video-added')) {
330					const video = '<video preload="auto" muted loop><source src="' + wrap.data('source') + '" type="' + wrap.data('type') + '"></video>';
331					wrap.append(video).addClass('video-added');
332				}
333				target.addClass('show-preview');
334				wrap.css('z-index', 3);
335				const el = target.find('video')[0];
336				if (el) {
337					playPromise = el.play();
338				}
339			}).on('mouseleave', function () {
340				const target = $(this);
341				target.find('.preview-video').css('z-index', 1);
342				const el = target.find('video')[0];
343				if (el && playPromise !== undefined) {
344					playPromise.then(_ => {
345						el.pause();
346					}).catch();
347				}
348			});
349		}
350
351		Module.playerAutoPlay = function () {
352			const self = this;
353			const items = $('.is-autoplay');
354			const nonResIframe = $('.entry-content > iframe');
355
356			if (items != null && items.length > 0) {
357				items.each(function () {
358					const el = $(this);
359					if (!el.hasClass('is-loaded')) {
360						self.wPoint['iframe'] = new Waypoint({
361							element: el,
362							handler: function () {
363								const iframe = el.find('iframe');
364								self.initAutoPlay(iframe);
365								el.addClass('is-loaded');
366								this.destroy();
367							},
368							offset: '60%'
369						});
370					}
371				})
372			}
373
374			if (nonResIframe != null && nonResIframe.length > 0) {
375				nonResIframe.each(function () {
376					const el = $(this);
377					if (!el.hasClass('is-loaded')) {
378						const iURL = el.attr('src');
379						if (iURL.indexOf('youtube.com') > 0 || iURL.indexOf('youtu.be') > 0 || iURL.indexOf('vimeo.com') > 0) {
380							el.wrap('<div class="rb-ires is-loaded"></div>');
381						}
382					}
383				})
384			}
385		}
386
387		Module.initAutoPlay = function (item) {
388			if (item.length > 0 && undefined !== item[0]) {
389				const src = item[0].src;
390				if (src.indexOf('?') > -1) {
391					item[0].src += "&autoplay=1";
392				} else {
393					item[0].src += "?autoplay=1";
394				}
395			}
396		}
397
398		Module.tocToggle = function () {
399			this._document.on('click', '.toc-toggle', function (e) {
400				e.preventDefault();
401				e.stopPropagation();
402
403				const target = $(this);
404				const content = target.parents('.ruby-table-contents').find('.toc-content');
405				content.toggle(200);
406				target.toggleClass('activate');
407			});
408		};
409
410		/** Header JS functions */
411		Module.headerDropdown = function () {
412
413			const self = this;
414			$('.more-trigger').on('click', function (e) {
415
416				e.preventDefault();
417				e.stopPropagation();
418
419				/** re calc menu  */
420				self.calcSubMenuPos();
421
422				const target = $(this);
423				const holder = target.parents('.header-wrap').find('.more-section-outer');
424
425				if (!holder.hasClass('dropdown-activated')) {
426					self._body.find('.dropdown-activated').removeClass('dropdown-activated');
427					holder.addClass('dropdown-activated');
428				} else {
429					holder.removeClass('dropdown-activated');
430				}
431				if (target.hasClass('search-btn')) {
432					setTimeout(function () {
433						holder.find('input[type="text"]').focus()
434					}, 150);
435				}
436
437				return false;
438			});
439
440			/** search trigger */
441			$('.search-trigger').on('click', function (e) {
442				e.preventDefault();
443				e.stopPropagation();
444				const holder = $(this).parent('.header-dropdown-outer');
445				if (!holder.hasClass('dropdown-activated')) {
446					self._body.find('.dropdown-activated').removeClass('dropdown-activated');
447					holder.addClass('dropdown-activated');
448					setTimeout(function () {
449						holder.find('input[type="text"]').focus()
450					}, 150);
451				} else {
452					holder.removeClass('dropdown-activated');
453				}
454				return false;
455			});
456
457			/** header dropdown */
458			$('.dropdown-trigger').on('click', function (e) {
459				e.preventDefault();
460				e.stopPropagation();
461				const holder = $(this).parent('.header-dropdown-outer');
462				if (!holder.hasClass('dropdown-activated')) {
463					self._body.find('.dropdown-activated').removeClass('dropdown-activated');
464					holder.addClass('dropdown-activated');
465				} else {
466					holder.removeClass('dropdown-activated');
467				}
468			});
469		}
470
471		Module.topSpacing = function () {
472			const self = this;
473			if (self._body.hasClass('top-spacing')) {
474				const height = $('.top-site-ad').outerHeight();
475				$('.site-outer').css('margin-top', height);
476			}
477		}
478
479		/** outside click */
480		Module.documentClick = function () {
481
482			const self = this;
483			const wrapper = $('.more-section-outer, .header-dropdown-outer, .mobile-collapse, .mfp-wrap');
484			const inlineSearchForm = $('.is-form-layout');
485
486			document.addEventListener('click', function (e) {
487
488				if (!wrapper.is(e.target) && wrapper.has(e.target).length === 0) {
489					wrapper.removeClass('dropdown-activated');
490					self.outerHTML.removeClass('collapse-activated');
491				}
492
493				if (!inlineSearchForm.is(e.target) && inlineSearchForm.has(e.target).length === 0) {
494					inlineSearchForm.find('.live-search-response').fadeOut(500);
495				}
496			});
497		}
498
499		/** calc mega menu position */
500		Module.initSubMenuPos = function () {
501			const self = this;
502			let trigger = false;
503
504			/** add delay to ensure image loaded */
505			setTimeout(function () {
506				self.calcSubMenuPos();
507			}, 1000);
508
509			/** re calc when hovering */
510			$('.menu-has-child-mega').on('mouseenter', function () {
511				if (!trigger) {
512					self.calcSubMenuPos();
513				}
514				trigger = true;
515			})
516		}
517
518		Module.calcSubMenuPos = function () {
519
520			if (window.outerWidth < 1024) {
521				return false;
522			}
523
524			const self = this;
525			const megaParents = $('.menu-has-child-mega');
526			const headerWrapper = $('#site-header');
527
528			/** for mega wide */
529			if (megaParents.length > 0) {
530				megaParents.each(function () {
531					const item = $(this);
532					item.find('.mega-dropdown').css({
533						'width': self._body.width(),
534						'left': -item.offset().left,
535					});
536					item.addClass('mega-menu-loaded')
537				})
538			}
539
540			/** sub-menu left right direction */
541			if (headerWrapper.length > 0) {
542
543				let headerLeftOffset = headerWrapper.offset().left;
544				let headerWidth = headerWrapper.width();
545				let headerRightOffset = headerLeftOffset + headerWidth;
546
547				const flexDropdown = $('.flex-dropdown');
548
549				/** sub menu direction */
550				const subElements = $('ul.sub-menu');
551				if (subElements.length > 0) {
552					subElements.each(function () {
553						const item = $(this);
554						let itemLeftOffset = item.offset().left;
555						let itemRightOffset = itemLeftOffset + item.width() + 100;
556						if (itemRightOffset > headerRightOffset) {
557							item.addClass('left-direction');
558						}
559					})
560				}
561
562				/** calc dropdown flex width */
563				if (flexDropdown.length > 0) {
564					flexDropdown.each(function () {
565						const item = $(this);
566						const parentItem = item.parent();
567						if (parentItem.hasClass('is-child-wide') || item.hasClass('mega-has-left')) {
568							return;
569						}
570						const itemWidth = item.width();
571						const itemHalfWidth = itemWidth / 2;
572						const parentItemOffset = parentItem.offset().left;
573						const parentHalfWidth = parentItem.width() / 2;
574						const parentItemCenterOffset = parentItemOffset + parentHalfWidth;
575						const rightSpacing = headerRightOffset - parentItemCenterOffset;
576						const leftSpacing = parentItemCenterOffset - headerLeftOffset;
577
578						if (itemWidth >= headerWidth) {
579							item.css({
580								'width': headerWidth - 2,
581								'left': -parentItemOffset
582							});
583						} else if (itemHalfWidth > rightSpacing) {
584							item.css({
585								'right': -rightSpacing + parentHalfWidth + 1,
586								'left': 'auto',
587							});
588						} else if (itemHalfWidth > leftSpacing) {
589							item.css({
590								'left': -leftSpacing + parentHalfWidth + 1,
591								'right': 'auto',
592							});
593						} else {
594							item.css({
595								'right': 'auto',
596								'left': -itemHalfWidth + parentHalfWidth,
597							});
598						}
599					});
600				}
601			}
602		}
603
604		/**
605		 *
606		 * @returns {boolean}
607		 */
608		Module.stickyNavBar = function () {
609
610			const self = this;
611
612			/** turn off sticky on editor mode */
613			if (self._body.hasClass('elementor-editor-active')) {
614				return false;
615			}
616
617			self.sticky.section = $('#sticky-holder');
618			self.sticky.outer = $('#navbar-outer');
619
620			if ((!self._body.hasClass('is-mstick') && !self._body.hasClass('yes-tstick')) || self.sticky.outer.length < 1 || self.sticky.section.length < 1) {
621				return false;
622			}
623
624			self.sticky.smartSticky = !!self._body.hasClass('is-smart-sticky');
625			self.sticky.isSticky = false;
626			self.sticky.lastScroll = 0;
627
628			if (self._body.hasClass('yes-tstick')) {
629				self.sticky.isTitleSticky = true;
630			} else {
631				self.sticky.isTitleSticky = 0;
632			}
633
634			self.sticky.additionalOffset = 200;
635			if (window.innerWidth > 1024) {
636				if (self.sticky.isTitleSticky) {
637					self.sticky.additionalOffset = 450;
638				} else {
639					self.sticky.additionalOffset = 0;
640				}
641			}
642
643			if (self._body.hasClass('admin-bar')) {
644				self.sticky.adminBarSpacing = 32;
645			} else {
646				self.sticky.adminBarSpacing = 0;
647			}
648
649			self.sticky.topOffset = self.sticky.section.offset().top;
650			self.sticky.stickySectionHeight = self.sticky.section.outerHeight();
651
652			self.sticky.outer.css('min-height', self.sticky.outer.outerHeight());
653			self.sticky.activatePos = self.sticky.topOffset + 1 + self.sticky.stickySectionHeight + self.sticky.additionalOffset;
654			self.sticky.deactivePos = self.sticky.topOffset - self.sticky.adminBarSpacing + self.sticky.additionalOffset;
655
656			if (window.addEventListener) {
657				if (self.sticky.smartSticky) {
658					window.addEventListener('scroll', function () {
659						self.animationFrame(self.initSmartStickyNavBar.bind(self));
660					}, false);
661				} else {
662					window.addEventListener('scroll', function () {
663						self.animationFrame(self.initStickyNavBar.bind(self));
664					}, false);
665				}
666			}
667
668			self._window.on('unstickMenu', function () {
669				self.sticky.outer.css('min-height', self.sticky.outer.outerHeight());
670				self.sticky.stickySectionHeight = self.sticky.section.outerHeight();
671				self.sticky.topOffset = self.sticky.section.offset().top;
672				self.sticky.activatePos = self.sticky.topOffset + 1 + self.sticky.stickySectionHeight + self.sticky.additionalOffset;
673				self.sticky.deactivePos = self.sticky.topOffset - self.sticky.adminBarSpacing + self.sticky.additionalOffset;
674			});
675		}
676
677		Module.initStickyNavBar = function () {
678			const self = this;
679			const scroll = self._window.scrollTop();
680
681			if (!self.sticky.isSticky && scroll > self.sticky.activatePos) {
682				self.sticky.isSticky = true;
683				self._body.addClass('stick-animated sticky-on');
684				self.sticky.stickAnimatedTimeout = setTimeout(function () {
685					self._body.removeClass('stick-animated');
686				}, 200);
687			} else if (self.sticky.isSticky && scroll <= self.sticky.deactivePos) {
688				self.sticky.isSticky = false;
689				self._body.removeClass('sticky-on stick-animated');
690				self._window.trigger('unstickMenu');
691			}
692		}
693
694		Module.initSmartStickyNavBar = function () {
695			const self = this;
696			const scroll = self._window.scrollTop();
697
698			if (!self.sticky.isSticky && scroll > self.sticky.activatePos && scroll < self.sticky.lastScroll) {
699				self.sticky.isSticky = true;
700				self._body.addClass('stick-animated sticky-on');
701				self.sticky.stickAnimatedTimeout = setTimeout(function () {
702					self._body.removeClass('stick-animated');
703				}, 200);
704			} else if (self.sticky.isSticky && (scroll <= self.sticky.deactivePos || scroll > self.sticky.lastScroll)) {
705				self.sticky.isSticky = false;
706				self._body.removeClass('sticky-on stick-animated');
707				if (scroll <= self.sticky.deactivePos) {
708					self._window.trigger('unstickESection');
709				}
710			}
711			self.sticky.lastScroll = scroll;
712		}
713
714		/** header sticky template */
715		Module.stickyHeaderBuilder = function () {
716
717			const self = this;
718
719			/** turn off sticky on editor mode */
720			if (self._body.hasClass('elementor-editor-active')) {
721				return false;
722			}
723
724			let stickySection = $('.header-template .e-section-sticky').first();
725			const hasTitleSticky = $('body.single-post #s-title-sticky').first();
726
727			if (stickySection.length < 1) {
728				return false;
729			}
730
731			if (hasTitleSticky.length > 0) {
732				self._body.addClass('yes-tstick');
733				self.eSticky.isTitleSticky = true;
734			} else {
735				self.eSticky.isTitleSticky = 0;
736			}
737
738			self.eSticky.additionalOffset = 200;
739			if (window.innerWidth > 1024) {
740				if (self.eSticky.isTitleSticky) {
741					self.eSticky.additionalOffset = 450;
742				} else {
743					self.eSticky.additionalOffset = 0;
744				}
745			}
746
747			self.eSticky.smartSticky = !!stickySection.hasClass('is-smart-sticky');
748
749			/** mobile sticky for header template */
750			if (window.innerWidth <= 1024) {
751				stickySection.removeClass('e-section-sticky');
752				stickySection = $('#header-template-holder').addClass('e-section-sticky');
753			}
754
755			self.eSticky.section = stickySection;
756			self.eSticky.outer = stickySection.parent();
757
758			self.eSticky.adminBarSpacing = 0;
759			self.eSticky.isSticky = false;
760			self.eSticky.lastScroll = 0;
761			self.eSticky.stickySectionHeight = stickySection.outerHeight();
762			self.eSticky.topOffset = stickySection.offset().top;
763
764			/** set min height */
765			if (self._body.hasClass('admin-bar')) {
766				self.eSticky.adminBarSpacing = 32;
767			}
768			self.eSticky.outer.css('min-height', self.eSticky.outer.outerHeight());
769			self.eSticky.activatePos = self.eSticky.topOffset + 1 + self.eSticky.stickySectionHeight + self.eSticky.additionalOffset;
770			self.eSticky.deactivePos = self.eSticky.topOffset - self.eSticky.adminBarSpacing + self.eSticky.additionalOffset;
771
772			if (window.addEventListener) {
773				if (self.eSticky.smartSticky) {
774					window.addEventListener('scroll', function () {
775						self.animationFrame(self.initSmartStickyESection.bind(self));
776					}, false);
777				} else {
778					window.addEventListener('scroll', function () {
779						self.animationFrame(self.initStickyESection.bind(self));
780					}, false);
781				}
782			}
783
784			/** re-calc height values */
785			self._window.on('unstickESection', function () {
786				self.eSticky.outer.css('min-height', self.eSticky.outer.outerHeight());
787				self.eSticky.stickySectionHeight = self.eSticky.section.outerHeight();
788				self.eSticky.topOffset = self.eSticky.section.offset().top;
789				self.eSticky.activatePos = self.eSticky.topOffset + 1 + self.eSticky.stickySectionHeight + self.eSticky.additionalOffset;
790				self.eSticky.deactivePos = self.eSticky.topOffset - self.eSticky.adminBarSpacing + self.eSticky.additionalOffset;
791			});
792		}
793
794		Module.initStickyESection = function () {
795			const self = this;
796			const scroll = self._window.scrollTop();
797			if (!self.eSticky.isSticky && scroll > self.eSticky.activatePos) {
798				self.eSticky.isSticky = true;
799				self._body.addClass('stick-animated sticky-on');
800				self.eSticky.stickAnimatedTimeout = setTimeout(function () {
801					self._body.removeClass('stick-animated');
802				}, 200);
803			} else if (self.eSticky.isSticky && scroll <= self.eSticky.deactivePos) {
804				self.eSticky.isSticky = false;
805				self._body.removeClass('sticky-on stick-animated');
806				self._window.trigger('unstickESection');
807			}
808		}
809
810		Module.initSmartStickyESection = function () {
811			const self = this;
812			const scroll = self._window.scrollTop();
813
814			if (!self.eSticky.isSticky && scroll > self.eSticky.activatePos && scroll < self.eSticky.lastScroll) {
815				self.eSticky.isSticky = true;
816				self._body.addClass('stick-animated sticky-on');
817				self.eSticky.stickAnimatedTimeout = setTimeout(function () {
818					self._body.removeClass('stick-animated');
819				}, 200);
820			} else if (self.eSticky.isSticky && (scroll <= self.eSticky.deactivePos || scroll > self.eSticky.lastScroll)) {
821				self.eSticky.isSticky = false;
822				self._body.removeClass('sticky-on stick-animated');
823				if (scroll <= self.eSticky.deactivePos) {
824					self._window.trigger('unstickESection');
825				}
826			}
827
828			self.eSticky.lastScroll = scroll;
829		}
830
831		/** mobileCollapse */
832		Module.mobileCollapse = function () {
833			const self = this;
834			const $mobileMenuTrigger = $('.mobile-menu-trigger');
835			const $outerHTML = self.outerHTML;
836			const $mobileSearchForm = $outerHTML.find('.mobile-search-form input[type="text"]');
837
838			$mobileMenuTrigger.on('click', function (e) {
839				e.preventDefault();
840				e.stopPropagation();
841				const target = $(this);
842
843				if (target.hasClass('mobile-search-icon')) {
844					setTimeout(function () {
845						$mobileSearchForm.focus();
846					}, 100);
847				}
848
849				const isCollapseActivated = $outerHTML.hasClass('collapse-activated');
850				$outerHTML.toggleClass('collapse-activated', !isCollapseActivated);
851			});
852		}
853
854		/**
855		 * privacy trigger
856		 */
857		Module.privacyTrigger = function () {
858			const self = this;
859			$('#privacy-trigger').on('click', function (e) {
860				e.preventDefault();
861				e.stopPropagation();
862				self.setStorage('RubyPrivacyAllowed', '1');
863				$('#rb-privacy').slideUp(200, function () {
864					$(this).remove();
865				});
866				return false;
867			});
868		}
869
870		/** back top */
871		Module.backTop = function () {
872			if (this._body.hasClass('is-backtop')) {
873				$().UItoTop({
874					text: '<i class="rbi rbi-darrow-top"></i>',
875				});
876			}
877		}
878
879		/** login popup */
880		Module.loginPopup = function () {
881			const form = $('#rb-user-popup-form');
882			if (form.length < 1) {
883				return false;
884			}
885			this._document.on('click', '.login-toggle', (e) => {
886				e.preventDefault();
887				e.stopPropagation();
888				$.magnificPopup.open({
889					type: 'inline',
890					preloader: false,
891					removalDelay: 400,
892					showCloseBtn: true,
893					closeBtnInside: true,
894					closeOnBgClick: false,
895					items: {
896						src: form,
897						type: 'inline'
898					},
899					mainClass: 'rb-popup-center',
900					closeMarkup: '<span class="close-popup-btn mfp-close"><span class="close-icon"></span></span>',
901					fixedBgPos: true,
902					fixedContentPos: true,
903					callbacks: {
904						open: function () {
905							// Reset Turnstile or reCAPTCHA if initialized
906							if (typeof turnstile !== 'undefined') {
907								try {
908									turnstile.reset();
909								} catch (e) {}
910							} else if (typeof grecaptcha !== 'undefined') {
911								try {
912									grecaptcha.reset();
913								} catch (e) {}
914							}
915						}
916
917					}
918				});
919			});
920		};
921
922		/** popup template blocks */
923		Module.popupTemplate = function () {
924
925			const templateCache = {};
926			this._document.on('click', '.popup-trigger-btn', (e) => {
927
928				e.preventDefault();
929				e.stopPropagation();
930
931				const target = $(e.target);
932				const templateID = target.data('trigger') || '';
933				const position = target.data('position') || '';
934
935				if (!templateCache[templateID]) {
936					const template = $(`#tmpl-${templateID}`);
937					if (template.length === 0) {
938						return;
939					}
940					templateCache[templateID] = template.html();
941				}
942				$.magnificPopup.open({
943					type: 'inline',
944					preloader: false,
945					removalDelay: 400,
946					showCloseBtn: true,
947					closeBtnInside: true,
948					closeOnBgClick: true,
949					allowHTMLInTemplate: true,
950					items: {
951						src: templateCache[templateID],
952						type: 'inline'
953					},
954					mainClass: `is-template-popup popup-${templateID} ${position}`,
955					closeMarkup: '<span class="close-popup-btn mfp-close"><span class="close-icon"></span></span>',
956					fixedBgPos: true,
957					fixedContentPos: true
958				});
959			});
960		};
961
962		/** newsletter */
963		Module.popupNewsletter = function () {
964
965			const self = this;
966			if (self.popupNewsletterEl.length > 0) {
967				const display = self.popupNewsletterEl.data('display');
968				self.newsletterExpired = self.popupNewsletterEl.data('expired');
969				self.newsletterDisplayOffset = self.popupNewsletterEl.data('offset');
970				const delay = self.popupNewsletterEl.data('delay');
971				const oldExpired = self.getStorage('RubyNewsletterExpired');
972
973				if (self.newsletterExpired === 0) {
974					self.deleteStorage('RubyNewsletter');
975				}
976
977				if (!oldExpired || self.newsletterExpired !== oldExpired) {
978					self.setStorage('RubyNewsletterExpired', self.newsletterExpired);
979					self.deleteStorage('RubyNewsletter');
980				}
981
982				if (!self.getTTLStorage('RubyNewsletter')) {
983					if (!display || 'scroll' === display) {
984						if (window.addEventListener) {
985							window.addEventListener('scroll', function () {
986								self.animationFrame(self.scrollPopupNewsletter.bind(self));
987							}, false);
988						}
989					} else {
990						setTimeout(function () {
991							self.popupNewsletterInit();
992						}, delay);
993					}
994				}
995			}
996		}
997
998		Module.scrollPopupNewsletter = function () {
999			const self = this;
1000			if (!self.newsletterPopupFlag && self._window.scrollTop() > self.newsletterDisplayOffset) {
1001				self.newsletterPopupFlag = true;
1002				self.popupNewsletterInit();
1003			}
1004		}
1005
1006		Module.popupNewsletterInit = function () {
1007
1008			const self = this;
1009			if (self.siteAccessFlag) { return; }
1010
1011			if (!self.popupNewsletterEl.hasClass('is-pos-fixed')) {
1012				$.magnificPopup.open({
1013					type: 'inline',
1014					preloader: false,
1015					closeBtnInside: true,
1016					removalDelay: 400,
1017					showCloseBtn: true,
1018					closeOnBgClick: false,
1019					disableOn: 1024,
1020					items: {
1021						src: '#rb-popup-newsletter',
1022						type: 'inline'
1023					},
1024					mainClass: 'rb-popup-center',
1025					fixedBgPos: true,
1026					fixedContentPos: true,
1027					closeMarkup: '<span class="close-popup-btn mfp-close"><span class="close-icon"></span></span>',
1028					callbacks: {
1029						close: function () {
1030							if (self.siteAccessFlag) {
1031								return;
1032							}
1033							self.SetTTLStorage('RubyNewsletter', 1, self.newsletterExpired * 24);
1034						}
1035					}
1036				});
1037			} else {
1038				self.popupNewsletterEl.removeClass('is-hidden');
1039				setTimeout(() => {
1040					self.popupNewsletterEl.addClass('yes-show');
1041				}, 10);
1042				const closeBtn = self.popupNewsletterEl.find('.close-popup-btn');
1043				closeBtn.on('click', function () {
1044					self.SetTTLStorage('RubyNewsletter', 1, self.newsletterExpired * 24);
1045					self.popupNewsletterEl.removeClass('yes-show');
1046					setTimeout(() => {
1047						self.popupNewsletterEl.addClass('is-hidden');
1048					}, 400);
1049				});
1050			}
1051		}
1052
1053		/** footer slide up */
1054		Module.footerSlideUp = function () {
1055			const target = $('#footer-slideup');
1056			if (target.length > 0) {
1057				const self = this;
1058				self.footerSlideUpExpired = target.data('expired');
1059				const delay = target.data('delay');
1060				const oldExpired = self.getStorage('footerSlideUpExpired');
1061				if (!oldExpired || self.footerSlideUpExpired != oldExpired) {
1062					self.setStorage('footerSlideUpExpired', self.footerSlideUpExpired);
1063					self.deleteStorage('footerSlideUp');
1064				}
1065				if (!self.getTTLStorage('footerSlideUp')) {
1066					setTimeout(function () {
1067						self.footerSlideUpInit();
1068					}, delay);
1069				}
1070				/** show hide toggle */
1071				setTimeout(function () {
1072					self.footerSlideUpToggle();
1073				}, delay);
1074			}
1075		}
1076
1077		Module.footerSlideUpToggle = function () {
1078			const self = this;
1079			$('.slideup-toggle').off('click').on('click', function (e) {
1080				e.preventDefault();
1081				e.stopPropagation();
1082				self.footerSlideUpInit();
1083				return false;
1084			});
1085		}
1086
1087		Module.footerSlideUpInit = function () {
1088			if (this._body.hasClass('yes-f-slideup')) {
1089				this._body.removeClass('yes-f-slideup');
1090				this.SetTTLStorage('footerSlideUp', 1, this.footerSlideUpExpired * 24);
1091			} else {
1092				this._body.addClass('yes-f-slideup');
1093				this.deleteStorage('footerSlideUp');
1094			}
1095		}
1096
1097		/** youtube iframe */
1098		Module.loadYoutubeIframe = function () {
1099
1100			const self = this;
1101			const blockPlaylist = $('.yt-playlist');
1102			if (blockPlaylist.length > 0) {
1103				const tag = document.createElement('script');
1104				tag.src = "//www.youtube.com/iframe_api";
1105				const firstScriptTag = document.getElementsByTagName('script')[0];
1106				firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
1107			}
1108
1109			window.onYouTubeIframeAPIReady = function () {
1110				$('.yt-playlist').each(function () {
1111					const target = $(this);
1112					const iframe = target.find('.yt-player');
1113					const videoID = target.data('id');
1114					const blockID = target.data('block');
1115					self.YTPlayers[blockID] = new YT.Player(iframe.get(0), {
1116						height: '540',
1117						width: '960',
1118						videoId: videoID,
1119						events: {
1120							'onReady': self.videoPlayToggle,
1121							'onStateChange': self.videoPlayToggle
1122						}
1123					});
1124				});
1125
1126				$('.plist-item').on('click', function (e) {
1127					e.preventDefault();
1128					e.stopPropagation();
1129
1130					const target = $(this);
1131					const wrapper = target.closest('.yt-playlist');
1132					const currentBlockID = wrapper.data('block');
1133					const videoID = target.data('id');
1134					const title = target.find('.plist-item-title').text();
1135					const meta = target.data('index');
1136
1137					Object.keys(self.YTPlayers).forEach(function (id) {
1138						self.YTPlayers[id].pauseVideo();
1139					});
1140					self.YTPlayers[currentBlockID].loadVideoById({
1141						'videoId': videoID
1142					});
1143
1144					wrapper.find('.yt-trigger').addClass('is-playing');
1145					wrapper.find('.play-title').hide().text(title).fadeIn(200);
1146					wrapper.find('.video-index').text(meta);
1147				});
1148			}
1149		}
1150
1151		Module.videoPlayToggle = function () {
1152
1153			const players = FOXIZ_MAIN_SCRIPT.YTPlayers;
1154
1155			$('.yt-trigger').on('click', function (e) {
1156				e.preventDefault();
1157				e.stopPropagation();
1158
1159				const target = $(this);
1160				const currentBlockID = target.closest('.yt-playlist').data('block');
1161				const currentState = players[currentBlockID].getPlayerState();
1162				const isPlaying = [1, 3].includes(currentState);
1163				if (!isPlaying) {
1164					players[currentBlockID].playVideo();
1165					target.addClass('is-playing');
1166				} else {
1167					players[currentBlockID].pauseVideo();
1168					target.removeClass('is-playing');
1169				}
1170			});
1171		}
1172
1173		/** Comment scripts */
1174		Module.showPostComment = function () {
1175			const self = this;
1176
1177			this._document.on('click', '.smeta-sec .meta-comment', function (e) {
1178				e.stopPropagation();
1179				const commentBtn = $('.show-post-comment');
1180				if (commentBtn.length > 0) {
1181					self.html.animate({scrollTop: commentBtn.offset().top}, 300);
1182					commentBtn.trigger('click');
1183				}
1184			});
1185
1186			this._document.on('click', '.show-post-comment', function (e) {
1187				e.preventDefault();
1188				e.stopPropagation();
1189				const target = $(this);
1190				const wrap = target.parent();
1191
1192				target.fadeOut(200, function () {
1193					target.remove();
1194					wrap.find('.is-invisible').removeClass('is-invisible');
1195					wrap.next('.comment-holder').removeClass('is-hidden');
1196				})
1197			});
1198		}
1199
1200		/** table scroll */
1201		Module.scrollTableContent = function () {
1202			const self = this;
1203			$('.anchor-link').on('click', function (e) {
1204				e.stopPropagation();
1205				const target = $(this).data('index');
1206				const targetElement = $('.' + target);
1207				const scrollElement = targetElement.length > 0 ? targetElement : $('.restrict-box');
1208				if (scrollElement.length > 0) {
1209					self.html.animate({
1210						scrollTop: scrollElement.offset().top - 150
1211					}, 400);
1212				}
1213			});
1214		}
1215
1216		/** scroll to comment  */
1217		Module.scrollToComment = function () {
1218			const self = this;
1219			const hash = window.location.hash;
1220			if (hash === '#respond' || hash.startsWith('#comment')) {
1221				const commentBtn = $('.show-post-comment').first();
1222				if (commentBtn.length === 0) {
1223					return;
1224				}
1225				self.html.animate({scrollTop: commentBtn.offset().top - 200}, 400);
1226				commentBtn.trigger('click');
1227			}
1228		}
1229
1230		Module.replyReview = function () {
1231			this._document.on('click', '.comment-reply-link', function () {
1232				const target = $(this);
1233				const wrapper = target.parents('.rb-reviews-area');
1234				const cancelLink = $('#cancel-comment-reply-link');
1235				if (wrapper.length > 0) {
1236					wrapper.find('.rb-form-rating').addClass('is-hidden');
1237					cancelLink.on('click', function () {
1238						wrapper.find('.rb-form-rating').removeClass('is-hidden');
1239					});
1240				}
1241			});
1242		}
1243
1244		/** user rating */
1245		Module.usersRating = function () {
1246			const self = this;
1247			const reviewsForm = self._body.find('.rb-reviews-form');
1248			if (reviewsForm.length > 0) {
1249				reviewsForm.each(function () {
1250					const reviewForm = $(this);
1251					if (!reviewForm.hasClass('is-loaded')) {
1252						reviewForm.addClass('is-loaded');
1253						const ratingForm = reviewForm.find('.rb-form-rating');
1254						const selection = reviewForm.find('.rb-rating-selection');
1255						const text = reviewForm.find('.rating-alert').html();
1256						let ratingValue = null;
1257
1258						selection.val('');
1259						selection.hide();
1260						selection.before(
1261							'<div class="rb-review-stars">\
1262								<span>\
1263									<a class="star" data-rating="1" href="#"><i class="rbi rbi-star-o"></i></a>\
1264									<a class="star" data-rating="2" href="#"><i class="rbi rbi-star-o"></i></a>\
1265									<a class="star" data-rating="3" href="#"><i class="rbi rbi-star-o"></i></a>\
1266									<a class="star" data-rating="4" href="#"><i class="rbi rbi-star-o"></i></a>\
1267									<a class="star" data-rating="5" href="#"><i class="rbi rbi-star-o"></i></a>\
1268								</span>\
1269							</div>'
1270						);
1271
1272						ratingForm.on('click', 'a.star', function (e) {
1273							e.preventDefault();
1274							e.stopPropagation();
1275							const star = $(this);
1276							ratingValue = star.data('rating');
1277							star.siblings('a').removeClass('active');
1278							star.addClass('active');
1279							ratingForm.addClass('selected');
1280						});
1281
1282						reviewForm.on('click', '#respond #submit', function () {
1283							selection.val(ratingValue);
1284							if (!selection.val()) {
1285								window.alert(text);
1286								return false;
1287							}
1288						});
1289					}
1290				});
1291			}
1292		}
1293
1294		/**
1295		 *
1296		 * @returns {boolean}
1297		 */
1298		Module.readIndicatorInit = function () {
1299
1300			const self = this;
1301			if (!self._body.hasClass('single') || self.readIndicator.length < 1) {
1302				return false;
1303			}
1304
1305			let content = $('.entry-content').first();
1306			if (!content.length) return false;
1307
1308			self.indicatorTop = content.offset().top;
1309			self.indicatorHeight = content.outerHeight(true) - self._window.height();
1310			/** delay for load images */
1311			setTimeout(function () {
1312				self.indicatorTop = content.offset().top;
1313				self.indicatorHeight = content.outerHeight(true) - self._window.height();
1314			}, 1000)
1315
1316			if (window.addEventListener) {
1317				window.addEventListener('scroll', function () {
1318					self.animationFrame(self.readIndicatorCalc.bind(self));
1319				}, false);
1320			}
1321		}
1322
1323		Module.readIndicatorCalc = function () {
1324			const self = this;
1325			const scroll = self._window.scrollTop();
1326			self.readIndicatorPercent = Math.min(((scroll - self.indicatorTop) / self.indicatorHeight) * 100, 100);
1327			if (self.readIndicatorPercent <= 100) {
1328				self.readIndicator.css('width', self.readIndicatorPercent + '%');
1329			}
1330		}
1331
1332		/** breaking news */
1333		Module.breakingNews = function () {
1334			const self = this;
1335			const breakingNews = $('.breaking-news-slider')
1336
1337			if (breakingNews.length < 1) {
1338				return false;
1339			}
1340
1341			breakingNews.each(function () {
1342				const el = $(this);
1343				let params = {
1344					slidesPerView: 1,
1345					loop: true,
1346				}
1347				if (el.data('play')) {
1348					params.autoplay = {
1349						delay: self.themeSettings.sliderSpeed,
1350						pauseOnMouseEnter: true,
1351						stopOnLastSlide: true,
1352						disableOnInteraction: true,
1353					}
1354					if (el.data('speed')) {
1355						params.autoplay.delay = el.data('speed');
1356					}
1357				}
1358				if ('undefined' !== typeof self.isElementorEditor) {
1359					delete params.autoplay;
1360				}
1361				params.navigation = {
1362					nextEl: el.find('.breaking-news-next')[0],
1363					prevEl: el.find('.breaking-news-prev')[0]
1364				}
1365				new RBSwiper(this, params);
1366			});
1367		}
1368
1369		/** overlay slider */
1370		Module.sliders = function () {
1371
1372			const self = this;
1373			const sliders = $('.post-slider');
1374			if (sliders.length < 1) {
1375				return false;
1376			}
1377
1378			sliders.each(function () {
1379				const slider = $(this);
1380				let params = {
1381					grabCursor: true,
1382					allowTouchMove: true,
1383					effect: self.themeSettings.sliderEffect,
1384					loop: true,
1385				}
1386				if (slider.data('play')) {
1387					params.autoplay = {
1388						delay: self.themeSettings.sliderSpeed,
1389						pauseOnMouseEnter: true,
1390						stopOnLastSlide: true,
1391						disableOnInteraction: true,
1392					}
1393					if (slider.data('speed')) {
1394						params.autoplay.delay = slider.data('speed');
1395					}
1396				}
1397				if ('undefined' !== typeof self.isElementorEditor) {
1398					delete params.autoplay;
1399				}
1400				params.pagination = {
1401					el: slider.find('.slider-pagination')[0],
1402					clickable: true,
1403				};
1404
1405				params.navigation = {
1406					nextEl: slider.find('.slider-next')[0],
1407					prevEl: slider.find('.slider-prev')[0]
1408				}
1409				new RBSwiper(this, params);
1410			});
1411		}
1412
1413		/** carousel blocks */
1414		Module.carousels = function () {
1415			const self = this;
1416			const carousels = $('.post-carousel');
1417			if (carousels.length < 1) {
1418				return false;
1419			}
1420			carousels.each(function () {
1421				const carousel = $(this);
1422				let params = {
1423					grabCursor: true,
1424					allowTouchMove: true,
1425					freeMode: false,
1426					loop: true
1427				}
1428				params.slidesPerView = carousel.data('mcol');
1429				params.spaceBetween = carousel.data('mgap');
1430				params.centeredSlides = carousel.data('centered');
1431
1432				params.navigation = {
1433					nextEl: carousel.find('.slider-next')[0],
1434					prevEl: carousel.find('.slider-prev')[0]
1435				}
1436				if (carousel.find('.slider-pagination')[0]) {
1437					params.pagination = {
1438						el: carousel.find('.slider-pagination')[0],
1439						type: 'bullets',
1440						clickable: true,
1441					};
1442				}
1443				if (carousel.data('play')) {
1444					params.autoplay = {
1445						delay: self.themeSettings.sliderSpeed,
1446						pauseOnMouseEnter: true,
1447						stopOnLastSlide: true,
1448						disableOnInteraction: true,
1449					}
1450
1451					if (carousel.data('speed')) {
1452						params.autoplay.delay = carousel.data('speed');
1453					}
1454				}
1455				if ('undefined' !== typeof self.isElementorEditor) {
1456					delete params.autoplay;
1457				}
1458				if (carousel.data('fmode')) {
1459					params.freeMode = true;
1460				}
1461				params.breakpoints = {
1462					768: {
1463						slidesPerView: carousel.data('tcol'),
1464						spaceBetween: carousel.data('tgap')
1465					},
1466					1025: {
1467						slidesPerView: carousel.data('col'),
1468						spaceBetween: carousel.data('gap')
1469					},
1470					1500: {
1471						slidesPerView: carousel.data('wcol'),
1472						spaceBetween: carousel.data('gap')
1473					}
1474				};
1475				params.on = {
1476					afterInit: function (swiper) {
1477						const wrap = $(swiper.$wrapperEl);
1478						$(swiper.$wrapperEl).find('.p-box').css('height', wrap.height());
1479					},
1480					resize: function (swiper) {
1481						const wrap = $(swiper.$wrapperEl);
1482						$(swiper.$wrapperEl).find('.p-box').css('height', wrap.height());
1483					},
1484				};
1485
1486				new RBSwiper(this, params);
1487			});
1488		}
1489
1490		/* ================================ SINGLE GALLERY ================================ */
1491		Module.singleGallery = function () {
1492			const self = this;
1493			const gallerySections = self._body.find('.featured-gallery-wrap');
1494			if (gallerySections.length === 0) {
1495				return;
1496			}
1497
1498			gallerySections.each(function () {
1499				const section = $(this);
1500				if (!section.hasClass('is-loaded')) {
1501					const index = section.data('gallery');
1502					const sliderEl = section.find('.gallery-slider').attr('id');
1503					const sliderNavEl = section.find('.gallery-slider-nav').attr('id');
1504					const carouselEl = section.find('.gallery-carousel').attr('id');
1505					const coverflowEL = section.find('.gallery-coverflow').attr('id');
1506
1507					if ('undefined' !== typeof sliderEl && 'undefined' !== typeof sliderNavEl) {
1508						const galleryNav = new RBSwiper('#' + sliderNavEl, {
1509							spaceBetween: 15,
1510							slidesPerView: 6,
1511							freeMode: self.themeSettings.sliderFMode,
1512							grabCursor: true,
1513							loop: true,
1514							watchSlidesVisibility: true,
1515							watchSlidesProgress: true,
1516							on: {
1517								init: function () {
1518									$(this.$wrapperEl).removeClass('pre-load');
1519								},
1520							},
1521						});
1522
1523						const gallerySlider = new RBSwiper('#' + sliderEl, {
1524							spaceBetween: 0,
1525							grabCursor: true,
1526							loop: true,
1527							pagination: {
1528								el: '.swiper-pagination-' + index,
1529								type: 'progressbar',
1530								clickable: true,
1531							},
1532							on: {
1533								init: function () {
1534									section.addClass('is-loaded');
1535								},
1536							},
1537							thumbs: {
1538								swiper: galleryNav
1539							}
1540						});
1541
1542						gallerySlider.on('slideChange', function () {
1543							const index = this.activeIndex;
1544							if (index) {
1545								const label = $(this.$el).next().find('.current-slider-count');
1546								label.fadeOut(0, function () {
1547									$(this).html(index <= label.data('total') ? index : 1).fadeIn(50);
1548								});
1549							}
1550						});
1551					}
1552
1553					if ('undefined' !== typeof carouselEl) {
1554						new RBSwiper('#' + carouselEl, {
1555							spaceBetween: 20,
1556							slidesPerView: 'auto',
1557							freeMode: self.themeSettings.sliderFMode,
1558							loop: false,
1559							grabCursor: true,
1560							scrollbar: {
1561								el: '.swiper-scrollbar-' + index,
1562								hide: true,
1563							},
1564							on: {
1565								init: function () {
1566									$(this.$wrapperEl).removeClass('pre-load');
1567									section.addClass('is-loaded');
1568								},
1569							},
1570						});
1571					}
1572
1573					if ('undefined' !== typeof coverflowEL) {
1574						new RBSwiper('#' + coverflowEL, {
1575							effect: "coverflow",
1576							grabCursor: true,
1577							centeredSlides: true,
1578							slidesPerView: 1.2,
1579							coverflowEffect: {
1580								rotate: 50,
1581								stretch: 0,
1582								depth: 250,
1583								modifier: 1,
1584								slideShadows: true,
1585							},
1586							breakpoints: {
1587								768: {
1588									slidesPerView: 3
1589								}
1590							},
1591							on: {
1592								init: function () {
1593									$(this.$wrapperEl).removeClass('pre-load');
1594									section.addClass('is-loaded');
1595								},
1596							},
1597							pagination: {
1598								el: '.swiper-pagination-' + index,
1599								clickable: true,
1600							},
1601						});
1602					}
1603				}
1604			});
1605		}
1606
1607		Module.highlightShares = function () {
1608
1609			const self = this;
1610
1611			if (!self.themeSettings.highlightShares || (window.matchMedia && window.matchMedia('(pointer: coarse)').matches)) {
1612				return;
1613			}
1614
1615			const config = {
1616				selectableElements: ['.is-highlight-shares'],
1617				twitterUsername: self.themeSettings.twitterName,
1618				facebook: !!self.themeSettings.highlightShareFacebook,
1619				twitter: !!self.themeSettings.highlightShareTwitter
1620			};
1621
1622			const extra = self.themeSettings.highlightShareReddit ? [{
1623				icon: '<i class="rbi rbi-reddit"></i>',
1624				url: 'https://reddit.com/submit?url=PAGE_URL&title=TEXT_SELECTION'
1625			}] : [];
1626
1627			Sharect.config(config).appendCustomShareButtons(extra).init();
1628		}
1629
1630		/**
1631		 *
1632		 * @returns {boolean}
1633		 */
1634		Module.floatingVideo = function () {
1635
1636			const self = this;
1637			const floating = $('.floating-video').not('.is-loaded');
1638
1639			if (floating.length === 0 || window.outerWidth < 1025) {
1640				return false;
1641			}
1642
1643			self.wPoint['Floating'] = new Waypoint({
1644				element: floating,
1645				offset: -floating.height(),
1646				handler: function (direction) {
1647					self._body.find('.floating-video').addClass('is-loaded').removeClass('floating-activated');
1648					self._body.find('.floating-close').remove();
1649					if ('down' == direction) {
1650						this.element.addClass(' floating-activated');
1651						this.element.find('.float-holder').prepend('<a class="floating-close close-popup-btn" href="#"><span class="close-icon"></span></a>');
1652					}
1653				}
1654			});
1655		}
1656
1657		Module.floatingVideoRemove = function () {
1658			const self = this;
1659			self._body.on('click', '.floating-close', function (e) {
1660				e.preventDefault();
1661				e.stopPropagation();
1662				self._body.find('.floating-video').removeClass('floating-activated');
1663				self.wPoint['Floating'].destroy();
1664			})
1665		}
1666
1667		Module.siteAccessDetector = function () {
1668			const self = this;
1669
1670			if (self.themeSettings && self.themeSettings.adDetectorMethod) {
1671				if (self.crwDetect()) {
1672					return false;
1673				}
1674
1675				setTimeout(() => {
1676					if (self.themeSettings.adDetectorMethod == 2) {
1677						self.advanceAdBlockDetector();
1678					} else {
1679						self.basicAdBlockDetector();
1680					}
1681				}, 1500);
1682			}
1683		};
1684
1685		Module.basicAdBlockDetector = function () {
1686
1687			const self = this;
1688			const checktag = $('#rb-checktag');
1689			const placebo = $('.rb-adbanner');
1690
1691			if (checktag.length === 0) {
1692				return false;
1693			}
1694			if (placebo.height() < 1) {
1695				self.siteAccessFlag = true;
1696				$.magnificPopup.close();
1697				setTimeout(() => {
1698					self.siteAccessNotification();
1699				}, 200);
1700			}
1701		};
1702
1703		Module.advanceAdBlockDetector = async function () {
1704			const self = this;
1705			const googleAdUrl = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
1706			const isAdBlocked = await (async () => {
1707				try {
1708					const controller = new AbortController();
1709					const timeoutId = setTimeout(() => controller.abort(), 3000);
1710					await fetch(googleAdUrl, {method: 'HEAD', signal: controller.signal});
1711					clearTimeout(timeoutId);
1712					return false;
1713				} catch (error) {
1714					return true;
1715				}
1716			})();
1717			if (isAdBlocked) {
1718				self.siteAccessFlag = true;
1719				self.siteAccessNotification();
1720			}
1721		};
1722
1723		Module.siteAccessNotification = function () {
1724			$.magnificPopup.open({
1725				type: 'inline',
1726				preloader: false,
1727				showCloseBtn: false,
1728				closeBtnInside: false,
1729				enableEscapeKey: false,
1730				closeOnBgClick: false,
1731				removalDelay: 9999999,
1732				items: {
1733					src: $('#tmpl-rb-site-access').html(),
1734					type: 'inline'
1735				},
1736				mainClass: 'rb-popup-center site-access-popup',
1737				fixedBgPos: true,
1738				fixedContentPos: true,
1739			});
1740
1741			window.addEventListener('contextmenu', event => event.preventDefault());
1742		}
1743
1744		/** build gallery lightbox */
1745		Module.galleryLightbox = function () {
1746
1747			const self = this;
1748			if (!self.galleriesData) {
1749				return;
1750			}
1751
1752			$('.gallery-popup-trigger').on('click', function (e) {
1753				e.preventDefault();
1754				e.stopPropagation();
1755
1756				const target = $(this);
1757				const slideIndex = target.data('index');
1758
1759				$.magnificPopup.open({
1760					type: 'inline',
1761					mainClass: 'rb-gallery-popup rb-popup-center',
1762					closeMarkup: '<button title="%title%" class="mfp-close mfp-button"><i class="rbi rbi-close"></i></button>',
1763					closeOnBgClick: false,
1764					removalDelay: 400,
1765					showCloseBtn: true,
1766					fixedBgPos: true,
1767					fixedContentPos: true,
1768					preloader: false,
1769					gallery: {
1770						enabled: true,
1771						preload: [0, 2],
1772						arrowMarkup: '<button title="%title%" type="button" class="mfp-arrow mfp-button mfp-arrow-%dir%"><i class="rbi rbi-%dir%"></i></button>',
1773						tCounter: '<span>%curr% / %total%</span>'
1774					},
1775					callbacks: {
1776						open: function () {
1777							let itemsArray = Object.values(self.galleriesData);
1778							let targetIndex = itemsArray.findIndex(item => item.key === slideIndex);
1779							if (targetIndex !== -1) {
1780								$.magnificPopup.instance.goTo(targetIndex);
1781							}
1782						},
1783						change: function () {
1784
1785							let imgContainer = $('.gallery-popup-content');
1786							let loader = imgContainer.find('.rb-loader');
1787							let img = imgContainer.find('img');
1788							loader.show();
1789
1790							if (!img.length) {
1791								loader.hide();
1792								return;
1793							}
1794
1795							let loaderTimeout = setTimeout(() => {
1796								loader.fadeIn(200);
1797							}, 300); // Show loader only if image takes longer  300ms
1798
1799							img.on('load', function () {
1800								clearTimeout(loaderTimeout); // Prevent loader from showing if image loads within 300ms
1801								loader.hide();
1802							}).on('error', function () {
1803								clearTimeout(loaderTimeout);
1804								loader.hide();
1805							});
1806						},
1807						afterClose: function () {
1808							$.magnificPopup.instance.popupsCache = {};
1809						},
1810						buildControls: function () {
1811							if (this.arrowLeft && this.arrowRight) {
1812								this.contentContainer.find('.gallery-popup-nav').append(this.arrowLeft.add(this.arrowRight));
1813							}
1814						}
1815					},
1816					inline: {
1817						markup:
1818							'<div class="gallery-popup-header light-scheme">' +
1819							'<div class="mfp-counter"></div><div class="mfp-title h5"></div>' +
1820							'<div class="popup-header-right"><div class="mfp-close"></div></div>' +
1821							'</div><div class="gallery-popup-nav"></div>' +
1822							'<div class="gallery-popup-content"><i class="rb-loader"></i>' +
1823							'<div class="gallery-popup-image mfp-image"></div>' +
1824							'<div class="gallery-popup-entry light-scheme">' +
1825							'<div class="h4 mfp-excerpt"></div>' +
1826							'<div class="description-text mfp-description"></div>' +
1827							'</div>' +
1828							'</div>'
1829					},
1830					items: Object.values(self.galleriesData)
1831				});
1832
1833				return false;
1834			});
1835		};
1836
1837		/** single featured lightbox */
1838		Module.singleFeaturedLightbox = function () {
1839			$('.featured-lightbox-trigger').on('click', function (e) {
1840
1841				e.preventDefault();
1842				e.stopPropagation();
1843
1844				const trigger = $(this);
1845				const source = '<img src="' + trigger.data('source') + '" alt="' + $(this).find('img').attr('alt') + '">';
1846				const caption = trigger.data('caption');
1847				const attribution = trigger.data('attribution');
1848
1849				$.magnificPopup.open({
1850					mainClass: 'rb-popup-center popup-no-overflow',
1851					closeOnBgClick: true,
1852					removalDelay: 400,
1853					showCloseBtn: true,
1854					fixedBgPos: true,
1855					fixedContentPos: true,
1856					preloader: false,
1857					closeMarkup: '<button title="%title%" class="mfp-close rb-popup-close"><i class="rbi rbi-close"></i></button>',
1858					callbacks: {
1859						afterClose: function () {
1860							$.magnificPopup.instance.popupsCache = {};
1861						},
1862					},
1863					inline: {
1864						markup:
1865							'<div class="featured-popup-image"><div class="mfp-source"></div>' +
1866							'<div class="mfp-close rb-popup-close"></div></div>' +
1867							'<div class="gallery-popup-entry light-scheme">' +
1868							'<div class="h4 mfp-excerpt"></div>' +
1869							'<div class="description-text mfp-description"></div>' +
1870							'</div>'
1871					},
1872					items: {
1873						source: source,
1874						excerpt: caption,
1875						description: attribution,
1876					},
1877				});
1878			});
1879		}
1880
1881		/** Ajax pagination */
1882		Module.paginationNextPrev = function () {
1883			const self = this;
1884			self._body.on('click', '.pagination-trigger', function (e) {
1885
1886				e.preventDefault();
1887				e.stopPropagation();
1888				const paginationTrigger = $(this);
1889				if (paginationTrigger.hasClass('is-disable')) {
1890					return;
1891				}
1892
1893				const block = paginationTrigger.parents('.block-wrap');
1894				const uuid = block.attr('id');
1895
1896				if (!self.ajaxData[uuid]) {
1897					self.ajaxData[uuid] = self.getBlockSettings(uuid);
1898				}
1899				if (self.ajaxData[uuid] && self.ajaxData[uuid].processing) {
1900					return;
1901				}
1902				self.ajaxData[uuid].processing = true;
1903				const type = paginationTrigger.data('type');
1904				self.ajaxStartAnimation(block, 'replace');
1905				self.ajaxReplaceLoad(block, uuid, type);
1906			});
1907		}
1908
1909		Module.ajaxReplaceLoad = function (block, uuid, type) {
1910
1911			const self = this;
1912
1913			if (!self.ajaxData[uuid].paged) {
1914				self.ajaxData[uuid].paged = 1;
1915			}
1916			if ('prev' === type) {
1917				self.ajaxData[uuid].page_next = parseInt(self.ajaxData[uuid].paged) - 1;
1918			} else {
1919				self.ajaxData[uuid].page_next = parseInt(self.ajaxData[uuid].paged) + 1;
1920			}
1921
1922			const cacheID = self.cacheData.getCacheID(uuid, self.ajaxData[uuid].page_next);
1923
1924			/** use cache */
1925			if (self.cacheData.exist(cacheID)) {
1926				const cache = self.cacheData.get(cacheID);
1927				if ('undefined' !== typeof cache.paged) {
1928					self.ajaxData[uuid].paged = cache.paged;
1929				}
1930				setTimeout(function () {
1931					self.ajaxRenderHTML(block, uuid, cache, 'replace');
1932				}, 200)
1933
1934			} else {
1935				/** POST AJAX */
1936				$.ajax({
1937					type: 'GET',
1938					url: self.ajaxURL,
1939					data: {
1940						action: 'rblivep',
1941						data: self.ajaxData[uuid]
1942					},
1943					success: function (response) {
1944						response = JSON.parse(JSON.stringify(response));
1945						if ('undefined' !== typeof response.paged) {
1946							self.ajaxData[uuid].paged = response.paged;
1947						}
1948						self.cacheData.set(cacheID, response);
1949						self.ajaxRenderHTML(block, uuid, response, 'replace');
1950					}
1951				});
1952			}
1953		}
1954
1955		Module.paginationLoadMore = function () {
1956			const self = this;
1957			self._body.on('click', '.loadmore-trigger', function (e) {
1958
1959				e.preventDefault();
1960				e.stopPropagation();
1961
1962				const paginationTrigger = $(this);
1963				if (paginationTrigger.hasClass('is-disable')) {
1964					return;
1965				}
1966
1967				const block = paginationTrigger.parents('.block-wrap');
1968				const uuid = block.attr('id');
1969
1970				if (!self.ajaxData[uuid]) {
1971					self.ajaxData[uuid] = self.getBlockSettings(uuid);
1972				}
1973				if (self.ajaxData[uuid] && self.ajaxData[uuid].processing) {
1974					return;
1975				}
1976				self.ajaxData[uuid].processing = true;
1977				self.ajaxStartAnimation(block, 'append');
1978				self.ajaxAppendLoad(block, uuid);
1979			})
1980		}
1981
1982		Module.paginationInfinite = function () {
1983
1984			const self = this;
1985
1986			const infiniteElements = $('.pagination-infinite');
1987			if (infiniteElements.length > 0) {
1988				infiniteElements.each(function () {
1989					const paginationTrigger = $(this);
1990					if (!paginationTrigger.hasClass('is-disable')) {
1991						const block = paginationTrigger.parents('.block-wrap');
1992						if ((block.hasClass('is-hoz-scroll') || block.hasClass('is-mhoz-scroll') || block.hasClass('is-thoz-scroll')) && window.outerWidth < 1024) {
1993							paginationTrigger.addClass('is-disable');
1994							return;
1995						}
1996						const uuid = block.attr('id');
1997						const wPointID = 'infinite' + uuid;
1998						if (!self.ajaxData[uuid]) {
1999							self.ajaxData[uuid] = self.getBlockSettings(uuid);
2000						}
2001						const params = {
2002							element: paginationTrigger,
2003							offset: 'bottom-in-view',
2004							handler: function (direction) {
2005								if (self.ajaxData[uuid] && self.ajaxData[uuid].processing) {
2006									return;
2007								}
2008								if ('down' == direction) {
2009									self.ajaxData[uuid].processing = true;
2010									self.ajaxStartAnimation(block, 'append');
2011									self.ajaxAppendLoad(block, uuid);
2012								}
2013							}
2014						}
2015						self.wPoint[wPointID] = new Waypoint(params);
2016					}
2017				});
2018			}
2019		}
2020
2021		Module.ajaxAppendLoad = function (block, uuid) {
2022			const self = this;
2023			if (!self.ajaxData[uuid].paged) {
2024				self.ajaxData[uuid].paged = 1;
2025			}
2026			if (self.ajaxData[uuid].paged >= self.ajaxData[uuid].page_max) {
2027				return;
2028			}
2029			self.ajaxData[uuid].page_next = parseInt(self.ajaxData[uuid].paged) + 1;
2030			$.ajax({
2031				type: 'GET',
2032				url: self.ajaxURL,
2033				data: {
2034					action: 'rblivep',
2035					data: self.ajaxData[uuid]
2036				},
2037				success: function (response) {
2038					response = JSON.parse(JSON.stringify(response));
2039					if ('undefined' !== typeof response.paged) {
2040						self.ajaxData[uuid].paged = response.paged;
2041					}
2042					if ('undefined' !== typeof response.notice) {
2043						response.content = response.content + response.notice;
2044					}
2045					self.ajaxRenderHTML(block, uuid, response, 'append');
2046				}
2047			});
2048		}
2049
2050		Module.liveSearch = function () {
2051
2052			const liveSearch = $('.live-search-form');
2053			if (liveSearch.length === 0) {
2054				return;
2055			}
2056
2057			const self = this;
2058
2059			liveSearch.each(function () {
2060				const liveSearchEl = $(this);
2061				const input = liveSearchEl.find('input[type="text"]');
2062				const responseWrap = liveSearchEl.find('.live-search-response');
2063				const animation = liveSearchEl.find('.live-search-animation');
2064				const limit = liveSearchEl.data('limit');
2065				const search = liveSearchEl.data('search');
2066				const follow = liveSearchEl.data('follow');
2067				const tax = liveSearchEl.data('tax');
2068				const dsource = liveSearchEl.data('dsource');
2069				const ptype = liveSearchEl.data('ptype');
2070
2071				input.attr('autocomplete', 'off');
2072
2073				input.on('focus', function () {
2074					const param = $(this).val();
2075					if (param && !responseWrap.is(':empty')) {
2076						responseWrap.css('height', 'auto').fadeIn(200);
2077					}
2078				});
2079
2080				const delay = (function () {
2081					let timer = 0;
2082					return function (callback, ms) {
2083						clearTimeout(timer);
2084						timer = setTimeout(callback, ms);
2085					};
2086				})();
2087
2088				input.keyup(function () {
2089					const param = $(this).val();
2090					delay(function () {
2091						if (param) {
2092							liveSearchEl.addClass('search-loading');
2093							setTimeout(function () {
2094								animation.fadeIn(100);
2095							}, 120);
2096
2097							$.ajax({
2098								type: 'GET',
2099								url: self.ajaxURL,
2100								data: {
2101									action: 'rbsearch',
2102									s: param,
2103									limit: limit,
2104									search: search,
2105									follow: follow,
2106									tax: tax,
2107									dsource: dsource,
2108									ptype: ptype,
2109								},
2110								success: function (data) {
2111									data = $.parseJSON(JSON.stringify(data));
2112									animation.fadeOut(200);
2113									setTimeout(function () {
2114										liveSearchEl.removeClass('search-loading');
2115									}, 200);
2116									responseWrap.hide().empty().css('height', responseWrap.height());
2117									responseWrap.html(data);
2118									if ('category' === search && follow && typeof FOXIZ_PERSONALIZE !== 'undefined') {
2119										FOXIZ_PERSONALIZE.syncLayoutCategories();
2120									}
2121									responseWrap.css('height', 'auto').fadeIn(200);
2122								}
2123							});
2124						} else {
2125							responseWrap.fadeOut(200, function () {
2126								responseWrap.empty().css('height', 'auto');
2127							});
2128						}
2129					}, 300);
2130				})
2131			});
2132		}
2133
2134		/** personalized block */
2135		Module.personalizeBlocks = function () {
2136			const self = this;
2137			const elements = $('.is-ajax-block');
2138			if (elements.length > 0) {
2139				const blockRequests = elements.map(function () {
2140					const block = $(this);
2141					const uuid = block.attr('id');
2142					if (!self.ajaxData[uuid]) {
2143						self.ajaxData[uuid] = self.getBlockSettings(uuid);
2144					}
2145
2146					if (self.ajaxData[uuid].content_source &&
2147						self.ajaxData[uuid].content_source === 'recommended' &&
2148						typeof foxizQueriedIDs !== 'undefined' && foxizQueriedIDs.data
2149					) {
2150						self.ajaxData[uuid].post_not_in = foxizQueriedIDs.data;
2151					}
2152
2153					self.ajaxData[uuid].uID = self.getStorage('RBUUID', '0');
2154
2155					return $.ajax({
2156						type: 'GET',
2157						url: self.ajaxURL,
2158						data: {
2159							action: 'rbpersonalizeb',
2160							data: self.ajaxData[uuid]
2161						}
2162					});
2163				});
2164
2165				Promise.all(blockRequests).then(responses => {
2166					responses.forEach((response, index) => {
2167						const block = $(elements[index]);
2168						block.html(response).fadeIn(200);
2169						block.dequeue();
2170					});
2171					self.reloadBlockFunc();
2172				});
2173			}
2174		};
2175
2176		/** personalized categories */
2177		Module.personalizeCategories = function () {
2178
2179			const self = this;
2180			const elements = $('.is-ajax-categories');
2181			if (elements.length > 0) {
2182				const categoryRequests = elements.map(function () {
2183					const block = $(this);
2184					const uuid = block.attr('id');
2185					if (!self.ajaxData[uuid]) {
2186						self.ajaxData[uuid] = self.getBlockSettings(uuid);
2187					}
2188					return $.ajax({
2189						type: 'GET',
2190						url: self.ajaxURL,
2191						data: {
2192							action: 'rbpersonalizecat',
2193							data: self.ajaxData[uuid]
2194						}
2195					});
2196				});
2197
2198				Promise.all(categoryRequests).then(responses => {
2199					responses.forEach((response, index) => {
2200						const block = $(elements[index]);
2201						block.html(response).fadeIn(200);
2202						block.dequeue();
2203					});
2204
2205					if (typeof FOXIZ_PERSONALIZE !== 'undefined') {
2206						FOXIZ_PERSONALIZE.syncLayoutCategories();
2207					}
2208					self.reloadBlockFunc();
2209				});
2210			}
2211		};
2212
2213		Module.readingCollect = function () {
2214			const self = this;
2215			if (self.themeSettings.yesReadingHis === undefined) {
2216				return;
2217			}
2218			$.ajax({
2219				type: 'GET',
2220				url: self.ajaxURL,
2221				data: {
2222					action: 'rbcollect',
2223					id: self.themeSettings.yesReadingHis
2224				}
2225			});
2226		};
2227
2228		/** header notification */
2229		Module.newsNotification = function () {
2230
2231			const notificationWrapper = $('.rb-notification');
2232			if (notificationWrapper.length < 1) {
2233				return false;
2234			}
2235			const notificationID = this.personailizeUID + '-notification';
2236			const notificationCount = this.personailizeUID + '-notification-count';
2237
2238			const self = this;
2239			const dot = $('.notification-info');
2240			const content = self.getTTLStorage(notificationID);
2241			const count = self.getTTLStorage(notificationCount);
2242			let reload = notificationWrapper.data('interval');
2243			if (!reload || isNaN(reload) || reload <= 0) {
2244				reload = 6;
2245			}
2246			if (!content) {
2247				$.ajax({
2248					type: 'GET',
2249					url: self.ajaxURL,
2250					data: {
2251						action: 'rbnotification',
2252					},
2253					success: function (response) {
2254						response = $.parseJSON(JSON.stringify(response));
2255						self.SetTTLStorage(notificationID, response.content, reload);
2256						self.SetTTLStorage(notificationCount, response.count, reload);
2257						notificationWrapper.append(response.content);
2258						if (response.count) {
2259							dot.append(response.count);
2260							dot.css('opacity', 1);
2261						}
2262					}
2263				});
2264			} else {
2265				notificationWrapper.append(content);
2266				dot.append(count);
2267			}
2268		};
2269
2270		/** register cache object */
2271		Module.cacheData = {
2272
2273			data: {},
2274			get: function (id) {
2275				return this.data[id];
2276			},
2277
2278			set: function (id, data) {
2279				this.remove(id);
2280				this.data[id] = data;
2281			},
2282
2283			remove: function (id) {
2284				delete this.data[id];
2285			},
2286
2287			getCacheID: function (blockID, currentPage) {
2288				return JSON.stringify('RB_' + blockID + '_' + currentPage);
2289			},
2290
2291			exist: function (id) {
2292				return this.data.hasOwnProperty(id) && this.data[id] !== null;
2293			}
2294		}
2295
2296		/**
2297		 * ajax start animation
2298		 * @param block
2299		 * @param action
2300		 */
2301		Module.ajaxStartAnimation = function (block, action) {
2302
2303			const inner = block.find('.block-inner');
2304			block.find('.pagination-trigger').addClass('is-disable');
2305			inner.stop();
2306
2307			if ('replace' === action) {
2308				inner.css('min-height', inner.outerHeight());
2309				inner.fadeTo('200', 0.05);
2310				inner.after('<i class="rb-loader loader-absolute"></i>');
2311			} else {
2312				block.find('.loadmore-trigger').addClass('loading');
2313				block.find('.rb-loader').css({'display': 'block'}).delay(200).animate({opacity: 1}, 200);
2314			}
2315		}
2316
2317		/**
2318		 * render ajax
2319		 * @param block
2320		 * @param uuid
2321		 * @param response
2322		 * @param action
2323		 */
2324		Module.ajaxRenderHTML = function (block, uuid, response, action) {
2325
2326			const self = this;
2327
2328			block.delay(50).queue(function () {
2329				const uuid = block.attr('id');
2330				const inner = block.find('.block-inner');
2331				block.find('.pagination-trigger').removeClass('is-disable');
2332				inner.stop();
2333
2334				if ('replace' === action) {
2335					inner.html(response.content);
2336					block.find('.rb-loader').animate({opacity: 0}, 200, function () {
2337						$(this).remove();
2338					})
2339					inner.css('min-height', '');
2340					inner.fadeTo(200, 1);
2341
2342				} else {
2343					const content = $(response.content);
2344					inner.append(content);
2345					content.addClass('is-invisible');
2346					content.addClass('opacity-animate');
2347
2348					block.find('.rb-loader').animate({opacity: 0}, 200, function () {
2349						$(this).css({'display': 'none'});
2350					});
2351					setTimeout(function () {
2352						content.removeClass('is-invisible');
2353					}, 200);
2354					block.find('.loadmore-trigger').removeClass('loading');
2355				}
2356
2357				/** reload */
2358				self.ajaxTriggerState(block, uuid);
2359				self.ajaxData[uuid].processing = false;
2360				block.dequeue();
2361				self.reloadBlockFunc();
2362			});
2363		}
2364
2365		/**
2366		 * set
2367		 * @param block
2368		 * @param uuid
2369		 */
2370		Module.ajaxTriggerState = function (block, uuid) {
2371			const self = this;
2372			block.find('.pagination-trigger').removeClass('is-disable');
2373			if (self.ajaxData[uuid].paged < 2) {
2374				block.find('[data-type="prev"]').addClass('is-disable');
2375			} else if (self.ajaxData[uuid].paged >= self.ajaxData[uuid].page_max) {
2376				block.find('[data-type="next"]').addClass('is-disable');
2377				block.find('.loadmore-trigger').addClass('is-disable').hide();
2378				block.find('.pagination-infinite').addClass('is-disable').hide();
2379			}
2380		}
2381
2382		Module.getBlockSettings = function (uuid) {
2383			const settings = typeof window[uuid] !== 'undefined' ? window[uuid] : undefined;
2384			return this.cleanNull(settings);
2385		}
2386
2387		Module.cleanNull = function (data) {
2388			if (typeof data === 'string') {
2389				return data;
2390			}
2391
2392			if (data && typeof data === 'object') {
2393				Object.keys(data).forEach(key => {
2394					if (data[key] === '' || data[key] === null) {
2395						delete data[key];
2396					}
2397				});
2398			}
2399
2400			return data;
2401		};
2402
2403		/* SINGLE INFINITE */
2404		Module.singleInfiniteLoadNext = function () {
2405
2406			const infiniteWrapper = $('#single-post-infinite');
2407			const self = this;
2408
2409			if (!infiniteWrapper.length || self.disabledLoadNext()) {
2410				return;
2411			}
2412
2413			self.singleLoadNextCounter = 1;
2414			self.singleLoadNextLimit = self.themeSettings?.singleLoadNextLimit ? parseInt(self.themeSettings.singleLoadNextLimit, 10) : 20;
2415
2416			const infiniteLoadPoint = $('#single-infinite-point');
2417			const animationIcon = infiniteLoadPoint.find('.rb-loader');
2418			const rootURL = new URL(window.location.href);
2419			const rootGetParams = rootURL.searchParams;
2420
2421			const loadNextParams = {
2422				element: infiniteLoadPoint,
2423				offset: 'bottom-in-view',
2424				handler: function (direction) {
2425					if (self.ajaxData.singleProcessing || direction === 'up' || self.singleLoadNextCounter > self.singleLoadNextLimit) {
2426						return;
2427					}
2428					const nextPostURL = new URL(infiniteWrapper.data('nextposturl'));
2429					nextPostURL.searchParams.set('rbsnp', '1');
2430					if (rootGetParams) {
2431						rootGetParams.forEach((value, key) => {
2432							if (key !== 'rbsnp' && 'p' !== key) {
2433								nextPostURL.searchParams.set(key, value);
2434							}
2435						});
2436					}
2437					self.ajaxData.singleProcessing = true;
2438					animationIcon.css('display', 'block').animate({opacity: 1}, 200);
2439
2440					$.ajax({
2441						type: 'GET',
2442						url: nextPostURL.toString(),
2443						dataType: 'html',
2444						success: function (response) {
2445							response = $('<div id="temp-dom"></div>').append($.parseHTML(response)).find('.single-post-outer');
2446							const nextPostURL = response.data('nextposturl');
2447
2448							if (nextPostURL) {
2449								infiniteWrapper.data('nextposturl', nextPostURL);
2450							} else {
2451								infiniteWrapper.removeAttr('id');
2452								infiniteLoadPoint.remove();
2453							}
2454
2455							animationIcon.animate({opacity: 0}, 200).delay(200).css('display', 'none');
2456							infiniteWrapper.append(response);
2457							self.ajaxData.singleProcessing = false;
2458							self.singleLoadNextCounter++;
2459
2460							setTimeout(function () {
2461								self.reInitAll();
2462								if (typeof FOXIZ_CORE_SCRIPT !== 'undefined') {
2463									FOXIZ_CORE_SCRIPT.loadGoogleAds(response);
2464									FOXIZ_CORE_SCRIPT.loadInstagram(response);
2465									FOXIZ_CORE_SCRIPT.loadTwttr();
2466								}
2467							}, 1);
2468						}
2469					});
2470				}
2471			};
2472
2473			self.wPoint.ajaxSingleNextPosts = new Waypoint(loadNextParams);
2474		};
2475
2476		Module.singleScrollRefresh = function () {
2477
2478			const infiniteWrapper = $('#single-post-infinite');
2479			if (!infiniteWrapper.length) {
2480				return;
2481			}
2482			const self = this;
2483			self.articleData = [];
2484			const articleOuter = infiniteWrapper.find('.single-post-outer');
2485
2486			if (articleOuter.length > 0) {
2487				self.inviewPostID = articleOuter.eq(0).data('postid');
2488
2489				articleOuter.each(function () {
2490					const article = $(this);
2491					const itemData = {
2492						postID: article.data('postid'),
2493						postURL: article.data('postlink'),
2494						postTitle: article.find('h1.s-title').text(),
2495						shareList: article.find('.sticky-share-list-buffer').html(),
2496						top: article.offset().top,
2497						bottom: article.offset().top + article.outerHeight(true)
2498					};
2499
2500					if (self.readIndicator.length > 0) {
2501						const content = article.find('.rbct').eq(0);
2502						itemData.indicatorTop = content.offset().top;
2503						itemData.indicatorHeight = content.outerHeight(true) - self._window.height();
2504					}
2505					self.articleData.push(itemData);
2506				});
2507
2508				const onScroll = () => {
2509					self.animationFrame(self.scrollToUpdateArticle.bind(self));
2510				};
2511				if (window.addEventListener) {
2512					window.addEventListener('scroll', onScroll, false);
2513				}
2514			}
2515		}
2516
2517		/** scrollToUpdateArticle */
2518		Module.scrollToUpdateArticle = function () {
2519			const self = this;
2520			const scroll = self._window.scrollTop();
2521
2522			self.articleData.every(article => {
2523				if (scroll > (article.top + 5) && scroll < (article.bottom - 5)) {
2524					if (article.indicatorTop) {
2525						self.readIndicatorPercent = Math.min(((scroll - article.indicatorTop) / article.indicatorHeight) * 100, 100);
2526						if (self.readIndicatorPercent <= 100) {
2527							self.readIndicator.css('width', `${self.readIndicatorPercent}%`);
2528						}
2529					}
2530
2531					if (article.postID !== self.inviewPostID) {
2532						self.inviewPostID = article.postID;
2533						if (article.postURL) {
2534							history.replaceState(null, null, article.postURL);
2535						}
2536						document.title = article.postTitle;
2537						$('.single-post-outer').removeClass('activated');
2538						$('[data-postid="' + article.postID + '"]').addClass('activated');
2539						$('#s-title-sticky .sticky-title').hide().html(article.postTitle).fadeIn(300);
2540						$('#s-title-sticky .sticky-share-list').html(article.shareList);
2541						self._body.find('.floating-video').removeClass('floating-activated');
2542
2543						if (typeof FOXIZ_CORE_SCRIPT !== 'undefined') {
2544							FOXIZ_CORE_SCRIPT.updateGA(article);
2545						}
2546					}
2547					return false;
2548				}
2549
2550				return true;
2551
2552			});
2553		}
2554
2555		/**
2556		 * @returns {boolean}
2557		 */
2558		Module.crwDetect = function () {
2559			const botPatterns = [
2560				/alexa|altavista|ask jeeves|attentio|baiduspider|bingbot|chtml generic|crawler|fastmobilecrawl|feedfetcher-google|firefly|froogle|gigabot|googlebot|googlebot-mobile|heritrix|httrack|ia_archiver|irlbot|iescholar|infoseek|jumpbot|linkcheck|lycos|mediapartners|mediobot|motionbot|msnbot|mshots|openbot|pss-webkit-request|pythumbnail|scooter|slurp|snapbot|spider|taptubot|technoratisnoop|teoma|twiceler|yahooseeker|yaho
2560oysmcm|yammybot|ahrefsbot|pingdom.com_bot|kraken|yandexbot|twitterbot|tweetmemebot|openhosebot|queryseekerspider|linkdexbot|grokkit-crawler|livelapbot|germcrawler|domaintunocrawler|grapeshotcrawler|cloudflare-alwaysonline/i
2561			];
2562
2563			const userAgent = navigator.userAgent;
2564			return botPatterns.some(pattern => pattern.test(userAgent));
2565		};
2566
2567		/**
2568		 *
2569		 * @returns {boolean}
2570		 */
2571		Module.disabledLoadNext = function () {
2572
2573			if (this.themeSettings.crwLoadNext) {
2574				return false;
2575			}
2576
2577			return this.crwDetect();
2578		}
2579
2580		/** productQuantity */
2581		Module.productQuantity = function () {
2582			this._document.on('click', '.quantity .quantity-btn', function (e) {
2583
2584				e.preventDefault();
2585				e.stopPropagation();
2586
2587				const button = $(this);
2588				const input = button.parent().find('input');
2589
2590				let step = 1;
2591				let min = 1;
2592				let max = 9999;
2593				let value_old = parseInt(input.val());
2594				let value_new = parseInt(input.val());
2595
2596				if (input.attr('step')) {
2597					step = parseInt(input.attr('step'));
2598				}
2599
2600				if (input.attr('min')) {
2601					min = parseInt(input.attr('min'));
2602				}
2603
2604				if (input.attr('max')) {
2605					max = parseInt(input.attr('max'));
2606				}
2607
2608				if (button.hasClass('up')) {
2609					if (value_old < max) {
2610						value_new = value_old + step;
2611					} else {
2612						value_new = 1;
2613					}
2614				} else if (button.hasClass('down')) {
2615					if (value_old > min) {
2616						value_new = value_old - step;
2617					} else {
2618						value_new = 0;
2619					}
2620				}
2621
2622				if (!input.attr('disabled')) {
2623					input.val(value_new).change();
2624				}
2625			});
2626		}
2627
2628		Module.cartNotification = function () {
2629			const self = this;
2630			const element = $('#add-cart-popup');
2631
2632			self._body.on('added_to_cart', function () {
2633				element.fadeIn(200);
2634				self.cartNotificationTimeOut = setTimeout(function () {
2635					element.fadeOut(200);
2636				}, 5000);
2637				self.hoveringNotification(element);
2638			});
2639		}
2640
2641		Module.hoveringNotification = function (element) {
2642			const self = this;
2643
2644			element.on('mouseenter', function () {
2645				clearTimeout(self.cartNotificationTimeOut);
2646			});
2647
2648			element.on('mouseleave', function () {
2649				setTimeout(function () {
2650					element.fadeOut(200);
2651				}, 1500);
2652			});
2653		}
2654
2655		/** like/dislike */
2656		Module.likeToggle = function () {
2657
2658			const self = this;
2659			let reaction = '';
2660			self._body.on('click', '.like-trigger, .dislike-trigger', function (e) {
2661
2662				e.preventDefault();
2663				e.stopPropagation();
2664
2665				const target = $(this);
2666				const wrap = target.parent('[data-like]');
2667				const pid = wrap.data('like');
2668
2669				if (!pid || self.isProgress) return;
2670
2671				self.isProgress = true;
2672				const storageKey = self.getLikeKey(pid);
2673				const isLike = target.hasClass('like-trigger');
2674				const isDislike = target.hasClass('dislike-trigger');
2675				const sibEl = target.siblings();
2676				const likeCountEl = wrap.find('.like-count');
2677				const dislikeCountEl = wrap.find('.dislike-count');
2678				let likeCountText = likeCountEl.text();
2679				let dislikeCountText = dislikeCountEl.text();
2680
2681				if (isLike) {
2682					if (!target.hasClass('triggered')) {
2683						reaction = 'like';
2684						if (!/[kKmM]/.test(likeCountText)) {
2685							likeCountText = parseInt(likeCountText);
2686							if (isNaN(likeCountText)) {
2687								likeCountText = 0;
2688							}
2689							likeCountEl.text(likeCountText + 1);
2690						}
2691						target.addClass('triggered');
2692
2693						if (sibEl.hasClass('triggered')) {
2694							sibEl.removeClass('triggered');
2695							if (!/[kKmM]/.test(dislikeCountText)) {
2696								dislikeCountText = parseInt(dislikeCountText) - 1;
2697								if (isNaN(dislikeCountText) || dislikeCountText < 1) {
2698									dislikeCountText = '';
2699								}
2700								dislikeCountEl.text(dislikeCountText);
2701							}
2702						}
2703						self.setStorage(storageKey, 'like');
2704					} else {
2705						reaction = 'rmlike';
2706						if (!/[kKmM]/.test(likeCountText)) {
2707							likeCountText = parseInt(likeCountText) - 1;
2708							if (isNaN(likeCountText) || likeCountText < 1) {
2709								likeCountText = '';
2710							}
2711							likeCountEl.text(likeCountText);
2712						}
2713						target.removeClass('triggered');
2714						self.deleteStorage(storageKey);
2715					}
2716				} else if (isDislike) {
2717					if (!target.hasClass('triggered')) {
2718						reaction = 'dislike';
2719						if (!/[kKmM]/.test(dislikeCountText)) {
2720							dislikeCountText = parseInt(dislikeCountText);
2721							if (isNaN(dislikeCountText)) {
2722								dislikeCountText = 0;
2723							}
2724							dislikeCountEl.text(dislikeCountText + 1);
2725						}
2726						target.addClass('triggered');
2727						if (sibEl.hasClass('triggered')) {
2728							sibEl.removeClass('triggered');
2729							if (!/[kKmM]/.test(likeCountText)) {
2730								likeCountText = parseInt(likeCountText) - 1;
2731								if (isNaN(likeCountText) || likeCountText < 1) {
2732									likeCountText = '';
2733								}
2734								likeCountEl.text(likeCountText);
2735							}
2736						}
2737						self.setStorage(storageKey, 'dislike');
2738					} else {
2739						reaction = 'rmdislike';
2740						if (!/[kKmM]/.test(dislikeCountText)) {
2741							likeCountText = parseInt(likeCountText) - 1;
2742							if (isNaN(likeCountText) || likeCountText < 1) {
2743								likeCountText = '';
2744							}
2745							dislikeCountEl.text(likeCountText);
2746						}
2747						target.removeClass('triggered');
2748						self.deleteStorage(storageKey);
2749					}
2750				}
2751
2752				$.ajax({
2753					type: 'GET',
2754					url: self.ajaxURL,
2755					data: {
2756						uuid: self.personailizeUID,
2757						action: 'rbvoting',
2758						value: reaction,
2759						pid: pid,
2760					},
2761					complete: () => {
2762						self.isProgress = false;
2763					}
2764				})
2765			})
2766		}
2767
2768		/** sync layout */
2769		Module.syncLayoutLike = function () {
2770
2771			this.isProgress = true;
2772			const likeElements = document.querySelectorAll('[data-like]:not(.loaded)');
2773			const jsCount = this._body.hasClass('is-jscount');
2774			let count, countEl;
2775
2776			for (const el of likeElements) {
2777				el.classList.add('loaded');
2778				const key = this.getLikeKey(el.getAttribute('data-like'));
2779				const triggered = this.getStorage(key);
2780
2781				if (!triggered) continue;
2782
2783				const likeEl = el.querySelector('.el-like');
2784				const dislikeEl = el.querySelector('.el-dislike');
2785
2786				if (!likeEl || !dislikeEl) continue;
2787
2788				if (triggered === 'like') {
2789					likeEl.classList.add('triggered');
2790					countEl = jsCount ? likeEl.querySelector('.like-count') : null;
2791					if (countEl) {
2792						count = parseInt(countEl.textContent.trim()) || 0;
2793						countEl.textContent = count + 1;
2794					}
2795				} else if (triggered === 'dislike') {
2796					dislikeEl.classList.add('triggered');
2797					countEl = jsCount ? dislikeEl.querySelector('.dislike-count') : null;
2798					if (countEl) {
2799						count = parseInt(countEl.textContent.trim()) || 0;
2800						countEl.textContent = count + 1;
2801					}
2802				}
2803			}
2804
2805			this.isProgress = false;
2806		};
2807
2808		/** like key */
2809		Module.getLikeKey = function (id) {
2810			return this.personailizeUID + '-like-' + id;
2811		}
2812
2813		/** live blog */
2814		Module.liveBlog = function () {
2815			const self = this;
2816
2817			const liveEntry = $('.rb-live-entry');
2818
2819			if (liveEntry.length === 0) {
2820				return false;
2821			}
2822
2823			let intervalId;
2824			const interval = Math.max(30, this.themeSettings.liveInterval || 0);
2825			const liveSwitcher = $('#live-interval-switcher');
2826			const storedSetting = this.getStorage('liveIntervalCheckbox');
2827
2828			const updateInterval = () => {
2829				clearInterval(intervalId);
2830				if (liveSwitcher.prop('checked')) {
2831					intervalId = setInterval(() => this.updateLiveBlog(liveEntry), interval * 1000);
2832					self.setStorage('liveIntervalCheckbox', 'yes');
2833				} else {
2834					self.setStorage('liveIntervalCheckbox', 'no');
2835				}
2836			};
2837
2838			if (storedSetting !== null) {
2839				liveSwitcher.prop('checked', storedSetting === 'yes');
2840			} else {
2841				self.setStorage('liveIntervalCheckbox', 'yes');
2842			}
2843
2844			updateInterval();
2845			liveSwitcher.on('change', updateInterval);
2846		};
2847
2848		Module.updateLiveBlog = function (liveEntry) {
2849
2850			const self = this;
2851			const liveURL = new URL(window.location.href);
2852			liveURL.searchParams.set('rblive', '1');
2853			$.ajax({
2854				type: 'GET',
2855				url: liveURL.toString(),
2856				dataType: 'html',
2857				success: function (response) {
2858					response = $('<div id="temp-dom"></div>').append($.parseHTML(response)).find('#rb-live-content');
2859					liveEntry.html(response.html());
2860					const liveCountElement = liveEntry.prev().find('.live-count');
2861					if (liveCountElement.length) {
2862						liveCountElement.text(response.data('total'));
2863					}
2864					setTimeout(function () {
2865						self.reInitAll();
2866						if (typeof FOXIZ_CORE_SCRIPT !== 'undefined') {
2867							FOXIZ_CORE_SCRIPT.loadGoogleAds(response);
2868							FOXIZ_CORE_SCRIPT.loadInstagram(response);
2869							FOXIZ_CORE_SCRIPT.loadTwttr();
2870						}
2871					}, 1);
2872				}
2873			});
2874		}
2875
2876		Module.accordion = function () {
2877			$('.gb-accordion').each(function () {
2878				const accordion = $(this);
2879				if (accordion.hasClass('yesLoaded')) return;
2880
2881				accordion.addClass('yesLoaded');
2882				const accordionItems = accordion.find('.gb-accordion-item');
2883
2884				if (accordion.hasClass('yes-open')) {
2885					accordionItems.first().addClass('active').find('.accordion-item-content').css('display', 'block');
2886				}
2887
2888				accordion.on('click', '.accordion-item-header', function (e) {
2889					e.preventDefault();
2890
2891					const header = $(this);
2892					const item = header.closest('.gb-accordion-item');
2893					const content = item.find('.accordion-item-content');
2894
2895					if (item.hasClass('active')) {
2896						item.removeClass('active');
2897						content.stop().slideUp(200);
2898					} else {
2899						const activeItem = accordionItems.filter('.active');
2900						activeItem.removeClass('active').find('.accordion-item-content').stop().slideUp(200);
2901						item.addClass('active');
2902						content.stop().slideDown(200);
2903					}
2904				});
2905			});
2906		};
2907
2908		Module.resIframeClassic = function () {
2909
2910			if (!document.body.classList.contains('res-iframe-classic')) return
2911			const iframes = document.querySelectorAll('.rbct iframe');
2912			iframes.forEach(iframe => {
2913				const parent = iframe.parentElement;
2914				const grandParent = parent.parentElement;
2915				const greatGrandParent = grandParent.parentElement;
2916
2917				if ([parent, grandParent, greatGrandParent].some(element => {
2918					const classNames = Array.from(element.classList);
2919					return classNames.some(className => className.indexOf('wp-block') !== -1);
2920				})) return;
2921
2922				if (!iframe.parentElement.classList.contains('rb-video-ires')) {
2923					if (iframe.src.includes('youtube.com') || iframe.src.includes('youtu.be') || iframe.src.includes('vimeo.com') || iframe.src.includes('dailymotion.com')) {
2924						iframe.parentElement.classList.add('rb-video-ires');
2925					}
2926				}
2927			});
2928		}
2929
2930		Module.taxBasedAccordion = function () {
2931
2932			const self = this;
2933			$('.block-tax-accordion').each(function () {
2934				const accordion = $(this);
2935				if (accordion.hasClass('is-loaded')) {
2936					return;
2937				}
2938				accordion.addClass('is-loaded');
2939				const accordionItems = accordion.find('.tax-accordion-item');
2940				const lastOpenedTab = self.getStorage(accordion.attr('id') + '_lastOpenedTab', null);
2941
2942				if (lastOpenedTab) {
2943					const tabToOpen = accordion.find('[data-tab="' + lastOpenedTab + '"] .tax-accordion-sub');
2944					if (tabToOpen.length !== 0) {
2945						tabToOpen.show();
2946					}
2947				}
2948
2949				accordionItems.each(function () {
2950					const item = $(this);
2951					const trigger = item.find('.tax-accordion-trigger');
2952					const subMenu = item.find('.tax-accordion-sub');
2953
2954					trigger.click(function () {
2955						if (!subMenu.is(':visible')) {
2956							accordion.find('.tax-accordion-sub').not(subMenu).slideUp();
2957						}
2958						subMenu.slideToggle(function () {
2959							if (subMenu.is(':visible')) {
2960								self.setStorage(accordion.attr('id') + '_lastOpenedTab', item.attr('data-tab'));
2961							} else {
2962								self.deleteStorage(accordion.attr('id') + '_lastOpenedTab');
2963							}
2964						});
2965					});
2966				});
2967			});
2968		};
2969
2970		return Module;
2971
2972	}(FOXIZ_MAIN_SCRIPT || {}, jQuery)
2973)
2974
2975/** init */
2976jQuery(document).ready(function ($) {
2977	FOXIZ_MAIN_SCRIPT.init();
2978});
2979
2980/** Elementor editor */
2981jQuery(window).on('elementor/frontend/init', function () {
2982	FOXIZ_MAIN_SCRIPT.isElementorEditor = true;
2983	FOXIZ_MAIN_SCRIPT.editorDarkModeInit = false;
2984
2985	if (window.elementor && window.elementorFrontend) {
2986		elementorFrontend.hooks.addAction('frontend/element_ready/widget', FOXIZ_MAIN_SCRIPT.initElementor);
2987	}
2988});

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.