PageSourceSearch

https://www.avconcepts.com/wp-content/plugins/jet-popup/assets/js/jet-popup-frontend.js?ver=2.2.2

js avconcepts.com collected 2026-09-25 03:48:26 UTC 49,061 bytes, 1,938 lines download raw bytes

1( function( $ ) {
2
3	'use strict';
4
5	window.JetPopupFrontend = {
6
7		addedScripts: {},
8
9		addedStyles: {},
10
11		addedAssetsPromises: [],
12
13		getLoopItemData: function( $trigger ) {
14
15			let $loopItem = $();
16
17			if ( ! $trigger || ! $trigger.length ) {
18				return {};
19			}
20
21			$loopItem = $trigger.closest( '[data-elementor-type="loop-item"], .e-loop-item' );
22
23			if ( ! $loopItem.length ) {
24				$loopItem = $trigger.find( '[data-elementor-type="loop-item"], .e-loop-item' ).first();
25			}
26
27			if ( ! $loopItem.length ) {
28				return {};
29			}
30
31			let postId    = $loopItem.data( 'post-id' ) || false,
32				className = $loopItem.attr( 'class' ) || '',
33				matches   = [
34					className.match( /\be-loop-item-(\d+)\b/ ),
35					className.match( /\bpost-(\d+)\b/ ),
36					className.match( /\bpage-id-(\d+)\b/ ),
37					className.match( /\battachment-(\d+)\b/ ),
38				];
39
40			if ( ! postId ) {
41				for ( let match of matches ) {
42					if ( match && match[1] ) {
43						postId = match[1];
44						break;
45					}
46				}
47			}
48
49			if ( ! postId ) {
50				return {};
51			}
52
53			return {
54				postId: +postId,
55			};
56		},
57
58		maybeExtendPopupData: function( popupData, $trigger ) {
59			let loopItemData = {};
60
61			popupData = popupData || {};
62
63			if ( popupData.postId ) {
64				return popupData;
65			}
66
67			if ( popupData.loopDynamicPopup && $trigger && $trigger.length ) {
68				loopItemData = JetPopupFrontend.getLoopItemData( $trigger );
69			}
70
71			if ( loopItemData.postId ) {
72				return jQuery.extend( {}, popupData, loopItemData );
73			}
74
75			if ( window.jetPopupData && window.jetPopupData.currentPostId ) {
76				return jQuery.extend( {}, popupData, {
77					postId: +window.jetPopupData.currentPostId,
78				} );
79			}
80
81			return popupData;
82		},
83
84		init: function() {
85			let $popup_list = $( '.jet-popup.jet-popup--front-mode' );
86
87			$popup_list.each( function( index ) {
88				let $target  = $( this ),
89					instance = null,
90					settings = $target.data( 'settings' );
91
92				instance = new window.jetPopup( $target, settings );
93				instance.init();
94			} );
95
96			JetPopupFrontend.initAttachedPopups();
97
98			JetPopupFrontend.initBlocks();
99
100			$( window ).on( 'jet-popup/ajax/frontend-init', ( event, payload ) => {
101
102				switch ( payload.contentType ) {
103					case 'elementor':
104						JetPopupFrontend.maybeElementorFrontendInit( payload.$container );
105						break;
106					case 'default':
107						JetPopupFrontend.maybeDefaultFrontendInit( payload );
108						break
109				}
110			} );
111		},
112
113		initAttachedPopups: function ( $scope ) {
114			$scope = $scope || $( 'body' );
115
116			$scope.find( '[data-popup-instance]' ).each( ( index, el ) => {
117				let $this = $( el ),
118					popupId = $this.data( 'popup-instance' ) || 'none',
119					triggerType = $this.data( 'popup-trigger-type' ) || 'none',
120					clickedCustomClass = $this.data( 'popup-custom-selector' ) || '',
121					popupData = {
122						popupId: `jet-popup-${ popupId }`,
123					};
124
125				if ( $this.hasClass( 'jet-popup-attach-event-inited' ) ) {
126					return;
127				}
128
129				$this.addClass( 'jet-popup-attach-event-inited' );
130
131				switch( triggerType ) {
132					case 'click-self':
133						$this.addClass( 'jet-popup-cursor-pointer' );
134						JetPopupFrontend.makeTriggerAccessible( $this, popupData.popupId );
135
136						$this.on( 'click.JetPopup', function( event ) {
137							event.preventDefault();
138
139							$( window ).trigger( {
140								type: 'jet-popup-open-trigger',
141								popupData: popupData,
142								triggeredBy: $( event.currentTarget ),
143							} );
144
145							return false;
146						} );
147						break;
148					case 'click-selector':
149
150						if ( '' !== clickedCustomClass ) {
151							$this.find( clickedCustomClass ).addClass( 'jet-popup-cursor-pointer' );
152							JetPopupFrontend.makeTriggerAccessible( $this.find( clickedCustomClass ), popupData.popupId );
153
154							$this.on( 'click.JetPopup', clickedCustomClass, function( event ) {
155								event.preventDefault();
156
157								$( window ).trigger( {
158									type: 'jet-popup-open-trigger',
159									popupData: popupData,
160									triggeredBy: $( event.currentTarget ),
161								} );
162
163								return false;
164							} );
165						}
166						break;
167					case 'hover':
168						$this.on( 'mouseenter.JetPopup', function( event ) {
169
170							$( window ).trigger( {
171								type: 'jet-popup-open-trigger',
172								popupData: popupData,
173								triggeredBy: $this,
174							} );
175						} );
176						break;
177					case 'scroll-to':
178						const observer = new IntersectionObserver(( entries ) => {
179							entries.forEach(( entry ) => {
180
181								if ( entry.isIntersecting ) {
182
183									$( window ).trigger( {
184										type: 'jet-popup-open-trigger',
185										popupData: popupData,
186										triggeredBy: $this,
187									} );
188								}			
189							})
190						},
191						{ 
192							threshold: 0.5
193						});
194
195						for ( let i = 0; i < $( $this ).length; i++ ) {
196							const elements = $( $this )[i];
197							observer.observe( elements );
198						} 
199
200						break;
201				}
202			} );
203		},
204
205		initBlocks: function( $scope ) {
206			$scope = $scope || $( 'body' );
207
208			window.JetPlugins.init( $scope, [
209				{
210					block: 'jet-popup/action-button',
211					callback: ( $scope ) => {
212						let $button    = $( '.jet-popup-action-button__instance', $scope ),
213							actionType = $scope.data( 'action-type' );
214
215						JetPopupFrontend.actionButtonHandle( $button, actionType );
216					}
217				}
218			] );
219		},
220
221		actionButtonBlock: function( $scope ) {
222			var $button    = $( '.jet-popup-action-button__instance', $scope ),
223				actionType = $scope.data( 'action-type' );
224
225			JetPopupFrontend.actionButtonHandle( $button, actionType );
226		},
227
228		getPopupActionButtonCloseState: function( $popup, constantly ) {
229			var popupSettings = $popup.data( 'settings' ) || {};
230
231			if ( undefined !== constantly ) {
232				return constantly;
233			}
234
235			return popupSettings['show-once'] || false;
236		},
237
238		redirectPopupActionButton: function( $button ) {
239			var link   = $button.attr( 'href' ),
240				target = $button.attr( 'target' );
241
242			if ( ! link || '#' === link ) {
243				return;
244			}
245
246			if ( '_blank' === target  ) {
247				window.open( link, '_blank' );
248			} else {
249				window.open( link, '_self' );
250			}
251		},
252
253		actionButtonHandle: function ( $button, actionType = 'link' ) {
254
255			switch ( actionType ) {
256
257				case 'link':
258
259					$button.on( 'click.JetPopup', function( event ) {
260						event.preventDefault();
261
262						var $currentPopup = $button.closest( '.jet-popup' ),
263							popupId       = $currentPopup.attr( 'id' );
264
265						$( window ).trigger( {
266							type: 'jet-popup-close-trigger',
267							popupData: {
268								popupId: popupId,
269								constantly: JetPopupFrontend.getPopupActionButtonCloseState( $currentPopup )
270							}
271						} );
272
273						JetPopupFrontend.redirectPopupActionButton( $( this ) );
274
275						return false;
276					} );
277					break;
278
279				case 'leave':
280					$button.on( 'click.JetPopup', function( event ) {
281						event.preventDefault();
282
283						window.history.back();
284					} );
285					break;
286
287				case 'close-popup':
288					$button.on( 'click.JetPopup', function( event ) {
289						event.preventDefault();
290
291						var $currentPopup = $button.closest( '.jet-popup' ),
292							popupId = $currentPopup.attr( 'id' );
293
294						$( window ).trigger( {
295							type: 'jet-popup-close-trigger',
296							popupData: {
297								popupId: popupId,
298								constantly: false
299							}
300						} );
301
302						JetPopupFrontend.redirectPopupActionButton( $( this ) );
303					} );
304					break;
305
306				case 'close-all-popups':
307					$button.on( 'click.JetPopup', function( event ) {
308						event.preventDefault();
309
310						var $popups = $( '.jet-popup' );
311
312						if ( $popups[0] ) {
313							$popups.each( function( index ) {
314								var $popup  = $( this ),
315									popupId = $popup.attr( 'id' );
316
317								$( window ).trigger( {
318									type: 'jet-popup-close-trigger',
319									popupData: {
320										popupId: popupId,
321										constantly: false
322									}
323								} );
324							} );
325						}
326
327						JetPopupFrontend.redirectPopupActionButton( $( this ) );
328					} );
329					break;
330
331				case 'close-constantly':
332					$button.on( 'click.JetPopup', function( event ) {
333						event.preventDefault();
334
335						var $currentPopup = $button.closest( '.jet-popup' ),
336							popupId = $currentPopup.attr( 'id' );
337
338						$( window ).trigger( {
339							type: 'jet-popup-close-trigger',
340							popupData: {
341								popupId: popupId,
342								constantly: true
343							}
344						} );
345
346						JetPopupFrontend.redirectPopupActionButton( $( this ) );
347					} );
348					break;
349
350				case 'close-all-constantly':
351					$button.on( 'click.JetPopup', function( event ) {
352						event.preventDefault();
353
354						var $popups = $( '.jet-popup' );
355
356						if ( $popups[0] ) {
357							$popups.each( function( index ) {
358								var $popup  = $( this ),
359									popupId = $popup.attr( 'id' );
360
361								$( window ).trigger( {
362									type: 'jet-popup-close-trigger',
363									popupData: {
364										popupId: popupId,
365										constantly: true
366									}
367								} );
368							} );
369						}
370
371						JetPopupFrontend.redirectPopupActionButton( $( this ) );
372					} );
373					break;
374			}
375		},
376
377		isNativeInteractiveElement: function( element ) {
378			if ( ! element || ! element.tagName ) {
379				return false;
380			}
381
382			const tagName = element.tagName.toLowerCase();
383
384			return -1 !== [ 'a', 'button', 'input', 'select', 'textarea', 'option', 'summary' ].indexOf( tagName );
385		},
386
387		makeTriggerAccessible: function( $elements, popupId ) {
388			if ( ! $elements || ! $elements.length ) {
389				return;
390			}
391
392			$elements.each( function() {
393				const $element = $( this );
394
395				if ( popupId ) {
396					$element.attr( {
397						'aria-haspopup': 'dialog',
398						'aria-controls': popupId,
399						'aria-expanded': 'false',
400					} );
401				}
402
403				if ( JetPopupFrontend.isNativeInteractiveElement( this ) ) {
404					return;
405				}
406
407				if ( ! $element.is( '[role]' ) ) {
408					$element.attr( 'role', 'button' );
409				}
410
411				if ( ! $element.is( '[tabindex]' ) ) {
412					$element.attr( 'tabindex', '0' );
413				}
414			} );
415
416			$elements.off( 'keydown.jetPopupA11yTrigger' ).on( 'keydown.jetPopupA11yTrigger', function( event ) {
417				const key = event.key || '';
418
419				if ( JetPopupFrontend.isNativeInteractiveElement( event.currentTarget ) ) {
420					return;
421				}
422
423				if ( 'Enter' === key || ' ' === key || 'Spacebar' === key || 13 === event.keyCode || 32 === event.keyCode ) {
424					event.preventDefault();
425					$( this ).trigger( 'click' );
426				}
427			} );
428		},
429
430		loadScriptAsync: function( script, uri ) {
431
432			if ( JetPopupFrontend.addedScripts.hasOwnProperty( script ) ) {
433				return script;
434			}
435
436			JetPopupFrontend.addedScripts[ script ] = uri;
437
438			const asset = document.getElementById( script + '-js' );
439
440			if ( asset ) {
441				return script;
442			}
443
444			return new Promise( function( resolve, reject ) {
445				var tag = document.createElement( 'script' );
446
447				tag.src    = uri;
448				tag.async  = false;
449				tag.onload = function() {
450					resolve( script );
451				};
452
453				document.head.appendChild( tag );
454			} );
455		},
456
457		loadStyle: function( style, uri ) {
458
459			if ( JetPopupFrontend.addedStyles.hasOwnProperty( style ) && JetPopupFrontend.addedStyles[ style ] ===  uri) {
460				return style;
461			}
462
463			JetPopupFrontend.addedStyles[ style ] = uri;
464
465			return new Promise( function( resolve, reject ) {
466				var tag = document.createElement( 'link' );
467
468				tag.id      = style;
469				tag.rel     = 'stylesheet';
470				tag.href    = uri;
471				tag.type    = 'text/css';
472				tag.media   = 'all';
473				tag.onload  = function() {
474					resolve( style );
475				};
476
477				document.head.appendChild( tag );
478			});
479		},
480
481		assetsLoaderPromise: function() {
482			return Promise.all( JetPopupFrontend.addedAssetsPromises );
483		},
484
485		maybeElementorFrontendInit: function( $popupContainer ) {
486			$popupContainer.find( 'div[data-element_type]' ).each( function() {
487				var $this       = $( this ),
488				    elementType = $this.data( 'element_type' );
489
490				if ( ! elementType ) {
491					return;
492				}
493
494				try {
495					if ( 'widget' === elementType ) {
496						elementType = $this.data( 'widget_type' );
497
498						if ( window.elementorFrontend && window.elementorFrontend.hooks ) {
499							window.elementorFrontend.hooks.doAction( 'frontend/element_ready/widget', $this, $ );
500						}
501					}
502
503					if ( window.elementorFrontend && window.elementorFrontend.hooks ) {
504						window.elementorFrontend.hooks.doAction( 'frontend/element_ready/global', $this, $ );
505						window.elementorFrontend.hooks.doAction( 'frontend/element_ready/' + elementType, $this, $ );
506					}
507
508				} catch ( err ) {
509					console.log(err);
510					$this.remove();
511
512					return false;
513				}
514			} );
515		},
516
517		maybeDefaultFrontendInit: function ( payload ) {
518			const contentElements = payload.contentElements || [],
519				$container = payload.$container;
520
521			$container.find( '[data-is-block*="/"]' ).each( ( index, el ) => {
522				window.JetPlugins.hooks.doAction( window.JetPlugins.hookNameFromBlock( el.dataset.isBlock ), jQuery( el ) );
523			} );
524		}
525	};
526
527	/**
528	 * [jetPopup description]
529	 * @param  {[type]} $popup   [description]
530	 * @param  {[type]} settings [description]
531	 * @return {[type]}          [description]
532	 */
533	window.jetPopup = function( $popup, settings ) {
534		var self                   = this,
535			$window                = $( window ),
536			$document              = $( document ),
537			popupSettings          = settings,
538			id                     = popupSettings['id'],
539			popupId                = popupSettings['jet-popup-id'],
540			popupsLocalStorageData = {},
541			//editMode               = Boolean( window.elementorFrontend.isEditMode() ),
542			isAnimation            = false,
543			isOpen                 = false,
544			ajaxGetContentHanler   = null,
545			ajaxContentLoaded      = false,
546			focusedBeforeOpen      = null,
547			$lastTrigger           = $();
548
549		self.getAccessibilityConfig = function() {
550			return window.jetPopupData && window.jetPopupData.accessibility ? window.jetPopupData.accessibility : {};
551		};
552
553		self.getPopupLabel = function() {
554			return self.getAccessibilityConfig().popupLabel || 'Popup dialog';
555		};
556
557		self.getCloseButtonLabel = function() {
558			return self.getAccessibilityConfig().closeButtonLabel || 'Close popup';
559		};
560
561		self.isFocusableElement = function( element ) {
562			let $element = $( element ),
563				tabIndex = $element.attr( 'tabindex' );
564
565			if ( ! element || ! $element.length ) {
566				return false;
567			}
568
569			if ( $element.is( '[disabled], [hidden], [aria-hidden="true"]' ) || $element.hasClass( 'elementor-hidden' ) ) {
570				return false;
571			}
572
573			if ( undefined !== tabIndex && 0 > parseInt( tabIndex, 10 ) ) {
574				return false;
575			}
576
577			return !! ( element.offsetWidth || element.offsetHeight || element.getClientRects().length );
578		};
579
580		self.getFocusableElements = function() {
581			return $popup.find( 'a[href], area[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [contenteditable="true"], [tabindex], .elementor-swiper-button, .jet-listing-dynamic-link__link' ).filter( function() {
582				return self.isFocusableElement( this );
583			} );
584		};
585
586		self.ensureDialogLabel = function() {
587			let $heading = $popup.find( '.jet-popup__container-content :header:visible:first, .jet-popup__container-content [role="heading"]:visible:first' ).first(),
588				generatedId = popupId + '-title';
589
590			$popup.removeAttr( 'aria-labelledby' );
591
592			if ( $heading.length ) {
593				if ( ! $heading.attr( 'id' ) ) {
594					$heading.attr( 'id', generatedId );
595				}
596
597				$popup.attr( 'aria-labelledby', $heading.attr( 'id' ) );
598				$popup.removeAttr( 'aria-label' );
599			} else {
600				$popup.attr( 'aria-label', self.getPopupLabel() );
601			}
602		};
603
604		self.preparePopupAccessibility = function() {
605			let $closeButton = $( '.jet-popup__close-button', $popup ).first();
606
607			$popup.attr( {
608				'role': 'dialog',
609				'aria-modal': 'true',
610				'aria-hidden': isOpen ? 'false' : 'true',
611				'tabindex': '-1',
612			} );
613
614			$( '.jet-popup__overlay, .jet-popup__container-overlay', $popup ).attr( 'aria-hidden', 'true' );
615
616			if ( $closeButton.length ) {
617				$closeButton.attr( {
618					'aria-label': self.getCloseButtonLabel(),
619				} );
620
621				if ( ! JetPopupFrontend.isNativeInteractiveElement( $closeButton[0] ) && ! $closeButton.is( '[tabindex]' ) ) {
622					$closeButton.attr( 'tabindex', '0' );
623				}
624
625				$closeButton.find( 'svg, i' ).attr( {
626					'aria-hidden': 'true',
627					'focusable': 'false',
628				} );
629
630			}
631
632			$popup.find( '.elementor-swiper-button' ).each( function() {
633				let $button = $( this );
634
635				if ( ! $button.is( '[tabindex]' ) ) {
636					$button.attr( 'tabindex', '0' );
637				}
638
639				if ( ! $button.is( '[role]' ) ) {
640					$button.attr( 'role', 'button' );
641				}
642			} );
643
644			self.ensureDialogLabel();
645		};
646
647		self.storeFocusContext = function( $trigger ) {
648			let activeElement = document.activeElement;
649
650			if ( $trigger && $trigger.length ) {
651				$lastTrigger = $trigger.first();
652				focusedBeforeOpen = $lastTrigger[0];
653			} else {
654				$lastTrigger = $();
655				focusedBeforeOpen = activeElement && document.body !== activeElement ? activeElement : null;
656			}
657
658			if ( $lastTrigger.length ) {
659				$lastTrigger.attr( 'aria-expanded', 'true' );
660			}
661		};
662
663		self.focusDefaultElement = function() {
664			let $closeButton = $( '.jet-popup__close-button', $popup ).first(),
665				$focusable = self.getFocusableElements(),
666				$target = $closeButton.length ? $closeButton : $focusable.first();
667
668			if ( ! $target.length ) {
669				$target = $( '.jet-popup__container', $popup ).first();
670			}
671
672			if ( $target.length && $target[0].focus ) {
673				window.setTimeout( function() {
674					try {
675						$target[0].focus( { preventScroll: true } );
676					} catch ( error ) {
677						$target[0].focus();
678					}
679				}, 0 );
680			}
681		};
682
683		self.restoreFocus = function() {
684			if ( $lastTrigger.length ) {
685				$lastTrigger.attr( 'aria-expanded', 'false' );
686			}
687
688			if ( focusedBeforeOpen && document.contains( focusedBeforeOpen ) && focusedBeforeOpen.focus ) {
689				try {
690					focusedBeforeOpen.focus( { preventScroll: true } );
691				} catch ( error ) {
692					focusedBeforeOpen.focus();
693				}
694			}
695
696			focusedBeforeOpen = null;
697			$lastTrigger = $();
698		};
699
700		self.moveFocusByOffset = function( offset ) {
701			let $focusable = self.getFocusableElements(),
702				activeIndex = $focusable.index( document.activeElement );
703
704			if ( ! $focusable.length ) {
705				return;
706			}
707
708			if ( -1 === activeIndex ) {
709				activeIndex = 0;
710			} else {
711				activeIndex = ( activeIndex + offset + $focusable.length ) % $focusable.length;
712			}
713
714			if ( $focusable.eq( activeIndex )[0] && $focusable.eq( activeIndex )[0].focus ) {
715				$focusable.eq( activeIndex )[0].focus();
716			}
717		};
718
719		self.handlePopupTabKey = function( event ) {
720			let $focusable = self.getFocusableElements(),
721				$firstElement = $focusable.first(),
722				$lastElement = $focusable.last();
723
724			if ( ! $focusable.length ) {
725				event.preventDefault();
726				$popup.trigger( 'focus' );
727
728				return;
729			}
730
731			if ( event.shiftKey && document.activeElement === $firstElement[0] ) {
732				event.preventDefault();
733				$lastElement[0].focus();
734			} else if ( ! event.shiftKey && document.activeElement === $lastElement[0] ) {
735				event.preventDefault();
736				$firstElement[0].focus();
737			}
738		};
739
740		self.handlePopupKeydown = function( event ) {
741			let key = event.key || '',
742				$target = $( event.target ),
743				isTypingControl = $target.is( 'input, textarea, select, [contenteditable="true"]' );
744
745			if ( ! isOpen ) {
746				return;
747			}
748
749			if ( 'Tab' === key || 9 === event.keyCode ) {
750				self.handlePopupTabKey( event );
751
752				return;
753			}
754
755			if ( ! isTypingControl && ( 'ArrowDown' === key || 40 === event.keyCode ) ) {
756				event.preventDefault();
757				self.moveFocusByOffset( 1 );
758
759				return;
760			}
761
762			if ( ! isTypingControl && ( 'ArrowUp' === key || 38 === event.keyCode ) ) {
763				event.preventDefault();
764				self.moveFocusByOffset( -1 );
765
766				return;
767			}
768
769			if ( 'Escape' === key || 27 === event.keyCode ) {
770				event.preventDefault();
771				self.hidePopup( {
772					constantly: popupSettings['show-once'],
773					popupId: popupSettings['jet-popup-id']
774				} );
775			}
776		};
777
778		self.onPopupShown = function() {
779			isOpen = true;
780			$popup.attr( 'aria-hidden', 'false' );
781			self.preparePopupAccessibility();
782			self.focusDefaultElement();
783		};
784
785		self.onPopupHidden = function() {
786			isOpen = false;
787			$popup.attr( 'aria-hidden', 'true' );
788			self.restoreFocus();
789		};
790
791		self.init = function() {
792			var popupAvailable = self.popupAvailableCheck();
793
794			if ( ! popupAvailable ) {
795				return false;
796			}
797
798			self.setLocalStorageData( popupId, 'enable' );
799
800			self.initCompatibilityHandler();
801
802			self.initOpenEvent();
803
804			self.initCloseEvent();
805			self.preparePopupAccessibility();
806			$popup.on( 'keydown.jetPopupA11y', self.handlePopupKeydown );
807
808			$window.trigger( 'jet-popup/init/after', {
809				self: self,
810				settings: popupSettings
811			} );
812		};
813
814		/**
815		 * [popupAvailableCheck description]
816		 * @return {[type]} [description]
817		 */
818		self.popupAvailableCheck = function() {
819			var storageData = self.getLocalStorageData() || {};
820
821			if ( ! storageData.hasOwnProperty( popupId ) ) {
822				return true;
823			}
824
825			var popupData     = storageData[ popupId ],
826				status        = 'enable',
827				showAgainDate = 'none';
828
829			if ( 'disable' === popupData ) {
830				return false;
831			}
832
833			if ( 'enable' === popupData ) {
834				return true;
835			}
836
837			if ( popupData.hasOwnProperty( 'status' ) ) {
838				status = popupData['status'];
839			}
840
841			if ( 'enable' === status ) {
842				return true;
843			}
844
845			if ( popupData.hasOwnProperty( 'show-again-date' ) ) {
846				showAgainDate = popupData['show-again-date'];
847			}
848
849			if ( 'none' === showAgainDate && 'disable' === status ) {
850				return false;
851			}
852
853			if ( showAgainDate < Date.now() ) {
854				return true;
855			} else {
856				return false;
857			}
858		};
859
860		/**
861		 * [initOpenEvent description]
862		 * @return {[type]} [description]
863		 */
864		self.initOpenEvent = function() {
865
866			$window.trigger( 'jet-popup/init-events/before', {
867				self: self,
868				settings: popupSettings
869			} );
870
871			switch ( popupSettings['open-trigger'] ) {
872				case 'page-load':
873					self.pageLoadEvent( popupSettings['page-load-delay'] );
874				break;
875
876				case 'user-inactive':
877					self.userInactiveEvent( popupSettings['user-inactivity-time'] );
878				break;
879
880				case 'scroll-trigger':
881					self.scrollPageEvent( popupSettings['scrolled-to'] );
882				break;
883
884				case 'try-exit-trigger':
885					self.tryExitEvent();
886				break;
887
888				case 'on-date':
889					self.onDateEvent( popupSettings['on-date'] );
890				break;
891
892				case 'on-time':
893					self.onTimeEvent( popupSettings['on-time-start'], popupSettings['on-time-end'] );
894				break;
895
896				case 'on-date-and-time':
897					self.onTimeAndDateEvent( popupSettings['start-date-and-time'], popupSettings['end-date-and-time'] );
898				break;
899
900				case 'weekly-schedule':
901					self.onWeekdaysAndTimeEvent(
902						popupSettings['on-weekdays'],
903						popupSettings['on-week-time-start'],
904						popupSettings['on-week-time-end']
905					);
906				break;
907
908				case 'custom-selector':
909					self.onCustomSelector( popupSettings['custom-selector'] );
910				break;$scope
911			}
912
913			$window.on('jet-popup-open-trigger', function( event ) {
914				var popupData   = event.popupData || {},
915					triggeredBy = event.triggeredBy || false,
916					popupUniqId = popupData.popupId || false,
917					constantly  = popupData.constantly;
918			
919				if ( popupUniqId == popupId ) {
920					if ( $popup.hasClass( 'jet-popup--hide-state' )) {
921						self.showPopup( popupData, triggeredBy );
922					} else {
923						self.hidePopup( {
924							constantly: constantly,
925							popupId: popupUniqId,
926						} );
927					}
928				}
929			});
930
931			$window.on( 'jet-popup-close-trigger', function( event ) {
932				var popupData   = event.popupData || {},
933					popupUniqId = popupData.popupId,
934					constantly  = popupData.constantly;
935
936				if ( popupUniqId == popupId ) {
937					self.hidePopup( {
938						popupId: popupUniqId,
939						constantly: constantly,
940					} );
941				}
942			});
943
944			$window.trigger( 'jet-popup/init-events/after', {
945				self: self,
946				settings: popupSettings
947			} );
948		};
949
950		/**
951		 * [initOnCloseEvent description]
952		 * @return {[type]} [description]
953		 */
954		self.initOnCloseEvent = function() {
955
956			var $htmlBody = $( 'html, body' );
957
958			if ( 'scroll-to-top' === popupSettings['close-event'] ) {
959				$htmlBody.animate( { scrollTop: 0 }, 'slow' );
960			}
961
962			if ( 'scroll-to-anchor' === popupSettings['close-event'] ) {
963				var anchor = $( '#' + popupSettings['сlose-event-anchor'] );
964
965				if ( anchor.length ) {
966					$htmlBody.animate( { scrollTop: anchor.offset().top }, 'slow' );
967				}
968			}
969		}
970
971		/**
972		 * [initCloseEvent description]
973		 * @return {[type]} [description]
974		 */
975		self.initCloseEvent = function() {
976
977			$popup.on( 'click', '.jet-popup__close-button', function( event ) {
978				var target = event.currentTarget;
979
980				self.hidePopup( {
981					constantly: popupSettings['show-once'],
982					popupId: popupSettings['jet-popup-id']
983				} );
984				self.initOnCloseEvent();
985			} );
986
987			if ( popupSettings['close-on-overlay-click'] ) {
988				$popup.on( 'click', '.jet-popup__overlay', function( event ) {
989					var target = event.currentTarget;
990
991					self.hidePopup( {
992						constantly: popupSettings['show-once'],
993						popupId: popupSettings['jet-popup-id']
994					} );
995					self.initOnCloseEvent();
996				} );
997			}
998
999			$document.on( 'keyup.jetPopup', function( event ) {
1000				var key = event.keyCode;
1001
1002				if ( 27 === key && isOpen ) {
1003					self.hidePopup( {
1004						constantly: popupSettings['show-once'],
1005						popupId: popupSettings['jet-popup-id']
1006					} );
1007				}
1008			} );
1009		};
1010
1011		/**
1012		 * [initCompatibilityHandler description]
1013		 * @return {[type]} [description]
1014		 */
1015		self.initCompatibilityHandler = function() {
1016			var $elementorProFormWidget = $( '.elementor-widget-form', $popup );
1017
1018			if ( $elementorProFormWidget[0] ) {
1019				$elementorProFormWidget.each( function() {
1020					var $this = $( this ),
1021						$form = $( '.elementor-form', $this );
1022
1023						$form.on( 'submit_success', function() {
1024
1025							if ( true !== popupSettings['close-after-form-submit'] ) {
1026								return;
1027							}
1028
1029							let delay = parseInt( popupSettings['close-after-form-delay'] || 0 );
1030							delay = delay * 1000;
1031						
1032							setTimeout( function() {
1033								$window.trigger( {
1034									type: 'jet-popup-close-trigger',
1035									popupData: {
1036										popupId: popupId,
1037										constantly: false
1038									}
1039								} );
1040							}, delay );
1041						
1042						});
1043				} );
1044			}
1045
1046			$( document ).on( 'jet-form-builder/ajax/on-success', function( event ) {
1047	
1048				if ( true !== popupSettings['close-after-form-submit'] ) {
1049					return;
1050				}
1051			
1052				let delay = parseInt( popupSettings['close-after-form-delay'] || 0 );
1053				delay = delay * 1000;
1054			
1055				setTimeout( function() {
1056					$window.trigger({
1057						type: 'jet-popup-close-trigger',
1058						popupData: {
1059							popupId: popupId,
1060							constantly: false
1061						}
1062					});
1063				}, delay );
1064			
1065			});
1066		};
1067
1068		/**
1069		 * Handle popup opening on page load event.
1070		 *
1071		 * @param {number} openDelay Delay before opening the popup (in seconds).
1072		 * @return {void}
1073		 */
1074		self.autoClosePopup = function() {
1075
1076			if ( ! popupSettings['automatically-close'] ) {
1077				return;
1078			}
1079
1080			let delay = parseInt( popupSettings['automatically-close'], 10 );
1081		
1082			if ( ! delay ) {
1083				return;
1084			}
1085		
1086			setTimeout( function() {
1087		
1088				if ( isOpen ) {
1089					self.hidePopup( {
1090						popupId: popupId,
1091						constantly: false
1092					} );
1093				}
1094		
1095			}, delay * 1000 );
1096		
1097		};
1098
1099		/**
1100		 * Page on load event
1101		 *
1102		 * @param  {int} openDelay Open delay time.
1103		 * @return {void}
1104		 */
1105		self.pageLoadEvent = function( openDelay ) {
1106			var delay = +openDelay || 0;
1107
1108			delay = delay * 1000;
1109
1110			$( function() {
1111				setTimeout( function() {
1112					self.showPopup();
1113				}, delay );
1114			} );
1115		};
1116
1117		/**
1118		 * User Inactivity event
1119		 *
1120		 * @param  {int} inactiveDelay [description]
1121		 * @return {void}
1122		 */
1123		self.userInactiveEvent = function( inactiveDelay ) {
1124			var delay      = +inactiveDelay || 0,
1125				isInactive = true;
1126
1127			delay = delay * 1000;
1128
1129			setTimeout( function() {
1130				if ( isInactive ) {
1131					self.showPopup();
1132				}
1133			}, delay );
1134
1135			$( document ).on( 'click focus resize keyup scroll', function() {
1136				isInactive = false;
1137			} );
1138		};
1139
1140		/**
1141		 * Scrolling Page Event
1142		 *
1143		 * @param  {int} scrollingValue Scrolling porgress value
1144		 * @return {void}
1145		 */
1146		self.scrollPageEvent = function( scrollingValue ) {
1147			var scrolledValue  = +scrollingValue || 0;
1148
1149			$window.on( 'scroll.cherryJetScrollEvent resize.cherryJetResizeEvent', function() {
1150				var $window          = $( window ),
1151					windowHeight     = $window.height(),
1152					documentHeight   = $( document ).height(),
1153					scrolledHeight   = documentHeight - windowHeight,
1154					scrolledProgress = Math.max( 0, Math.min( 1, $window.scrollTop() / scrolledHeight ) ) * 100;
1155
1156				if ( scrolledProgress >= scrolledValue ) {
1157					$window.off( 'scroll.cherryJetScrollEvent resize.cherryJetResizeEvent' );
1158					self.showPopup();
1159				}
1160			} ).trigger( 'scroll.cherryJetResizeEvent' );
1161		};
1162
1163		/**
1164		 * Viewport leave event
1165		 *
1166		 * @return {void}
1167		 */
1168		self.tryExitEvent = function() {
1169			var pageY = 0;
1170
1171			$( document ).on( 'mouseleave', 'body', function( event ) {
1172
1173				pageY = event.pageY - $window.scrollTop();
1174
1175				if ( 0 > pageY && $popup.hasClass( 'jet-popup--hide-state' ) ) {
1176					self.showPopup();
1177				}
1178			} );
1179		};
1180
1181		/**
1182		 * onDateEvent Event
1183		 *
1184		 * @return {void}
1185		 */
1186		self.onDateEvent = function( date ) {
1187			var nowDate   = Date.now(),
1188				startDate = Date.parse( date );
1189
1190			if ( startDate < nowDate ) {
1191
1192				setTimeout( function() {
1193					self.showPopup();
1194				}, 500 );
1195			}
1196		}
1197
1198		self.onWeekdaysAndTimeEvent = function( days = [], startTime = '00:00', endTime = '23:59' ) {
1199
1200			if ( ! days || ! days.length ) {
1201				return;
1202			}
1203		
1204			var nowTimeStamp = Date.now(),
1205				nowDate = new Date(),
1206				currentDay = nowDate.toLocaleString('en-US', { weekday: 'short' }).toLowerCase();
1207		
1208
1209			days = days.map( day => day.toLowerCase() );
1210		
1211			if ( ! days.includes( currentDay ) ) {
1212				return;
1213			}
1214		
1215			startTime = '' !== startTime ? startTime : '00:00';
1216			endTime   = '' !== endTime ? endTime : '23:59';
1217		
1218			var dateTimeFormat = new Intl.DateTimeFormat( 'en', { year: 'numeric', month: 'short', day: '2-digit' } ),
1219				[ { value: month },,{ value: day },,{ value: year } ] = dateTimeFormat.formatToParts( nowTimeStamp );
1220		
1221			var startDateTime = `${ month }. ${ day }, ${ year } ${ startTime }`,
1222				endDateTime   = `${ month }. ${ day }, ${ year } ${ endTime }`;
1223		
1224			var startTimeStamp = Date.parse( startDateTime ),
1225				endTimeStamp   = Date.parse( endDateTime );
1226		
1227			if ( startTimeStamp < nowTimeStamp && nowTimeStamp < endTimeStamp ) {
1228				setTimeout( function() {
1229					self.showPopup();
1230				}, 500 );
1231			}
1232		};
1233
1234		self.onTimeEvent = function( startTime = '00:00', endTime = '23:59' ) {
1235			var startTime = '' !== startTime ? startTime : '00:00',
1236				endTime = '' !== endTime ? endTime : '23:59',
1237				nowTimeStamp = Date.now(),
1238				dateTimeFormat = new Intl.DateTimeFormat( 'en', { year: 'numeric', month: 'short', day: '2-digit' } ),
1239				[ { value: month },,{ value: day },,{ value: year } ] = dateTimeFormat.formatToParts( nowTimeStamp ),
1240				startTime = `${ month }. ${ day }, ${ year } ${ startTime }`,
1241				endTime = `${ month }. ${ day }, ${ year } ${ endTime }`,
1242				startTimeStamp = Date.parse( startTime ),
1243				endTimeStamp = Date.parse( endTime );
1244
1245			if ( ( startTimeStamp < nowTimeStamp ) && ( nowTimeStamp < endTimeStamp ) ) {
1246				setTimeout( function() {
1247					self.showPopup();
1248				}, 500 );
1249			}
1250		}
1251
1252
1253		self.onTimeAndDateEvent = function( start, end ) {
1254
1255			var nowDateStamp   = Date.now(),
1256			startDateStamp = Date.parse( start ),
1257			endDateStamp = Date.parse( end );
1258
1259			if ( ( startDateStamp < nowDateStamp ) && ( nowDateStamp < endDateStamp ) ) {
1260				setTimeout( function() {
1261					self.showPopup();
1262				}, 500 );
1263			}
1264			
1265		}
1266
1267		/**
1268		 * Check DOM Loaded Selector
1269		 * @param  {[type]} selector [description]
1270		 * @return {[type]}          [description]
1271		 */
1272
1273		self.checkLoadedSelector = function( selector ) {
1274
1275			//Check Listing Grid Lazy Load
1276			$( document ).on( 'jet-engine/listing-grid/after-lazy-load', function() {
1277				self.onCustomSelector ( selector );
1278			});
1279
1280			//Check Open Mobile Menu
1281			$( '.jet-mobile-menu__toggle' ).closest( '.jet-mobile-menu__instance--slide-out-layout' ).on( 'click', function() {
1282				self.onCustomSelector ( selector );
1283			});
1284
1285        }
1286
1287		/**
1288		 * [onCustomSelector description]
1289		 * @param  {[type]} selector [description]
1290		 * @return {[type]}          [description]
1291		 */
1292		self.onCustomSelector = function( selector ) {
1293
1294			let $selector = $( selector );
1295
1296			if ( $selector[0] ) {
1297				$( 'body' ).off( 'click.jetPopup', selector ).on( 'click.jetPopup', selector, function( event ) {
1298					event.preventDefault();
1299			
1300					let $this   = $( this );
1301					let popupId = $this.data( 'popup' );
1302					let $popup  = $( '#jet-popup-' + popupId );
1303			
1304					if ( $popup.length && $popup.hasClass( 'jet-popup--show-state' ) ) {
1305						self.hidePopup( popupId, false );
1306					} else {
1307						self.showPopup( popupId, $this );
1308					}
1309				} );
1310			} else {
1311				self.checkLoadedSelector( selector );
1312			}
1313		}
1314
1315		/**
1316		 * Show Popup
1317		 *
1318		 * @return {void}
1319		 */
1320		self.showPopup = function( data, $trigger ) {
1321			var popupData              = data || {},
1322				animeOverlay           = null,
1323				animeContainer         = null,
1324				animeOverlaySettings   = jQuery.extend(
1325					{
1326						targets: $( '.jet-popup__overlay', $popup )[0]
1327					},
1328					self.avaliableEffects[ 'fade' ][ 'show' ]
1329				);
1330
1331			$trigger = $trigger || false;
1332
1333			if ( ! self.popupAvailableCheck() ) {
1334				return false;
1335			}
1336
1337			self.storeFocusContext( $trigger );
1338
1339			animeOverlay = anime( animeOverlaySettings );
1340
1341			$popup.toggleClass( 'jet-popup--hide-state jet-popup--show-state' );
1342
1343			if ( popupSettings['prevent-scrolling'] ) {
1344				$( 'body' ).addClass( 'jet-popup-prevent-scroll' );
1345			}
1346
1347			popupData = JetPopupFrontend.maybeExtendPopupData( popupData, $trigger );
1348			popupData = window.JetPlugins.hooks.applyFilters( 'jet-popup.show-popup.data', popupData, $popup, $trigger );
1349
1350			self.showContainer( popupData );
1351		};
1352
1353		/**
1354		 * [showContainer description]
1355		 * @return {[type]} [description]
1356		 */
1357		self.showContainer = function( data ) {
1358			var popupData        = data || {},
1359				popupDefaultData = {
1360					forceLoad: popupSettings['force-ajax'] || false, // Trigger Ajax Every Time
1361					customContent: '' // Show Popup with Custom Content
1362				},
1363				animeContainerInstance   = null,
1364				$popupContainer  = $( '.jet-popup__container', $popup ),
1365				$content         = $( '.jet-popup__container-content', $popup ),
1366				animeContainer   = jQuery.extend(
1367					{
1368						targets: $( '.jet-popup__container', $popup )[0],
1369						begin: function( anime ) {
1370							isAnimation = true;
1371
1372							$window.trigger( 'jet-popup/show-event/before-show', {
1373								self: self,
1374								data: popupData,
1375								anime: anime
1376							} );
1377						},
1378						complete: function( anime ) {
1379							isAnimation = false;
1380
1381							self.autoClosePopup();
1382							self.onPopupShown();
1383
1384							$window.trigger( 'jet-popup/show-event/after-show', {
1385								self: self,
1386								data: popupData,
1387								anime: anime
1388							} );
1389						}
1390					},
1391					self.avaliableEffects[ popupSettings['animation'] ][ 'show' ]
1392
1393				);
1394
1395			popupData = jQuery.extend( popupDefaultData, popupData );
1396
1397			// init Custom popup content
1398			if ( '' !== popupData.customContent ) {
1399				$content.html( popupData.customContent );
1400				self.elementorFrontendInit();
1401
1402				// Show Popup Container
1403				animeContainerInstance = anime( animeContainer );
1404
1405				$window.trigger( 'jet-popup/render-content/render-custom-content', {
1406					self: self,
1407					popup_id: id,
1408					data: popupData,
1409				} );
1410
1411				return false;
1412			}
1413
1414			if ( ! popupSettings['use-ajax'] ) {
1415				// Show Popup Container
1416				animeContainerInstance = anime( animeContainer );
1417
1418				$window.trigger( 'jet-popup/render-content/render-custom-content', {
1419					self: self,
1420					popup_id: id,
1421					data: popupData,
1422				} );
1423
1424				return false;
1425			}
1426
1427			if ( popupData.forceLoad ) {
1428				ajaxContentLoaded = false;
1429			}
1430
1431			if ( ajaxContentLoaded ) {
1432				// Show Popup Container
1433				animeContainerInstance = anime( animeContainer );
1434
1435				$window.trigger( 'jet-popup/render-content/show-content', {
1436					self: self,
1437					popup_id: id,
1438					data: popupData,
1439				} );
1440
1441				return false;
1442			}
1443
1444			popupData = jQuery.extend( popupData, {
1445				'popup_id': id,
1446				'page_url': window.location.href
1447			} );
1448
1449			ajaxGetContentHanler = jQuery.ajax( {
1450				type: 'POST',
1451				url: window.jetPopupData.ajax_url,
1452				data: {
1453					'action': 'jet_popup_get_content',
1454					'data': popupData
1455				},
1456				beforeSend: function( jqXHR, ajaxSettings ) {
1457
1458					if ( null !== ajaxGetContentHanler ) {
1459						ajaxGetContentHanler.abort();
1460					}
1461
1462					// Before ajax send Trigger
1463					$window.trigger( 'jet-popup/render-content/ajax/before-send', {
1464						self: self,
1465						popup_id: id,
1466						data: popupData
1467					} );
1468
1469					$popup.addClass( 'jet-popup--loading-state' );
1470				},
1471				error: function( jqXHR, ajaxSettings ) {},
1472				success: function( data, textStatus, jqXHR ) {
1473					var successType = data.type,
1474						contentData = data.content || false,
1475						$popupContainer = $( '.jet-popup__container-content', $popup );
1476
1477					$popup.removeClass( 'jet-popup--loading-state' );
1478
1479					if ( 'error' === successType ) {
1480						var message = data.message;
1481
1482						$content.html( '<h3>' + message + '</h3>' );
1483
1484						// Show Popup Container
1485						animeContainerInstance = anime( animeContainer );
1486					}
1487
1488					if ( 'success' === successType ) {
1489						let popupContent         = contentData['content'],
1490							popupContentElements = contentData['contentElements'],
1491						    popupScripts         = contentData['scripts'],
1492						    popupStyles          = contentData['styles'],
1493							popupAfterScripts   = contentData['afterScripts'];
1494
1495						for ( let { handle: scriptHandler, src: scriptSrc } of popupScripts ) {
1496							JetPopupFrontend.addedAssetsPromises.push( JetPopupFrontend.loadScriptAsync( scriptHandler, scriptSrc ) );
1497						}
1498
1499						if ( popupStyles && Object.keys( popupStyles ).length > 0 ) {
1500							for ( let styleHandler in popupStyles ) {
1501								JetPopupFrontend.addedAssetsPromises.push( JetPopupFrontend.loadStyle( styleHandler, popupStyles[ styleHandler ] ) );
1502							}
1503						}
1504
1505						JetPopupFrontend.assetsLoaderPromise().then( async function( value ) {
1506							ajaxContentLoaded = true;
1507
1508							// Ajax Success Trigger
1509							$window.trigger( 'jet-popup/render-content/ajax/success', {
1510								self: self,
1511								popup_id: id,
1512								data: popupData,
1513								request: data
1514							} );
1515
1516							// Render content
1517							if ( popupContent ) {
1518								$popupContainer.html( popupContent );
1519							}
1520
1521							if ( popupAfterScripts.length ) {
1522								await Promise.all( popupAfterScripts.map(
1523									( { handle, src } ) => JetPopupFrontend.loadScriptAsync( handle, src )
1524								) );
1525							}
1526
1527							// Before ajax frontend init
1528							$( window ).trigger( 'jet-popup/ajax/frontend-init/before', {
1529								$container: $popupContainer,
1530								content: popupContent,
1531								contentElements: popupContentElements,
1532								contentType: popupSettings['content-type'],
1533							} );
1534
1535							// Frontend init
1536							$( window ).trigger( 'jet-popup/ajax/frontend-init', {
1537								$container: $popupContainer,
1538								content: popupContent,
1539								contentElements: popupContentElements,
1540								contentType: popupSettings['content-type'],
1541							} );
1542
1543							// after ajax frontend init
1544							$( window ).trigger( 'jet-popup/ajax/frontend-init/after', {
1545								$container: $popupContainer,
1546								content: popupContent,
1547								contentElements: popupContentElements,
1548								contentType: popupSettings['content-type'],
1549							} );
1550
1551							// Show Popup Container
1552							animeContainerInstance = anime( animeContainer );
1553
1554						}, function( reason ) {
1555							console.log( 'Assets Loaded Error' );
1556						} );
1557					}
1558				}
1559			} );
1560		};
1561
1562		/**
1563		 * Hide Popup
1564		 *
1565		 * @return {void}
1566		 */
1567		self.hidePopup = function ( data ) {
1568			var popupData              = data || {},
1569				$content               = $( '.jet-popup__container-content', $popup ),
1570				constantly             = popupData.constantly || false,
1571				animeOverlay           = null,
1572				animeContainer         = null,
1573				animeOverlaySettings   = jQuery.extend( { targets: $( '.jet-popup__overlay', $popup )[0] }, self.avaliableEffects[ 'fade' ][ 'hide' ] ),
1574				animeContainerSettings = jQuery.extend(
1575					{
1576						targets: $( '.jet-popup__container', $popup )[0],
1577						begin: function( anime ) {
1578							isAnimation = true;
1579
1580							$window.trigger( 'jet-popup/hide-event/before-hide', {
1581								self: self,
1582								data: popupData,
1583								anime: anime
1584							} );
1585						},
1586						complete: function( anime ) {
1587							isAnimation = false;
1588							$popup.toggleClass( 'jet-popup--show-state jet-popup--hide-state' );
1589
1590							if ( popupSettings['use-ajax'] && popupSettings['force-ajax'] ) {
1591								$content.html( '' );
1592							}
1593
1594							if ( popupSettings['prevent-scrolling'] && !$( '.jet-popup--show-state' )[0] ) {
1595								$( 'body' ).removeClass( 'jet-popup-prevent-scroll' );
1596							}
1597
1598							self.onPopupHidden();
1599
1600							// After Popup Hide Action
1601							$window.trigger( 'jet-popup/hide-event/after-hide', {
1602								self: self,
1603								data: popupData,
1604								anime: anime
1605							} );
1606						}
1607					},
1608					self.avaliableEffects[ popupSettings['animation'] ][ 'hide' ]
1609				);
1610
1611			if ( constantly ) {
1612				self.setLocalStorageData( popupId, 'disable' );
1613			}
1614
1615			if ( isAnimation ){
1616				return false;
1617			}
1618
1619			if ( $popup.hasClass('jet-popup--show-state') ) {
1620				animeOverlay = anime( animeOverlaySettings );
1621				animeContainer = anime( animeContainerSettings );
1622			}
1623
1624			// On Hide Handler
1625			self.onHidePopupAction();
1626
1627			// Before Popup Hide Action
1628			$window.trigger( 'jet-popup/close-hide-event/before-hide', {
1629				self: self,
1630				data: popupData
1631			} );
1632		};
1633
1634		/**
1635		 * [elementorFrontendInit description]
1636		 * @return {[type]} [description]
1637		 */
1638		self.elementorFrontendInit = function() {
1639			var $content = $( '.jet-popup__container-content', $popup );
1640
1641			$content.find( 'div[data-element_type]' ).each( function() {
1642				var $this       = $( this ),
1643					elementType = $this.data( 'element_type' );
1644
1645				if (!elementType) {
1646					return;
1647				}
1648
1649				try {
1650					if( 'widget' === elementType ){
1651						elementType = $this.data( 'widget_type' );
1652						window.elementorFrontend.hooks.doAction( 'frontend/element_ready/widget', $this, $ );
1653					}
1654					window.elementorFrontend.hooks.doAction( 'frontend/element_ready/' + elementType, $this, $ );
1655
1656				} catch( err ) {
1657					console.log(err);
1658
1659					$this.remove();
1660
1661					return false;
1662				}
1663
1664			});
1665
1666			// On Show Handler
1667			self.onShowPopupAction();
1668		}
1669
1670		/**
1671		 * [onShowPopupAction description]
1672		 * @return {[type]} [description]
1673		 */
1674		self.onShowPopupAction = function() {};
1675
1676		/**
1677		 * [onHidePopupAction description]
1678		 * @return {[type]} [description]
1679		 */
1680		self.onHidePopupAction = function() {};
1681
1682		/**
1683		 * Avaliable Effects
1684		 */
1685
1686		const useCustomDuration = popupSettings['animation_custom_duration'] === true;
1687
1688		let inDuration  = false;
1689		let outDuration = false;
1690		
1691		if ( useCustomDuration ) {
1692			inDuration  = popupSettings['animation_in_duration'];
1693			outDuration = popupSettings['animation_out_duration'];
1694		}
1695
1696		self.avaliableEffects = {
1697			'none': {
1698				'show': {
1699					duration: inDuration || 0,
1700					opacity: { value: [1, 1] }
1701				},
1702				'hide': {
1703					duration: outDuration || 0,
1704					opacity: { value: [1, 1] }
1705				}
1706			},
1707		
1708			'fade': {
1709				'show': {
1710					opacity: { value: [0, 1], duration: inDuration || 600, easing: 'easeOutQuart' }
1711				},
1712				'hide': {
1713					opacity: { value: [1, 0], duration: outDuration || 400, easing: 'easeOutQuart' }
1714				}
1715			},
1716		
1717			'zoom-in': {
1718				'show': {
1719					duration: inDuration || 500,
1720					easing: 'easeOutQuart',
1721					opacity: { value: [0, 1] },
1722					scale: { value: [0.75, 1] }
1723				},
1724				'hide': {
1725					duration: outDuration || 400,
1726					easing: 'easeOutQuart',
1727					opacity: { value: [1, 0] },
1728					scale: { value: [1, 0.75] }
1729				}
1730			},
1731		
1732			'zoom-out': {
1733				'show': {
1734					duration: inDuration || 500,
1735					easing: 'easeOutQuart',
1736					opacity: { value: [0, 1] },
1737					scale: { value: [1.25, 1] }
1738				},
1739				'hide': {
1740					duration: outDuration || 400,
1741					easing: 'easeOutQuart',
1742					opacity: { value: [1, 0] },
1743					scale: { value: [1, 1.25] }
1744				}
1745			},
1746		
1747			'rotate': {
1748				'show': {
1749					duration: inDuration || 500,
1750					easing: 'easeOutQuart',
1751					opacity: { value: [0, 1] },
1752					scale: { value: [0.75, 1] },
1753					rotate: { value: [-65, 0] }
1754				},
1755				'hide': {
1756					duration: outDuration || 400,
1757					easing: 'easeOutQuart',
1758					opacity: { value: [1, 0] },
1759					scale: { value: [1, 0.9] }
1760				}
1761			},
1762		
1763			'move-up': {
1764				'show': {
1765					duration: inDuration || 500,
1766					easing: 'easeOutExpo',
1767					opacity: { value: [0, 1] },
1768					translateY: { value: [50, 1] }
1769				},
1770				'hide': {
1771					duration: outDuration || 400,
1772					easing: 'easeOutQuart',
1773					opacity: { value: [1, 0] },
1774					translateY: { value: [1, 50] }
1775				}
1776			},
1777		
1778			'flip-x': {
1779				'show': {
1780					duration: inDuration || 500,
1781					easing: 'easeOutExpo',
1782					opacity: { value: [0, 1] },
1783					rotateX: { value: [65, 0] }
1784				},
1785				'hide': {
1786					duration: outDuration || 400,
1787					easing: 'easeOutQuart',
1788					opacity: { value: [1, 0] }
1789				}
1790			},
1791		
1792			'flip-y': {
1793				'show': {
1794					duration: inDuration || 500,
1795					easing: 'easeOutExpo',
1796					opacity: { value: [0, 1] },
1797					rotateY: { value: [65, 0] }
1798				},
1799				'hide': {
1800					duration: outDuration || 400,
1801					easing: 'easeOutQuart',
1802					opacity: { value: [1, 0] }
1803				}
1804			},
1805		
1806			'bounce-in': {
1807				'show': {
1808					opacity: { value: [0, 1], duration: inDuration || 500, easing: 'easeOutQuart' },
1809					scale: {
1810						value: [0.2, 1],
1811						duration: inDuration || 800,
1812						elasticity: function(el, i, l) { return (400 + i * 200); }
1813					}
1814				},
1815				'hide': {
1816					duration: outDuration || 400,
1817					easing: 'easeOutQuart',
1818					opacity: { value: [1, 0] },
1819					scale: { value: [1, 0.8] }
1820				}
1821			},
1822		
1823			'bounce-out': {
1824				'show': {
1825					opacity: { value: [0, 1], duration: inDuration || 500, easing: 'easeOutQuart' },
1826					scale: {
1827						value: [1.8, 1],
1828						duration: inDuration || 800,
1829						elasticity: function(el, i, l) { return (400 + i * 200); }
1830					}
1831				},
1832				'hide': {
1833					duration: outDuration || 400,
1834					easing: 'easeOutQuart',
1835					opacity: { value: [1, 0] },
1836					scale: { value: [1, 1.5] }
1837				}
1838			},
1839		
1840			'slide-in-up': {
1841				'show': {
1842					opacity: { value: [0, 1], duration: inDuration || 400, easing: 'easeOutQuart' },
1843					translateY: { value: ['100vh', 0], duration: inDuration || 750, easing: 'easeOutQuart' }
1844				},
1845				'hide': {
1846					duration: outDuration || 400,
1847					easing: 'easeInQuart',
1848					opacity: { value: [1, 0] },
1849					translateY: { value: [0, '100vh'] }
1850				}
1851			},
1852		
1853			'slide-in-right': {
1854				'show': {
1855					opacity: { value: [0, 1], duration: inDuration || 400, easing: 'easeOutQuart' },
1856					translateX: { value: ['100vw', 0], duration: inDuration || 750, easing: 'easeOutQuart' }
1857				},
1858				'hide': {
1859					duration: outDuration || 400,
1860					easing: 'easeInQuart',
1861					opacity: { value: [1, 0] },
1862					translateX: { value: [0, '100vw'] }
1863				}
1864			},
1865		
1866			'slide-in-down': {
1867				'show': {
1868					opacity: { value: [0, 1], duration: inDuration || 400, easing: 'easeOutQuart' },
1869					translateY: { value: ['-100vh', 0], duration: inDuration || 750, easing: 'easeOutQuart' }
1870				},
1871				'hide': {
1872					duration: outDuration || 400,
1873					easing: 'easeInQuart',
1874					opacity: { value: [1, 0] },
1875					translateY: { value: [0, '-100vh'] }
1876				}
1877			},
1878		
1879			'slide-in-left': {
1880				'show': {
1881					opacity: { value: [0, 1], duration: inDuration || 400, easing: 'easeOutQuart' },
1882					translateX: { value: ['-100vw', 0], duration: inDuration || 750, easing: 'easeOutQuart' }
1883				},
1884				'hide': {
1885					duration: outDuration || 400,
1886					easing: 'easeInQuart',
1887					opacity: { value: [1, 0] },
1888					translateX: { value: [0, '-100vw'] }
1889				}
1890			}
1891		};
1892		
1893		
1894		/**
1895		 * Get localStorage data.
1896		 *
1897		 * @return {object|boolean}
1898		 */
1899		self.getLocalStorageData = function() {
1900
1901			try {
1902				return JSON.parse( localStorage.getItem( 'jetPopupData' ) );
1903			} catch ( e ) {
1904				return false;
1905			}
1906		};
1907
1908		/**
1909		 * Set localStorage data.
1910		 *
1911		 * @return {object|boolean}
1912		 */
1913		self.setLocalStorageData = function( id, status ) {
1914
1915			var jetPopupData = self.getLocalStorageData() || {},
1916				newData      = {};
1917
1918			newData['status'] = status;
1919
1920			if ( 'disable' === status ) {
1921
1922				var nowDate             = Date.now(),
1923					showAgainDelay      = popupSettings['show-again-delay'],
1924					showAgainDate       = 'none' !== showAgainDelay ? ( nowDate + showAgainDelay ) : 'none';
1925
1926				newData['show-again-date'] = showAgainDate;
1927			}
1928
1929			jetPopupData[ id ] = newData;
1930
1931			localStorage.setItem( 'jetPopupData', JSON.stringify( jetPopupData ) );
1932		}
1933
1934	}
1935
1936	window.JetPopupFrontend.init();
1937
1938}( jQuery ) );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.