PageSourceSearch

https://easymovingcalgary.com/wp-content/plugins/jet-popup/assets/js/jet-popup-frontend.js?ver=2.2.1

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