PageSourceSearch

https://myant.ca/wp-content/plugins/jet-popup/assets/js/jet-popup-frontend.js?ver=2.0.20.2

js myant.ca collected 2026-09-28 06:30:43 UTC 35,803 bytes, 1,550 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		init: function() {
14			let $popup_list = $( '.jet-popup.jet-popup--front-mode' );
15
16			$popup_list.each( function( index ) {
17				let $target  = $( this ),
18					instance = null,
19					settings = $target.data( 'settings' );
20
21				instance = new window.jetPopup( $target, settings );
22				instance.init();
23			} );
24
25			JetPopupFrontend.initAttachedPopups();
26
27			JetPopupFrontend.initBlocks();
28
29			$( window ).on( 'jet-popup/ajax/frontend-init', ( event, payload ) => {
30
31				switch ( payload.contentType ) {
32					case 'elementor':
33						JetPopupFrontend.maybeElementorFrontendInit( payload.$container );
34						break;
35					case 'default':
36						JetPopupFrontend.maybeDefaultFrontendInit( payload );
37						break
38				}
39			} );
40		},
41
42		initAttachedPopups: function ( $scope ) {
43			$scope = $scope || $( 'body' );
44
45			$scope.find( '[data-popup-instance]' ).each( ( index, el ) => {
46				let $this = $( el ),
47					popupId = $this.data( 'popup-instance' ) || 'none',
48					triggerType = $this.data( 'popup-trigger-type' ) || 'none',
49					clickedCustomClass = $this.data( 'popup-custom-selector' ) || '',
50					popupData = {
51						popupId: `jet-popup-${ popupId }`,
52					};
53
54				if ( $this.hasClass( 'jet-popup-attach-event-inited' ) ) {
55					return;
56				}
57
58				$this.addClass( 'jet-popup-attach-event-inited' );
59
60				switch( triggerType ) {
61					case 'click-self':
62						$this.addClass( 'jet-popup-cursor-pointer' );
63
64						$this.on( 'click.JetPopup', function( event ) {
65							event.preventDefault();
66
67							$( window ).trigger( {
68								type: 'jet-popup-open-trigger',
69								popupData: popupData,
70								triggeredBy: $this,
71							} );
72
73							return false;
74						} );
75						break;
76					case 'click-selector':
77
78						if ( '' !== clickedCustomClass ) {
79							$this.find( clickedCustomClass ).addClass( 'jet-popup-cursor-pointer' );
80
81							$this.on( 'click.JetPopup', clickedCustomClass, function( event ) {
82								event.preventDefault();
83
84								$( window ).trigger( {
85									type: 'jet-popup-open-trigger',
86									popupData: popupData,
87									triggeredBy: $this,
88								} );
89
90								return false;
91							} );
92						}
93						break;
94					case 'hover':
95						$this.on( 'mouseenter.JetPopup', function( event ) {
96
97							$( window ).trigger( {
98								type: 'jet-popup-open-trigger',
99								popupData: popupData,
100								triggeredBy: $this,
101							} );
102						} );
103						break;
104					case 'scroll-to':
105						const observer = new IntersectionObserver(( entries ) => {
106							entries.forEach(( entry ) => {
107
108								if ( entry.isIntersecting ) {
109
110									$( window ).trigger( {
111										type: 'jet-popup-open-trigger',
112										popupData: popupData,
113										triggeredBy: $this,
114									} );
115								}			
116							})
117						},
118						{ 
119							threshold: 0.5
120						});
121
122						for ( let i = 0; i < $( $this ).length; i++ ) {
123							const elements = $( $this )[i];
124							observer.observe( elements );
125						} 
126
127						break;
128				}
129			} );
130		},
131
132		initBlocks: function( $scope ) {
133			$scope = $scope || $( 'body' );
134
135			window.JetPlugins.init( $scope, [
136				{
137					block: 'jet-popup/action-button',
138					callback: ( $scope ) => {
139						let $button    = $( '.jet-popup-action-button__instance', $scope ),
140							actionType = $scope.data( 'action-type' );
141
142						JetPopupFrontend.actionButtonHandle( $button, actionType );
143					}
144				}
145			] );
146		},
147
148		actionButtonBlock: function( $scope ) {
149			var $button    = $( '.jet-popup-action-button__instance', $scope ),
150				actionType = $scope.data( 'action-type' );
151
152			JetPopupFrontend.actionButtonHandle( $button, actionType );
153		},
154
155		actionButtonHandle: function ( $button, actionType = 'link' ) {
156
157			switch ( actionType ) {
158
159				case 'link':
160
161					$button.on( 'click.JetPopup', function( event ) {
162						event.preventDefault();
163
164						var $currentPopup = $button.closest( '.jet-popup' ),
165							link          = $( this ).attr( 'href' ),
166							target        = $( this ).attr( 'target' ),
167							popupId       = $currentPopup.attr( 'id' );
168
169						$( window ).trigger( {
170							type: 'jet-popup-close-trigger',
171							popupData: {
172								popupId: popupId,
173								constantly: false
174							}
175						} );
176
177						if ( '_blank' === target  ) {
178							window.open( link, '_blank' );
179						} else {
180							window.open( link, '_self' );
181						}
182
183						return false;
184					} );
185					break;
186
187				case 'leave':
188					$button.on( 'click.JetPopup', function( event ) {
189						event.preventDefault();
190
191						window.history.back();
192					} );
193					break;
194
195				case 'close-popup':
196					$button.on( 'click.JetPopup', function( event ) {
197						event.preventDefault();
198
199						var $currentPopup = $button.closest( '.jet-popup' ),
200							popupId = $currentPopup.attr( 'id' );
201
202						$( window ).trigger( {
203							type: 'jet-popup-close-trigger',
204							popupData: {
205								popupId: popupId,
206								constantly: false
207							}
208						} );
209					} );
210					break;
211
212				case 'close-all-popups':
213					$button.on( 'click.JetPopup', function( event ) {
214						event.preventDefault();
215
216						var $popups = $( '.jet-popup' );
217
218						if ( $popups[0] ) {
219							$popups.each( function( index ) {
220								var $popup  = $( this ),
221									popupId = $popup.attr( 'id' );
222
223								$( window ).trigger( {
224									type: 'jet-popup-close-trigger',
225									popupData: {
226										popupId: popupId,
227										constantly: false
228									}
229								} );
230							} );
231						}
232					} );
233					break;
234
235				case 'close-constantly':
236					$button.on( 'click.JetPopup', function( event ) {
237						event.preventDefault();
238
239						var $currentPopup = $button.closest( '.jet-popup' ),
240							popupId = $currentPopup.attr( 'id' );
241
242						$( window ).trigger( {
243							type: 'jet-popup-close-trigger',
244							popupData: {
245								popupId: popupId,
246								constantly: true
247							}
248						} );
249					} );
250					break;
251
252				case 'close-all-constantly':
253					$button.on( 'click.JetPopup', function( event ) {
254						event.preventDefault();
255
256						var $popups = $( '.jet-popup' );
257
258						if ( $popups[0] ) {
259							$popups.each( function( index ) {
260								var $popup  = $( this ),
261									popupId = $popup.attr( 'id' );
262
263								$( window ).trigger( {
264									type: 'jet-popup-close-trigger',
265									popupData: {
266										popupId: popupId,
267										constantly: true
268									}
269								} );
270							} );
271						}
272					} );
273					break;
274			}
275		},
276
277		loadScriptAsync: function( script, uri ) {
278
279			if ( JetPopupFrontend.addedScripts.hasOwnProperty( script ) ) {
280				return script;
281			}
282
283			JetPopupFrontend.addedScripts[ script ] = uri;
284
285			const asset = document.getElementById( script + '-js' );
286
287			if ( asset ) {
288				return script;
289			}
290
291			return new Promise( function( resolve, reject ) {
292				var tag = document.createElement( 'script' );
293
294				tag.src    = uri;
295				tag.async  = false;
296				tag.onload = function() {
297					resolve( script );
298				};
299
300				document.head.appendChild( tag );
301			} );
302		},
303
304		loadStyle: function( style, uri ) {
305
306			if ( JetPopupFrontend.addedStyles.hasOwnProperty( style ) && JetPopupFrontend.addedStyles[ style ] ===  uri) {
307				return style;
308			}
309
310			JetPopupFrontend.addedStyles[ style ] = uri;
311
312			return new Promise( function( resolve, reject ) {
313				var tag = document.createElement( 'link' );
314
315				tag.id      = style;
316				tag.rel     = 'stylesheet';
317				tag.href    = uri;
318				tag.type    = 'text/css';
319				tag.media   = 'all';
320				tag.onload  = function() {
321					resolve( style );
322				};
323
324				document.head.appendChild( tag );
325			});
326		},
327
328		assetsLoaderPromise: function() {
329			return Promise.all( JetPopupFrontend.addedAssetsPromises );
330		},
331
332		maybeElementorFrontendInit: function( $popupContainer ) {
333			$popupContainer.find( 'div[data-element_type]' ).each( function() {
334				var $this       = $( this ),
335				    elementType = $this.data( 'element_type' );
336
337				if ( ! elementType ) {
338					return;
339				}
340
341				try {
342					if ( 'widget' === elementType ) {
343						elementType = $this.data( 'widget_type' );
344
345						if ( window.elementorFrontend && window.elementorFrontend.hooks ) {
346							window.elementorFrontend.hooks.doAction( 'frontend/element_ready/widget', $this, $ );
347						}
348					}
349
350					if ( window.elementorFrontend && window.elementorFrontend.hooks ) {
351						window.elementorFrontend.hooks.doAction( 'frontend/element_ready/global', $this, $ );
352						window.elementorFrontend.hooks.doAction( 'frontend/element_ready/' + elementType, $this, $ );
353					}
354
355				} catch ( err ) {
356					console.log(err);
357					$this.remove();
358
359					return false;
360				}
361			} );
362		},
363
364		maybeDefaultFrontendInit: function ( payload ) {
365			const contentElements = payload.contentElements || [],
366				$container = payload.$container;
367
368			$container.find( '[data-is-block*="/"]' ).each( ( index, el ) => {
369				window.JetPlugins.hooks.doAction( window.JetPlugins.hookNameFromBlock( el.dataset.isBlock ), jQuery( el ) );
370			} );
371		}
372	};
373
374	/**
375	 * [jetPopup description]
376	 * @param  {[type]} $popup   [description]
377	 * @param  {[type]} settings [description]
378	 * @return {[type]}          [description]
379	 */
380	window.jetPopup = function( $popup, settings ) {
381		var self                   = this,
382			$window                = $( window ),
383			$document              = $( document ),
384			popupSettings          = settings,
385			id                     = popupSettings['id'],
386			popupId                = popupSettings['jet-popup-id'],
387			popupsLocalStorageData = {},
388			//editMode               = Boolean( window.elementorFrontend.isEditMode() ),
389			isAnimation            = false,
390			isOpen                 = false,
391			ajaxGetContentHanler   = null,
392			ajaxContentLoaded      = false;
393
394		self.init = function() {
395			var popupAvailable = self.popupAvailableCheck();
396
397			if ( ! popupAvailable ) {
398				return false;
399			}
400
401			self.setLocalStorageData( popupId, 'enable' );
402
403			self.initCompatibilityHandler();
404
405			self.initOpenEvent();
406
407			self.initCloseEvent();
408
409			$window.trigger( 'jet-popup/init/after', {
410				self: self,
411				settings: popupSettings
412			} );
413		};
414
415		/**
416		 * [popupAvailableCheck description]
417		 * @return {[type]} [description]
418		 */
419		self.popupAvailableCheck = function() {
420			var storageData = self.getLocalStorageData() || {};
421
422			if ( ! storageData.hasOwnProperty( popupId ) ) {
423				return true;
424			}
425
426			var popupData     = storageData[ popupId ],
427				status        = 'enable',
428				showAgainDate = 'none';
429
430			if ( 'disable' === popupData ) {
431				return false;
432			}
433
434			if ( 'enable' === popupData ) {
435				return true;
436			}
437
438			if ( popupData.hasOwnProperty( 'status' ) ) {
439				status = popupData['status'];
440			}
441
442			if ( 'enable' === status ) {
443				return true;
444			}
445
446			if ( popupData.hasOwnProperty( 'show-again-date' ) ) {
447				showAgainDate = popupData['show-again-date'];
448			}
449
450			if ( 'none' === showAgainDate && 'disable' === status ) {
451				return false;
452			}
453
454			if ( showAgainDate < Date.now() ) {
455				return true;
456			} else {
457				return false;
458			}
459		};
460
461		/**
462		 * [initOpenEvent description]
463		 * @return {[type]} [description]
464		 */
465		self.initOpenEvent = function() {
466
467			$window.trigger( 'jet-popup/init-events/before', {
468				self: self,
469				settings: popupSettings
470			} );
471
472			switch ( popupSettings['open-trigger'] ) {
473				case 'page-load':
474					self.pageLoadEvent( popupSettings['page-load-delay'] );
475				break;
476
477				case 'user-inactive':
478					self.userInactiveEvent( popupSettings['user-inactivity-time'] );
479				break;
480
481				case 'scroll-trigger':
482					self.scrollPageEvent( popupSettings['scrolled-to'] );
483				break;
484
485				case 'try-exit-trigger':
486					self.tryExitEvent();
487				break;
488
489				case 'on-date':
490					self.onDateEvent( popupSettings['on-date'] );
491				break;
492
493				case 'on-time':
494					self.onTimeEvent( popupSettings['on-time-start'], popupSettings['on-time-end'] );
495				break;
496
497				case 'on-date-and-time':
498					self.onTimeAndDateEvent( popupSettings['start-date-and-time'], popupSettings['end-date-and-time'] );
499				break;
500
501				case 'custom-selector':
502					self.onCustomSelector( popupSettings['custom-selector'] );
503				break;$scope
504			}
505
506			$window.on('jet-popup-open-trigger', function( event ) {
507				var popupData   = event.popupData || {},
508					triggeredBy = event.triggeredBy || false,
509					popupUniqId = popupData.popupId || false,
510					constantly  = popupData.constantly;
511			
512				if ( popupUniqId == popupId ) {
513					if ( $popup.hasClass( 'jet-popup--hide-state' )) {
514						self.showPopup( popupData, triggeredBy );
515					} else {
516						self.hidePopup( {
517							constantly: constantly,
518							popupId: popupUniqId,
519						} );
520					}
521				}
522			});
523
524			$window.on( 'jet-popup-close-trigger', function( event ) {
525				var popupData   = event.popupData || {},
526					popupUniqId = popupData.popupId,
527					constantly  = popupData.constantly;
528
529				if ( popupUniqId == popupId ) {
530					self.hidePopup( {
531						popupId: popupUniqId,
532						constantly: constantly,
533					} );
534				}
535			});
536
537			$window.trigger( 'jet-popup/init-events/after', {
538				self: self,
539				settings: popupSettings
540			} );
541		};
542
543		/**
544		 * [initOnCloseEvent description]
545		 * @return {[type]} [description]
546		 */
547		self.initOnCloseEvent = function() {
548
549			var $htmlBody = $( 'html, body' );
550
551			if ( 'scroll-to-top' === popupSettings['close-event'] ) {
552				$htmlBody.animate( { scrollTop: 0 }, 'slow' );
553			}
554
555			if ( 'scroll-to-anchor' === popupSettings['close-event'] ) {
556				var anchor = $( '#' + popupSettings['сlose-event-anchor'] );
557
558				if ( anchor.length ) {
559					$htmlBody.animate( { scrollTop: anchor.offset().top }, 'slow' );
560				}
561			}
562		}
563
564		/**
565		 * [initCloseEvent description]
566		 * @return {[type]} [description]
567		 */
568		self.initCloseEvent = function() {
569
570			$popup.on( 'click', '.jet-popup__close-button', function( event ) {
571				var target = event.currentTarget;
572
573				self.hidePopup( {
574					constantly: popupSettings['show-once'],
575					popupId: popupSettings['jet-popup-id']
576				} );
577				self.initOnCloseEvent();
578			} );
579
580			if ( popupSettings['close-on-overlay-click'] ) {
581				$popup.on( 'click', '.jet-popup__overlay', function( event ) {
582					var target = event.currentTarget;
583
584					self.hidePopup( {
585						constantly: popupSettings['show-once'],
586						popupId: popupSettings['jet-popup-id']
587					} );
588					self.initOnCloseEvent();
589				} );
590			}
591
592			$document.on( 'keyup.jetPopup', function( event ) {
593				var key = event.keyCode;
594
595				if ( 27 === key && isOpen ) {
596					self.hidePopup( {
597						constantly: popupSettings['show-once'],
598						popupId: popupSettings['jet-popup-id']
599					} );
600				}
601			} );
602		};
603
604		/**
605		 * [initCompatibilityHandler description]
606		 * @return {[type]} [description]
607		 */
608		self.initCompatibilityHandler = function() {
609			var $elementorProFormWidget = $( '.elementor-widget-form', $popup );
610
611			if ( $elementorProFormWidget[0] ) {
612				$elementorProFormWidget.each( function() {
613					var $this = $( this ),
614						$form = $( '.elementor-form', $this );
615
616					$form.on( 'submit_success', function( data ) {
617
618						setTimeout( function() {
619							$window.trigger( {
620								type: 'jet-popup-close-trigger',
621								popupData: {
622									popupId: popupId,
623									constantly: false
624								}
625							} );
626						}, 3000 );
627
628					} );
629				} );
630			}
631		};
632
633		/**
634		 * Page on load event
635		 *
636		 * @param  {int} openDelay Open delay time.
637		 * @return {void}
638		 */
639		self.pageLoadEvent = function( openDelay ) {
640			var delay = +openDelay || 0;
641
642			delay = delay * 1000;
643
644			$( function() {
645				setTimeout( function() {
646					self.showPopup();
647				}, delay );
648			} );
649		};
650
651		/**
652		 * User Inactivity event
653		 *
654		 * @param  {int} inactiveDelay [description]
655		 * @return {void}
656		 */
657		self.userInactiveEvent = function( inactiveDelay ) {
658			var delay      = +inactiveDelay || 0,
659				isInactive = true;
660
661			delay = delay * 1000;
662
663			setTimeout( function() {
664				if ( isInactive ) {
665					self.showPopup();
666				}
667			}, delay );
668
669			$( document ).on( 'click focus resize keyup scroll', function() {
670				isInactive = false;
671			} );
672		};
673
674		/**
675		 * Scrolling Page Event
676		 *
677		 * @param  {int} scrollingValue Scrolling porgress value
678		 * @return {void}
679		 */
680		self.scrollPageEvent = function( scrollingValue ) {
681			var scrolledValue  = +scrollingValue || 0;
682
683			$window.on( 'scroll.cherryJetScrollEvent resize.cherryJetResizeEvent', function() {
684				var $window          = $( window ),
685					windowHeight     = $window.height(),
686					documentHeight   = $( document ).height(),
687					scrolledHeight   = documentHeight - windowHeight,
688					scrolledProgress = Math.max( 0, Math.min( 1, $window.scrollTop() / scrolledHeight ) ) * 100;
689
690				if ( scrolledProgress >= scrolledValue ) {
691					$window.off( 'scroll.cherryJetScrollEvent resize.cherryJetResizeEvent' );
692					self.showPopup();
693				}
694			} ).trigger( 'scroll.cherryJetResizeEvent' );
695		};
696
697		/**
698		 * Viewport leave event
699		 *
700		 * @return {void}
701		 */
702		self.tryExitEvent = function() {
703			var pageY = 0;
704
705			$( document ).on( 'mouseleave', 'body', function( event ) {
706
707				pageY = event.pageY - $window.scrollTop();
708
709				if ( 0 > pageY && $popup.hasClass( 'jet-popup--hide-state' ) ) {
710					self.showPopup();
711				}
712			} );
713		};
714
715		/**
716		 * onDateEvent Event
717		 *
718		 * @return {void}
719		 */
720		self.onDateEvent = function( date ) {
721			var nowDate   = Date.now(),
722				startDate = Date.parse( date );
723
724			if ( startDate < nowDate ) {
725
726				setTimeout( function() {
727					self.showPopup();
728				}, 500 );
729			}
730		}
731
732		self.onTimeEvent = function( startTime = '00:00', endTime = '23:59' ) {
733			var startTime = '' !== startTime ? startTime : '00:00',
734				endTime = '' !== endTime ? endTime : '23:59',
735				nowTimeStamp = Date.now(),
736				dateTimeFormat = new Intl.DateTimeFormat( 'en', { year: 'numeric', month: 'short', day: '2-digit' } ),
737				[ { value: month },,{ value: day },,{ value: year } ] = dateTimeFormat.formatToParts( nowTimeStamp ),
738				startTime = `${ month }. ${ day }, ${ year } ${ startTime }`,
739				endTime = `${ month }. ${ day }, ${ year } ${ endTime }`,
740				startTimeStamp = Date.parse( startTime ),
741				endTimeStamp = Date.parse( endTime );
742
743			if ( ( startTimeStamp < nowTimeStamp ) && ( nowTimeStamp < endTimeStamp ) ) {
744				setTimeout( function() {
745					self.showPopup();
746				}, 500 );
747			}
748		}
749
750
751		self.onTimeAndDateEvent = function( start, end ) {
752
753			var nowDateStamp   = Date.now(),
754			startDateStamp = Date.parse( start ),
755			endDateStamp = Date.parse( end );
756
757			if ( ( startDateStamp < nowDateStamp ) && ( nowDateStamp < endDateStamp ) ) {
758				setTimeout( function() {
759					self.showPopup();
760				}, 500 );
761			}
762			
763		}
764
765		/**
766		 * Check DOM Loaded Selector
767		 * @param  {[type]} selector [description]
768		 * @return {[type]}          [description]
769		 */
770
771		self.checkLoadedSelector = function( selector ) {
772
773			//Check Listing Grid Lazy Load
774			$( document ).on( 'jet-engine/listing-grid/after-lazy-load', function() {
775				self.onCustomSelector ( selector );
776			});
777
778			//Check Open Mobile Menu
779			$( '.jet-mobile-menu__toggle' ).closest( '.jet-mobile-menu__instance--slide-out-layout' ).on( 'click', function() {
780				self.onCustomSelector ( selector );
781			});
782
783        }
784
785		/**
786		 * [onCustomSelector description]
787		 * @param  {[type]} selector [description]
788		 * @return {[type]}          [description]
789		 */
790		self.onCustomSelector = function( selector ) {
791
792			let $selector = $( selector );
793
794			if ( $selector[0] ) {
795				$( 'body' ).off( 'click.jetPopup', selector ).on( 'click.jetPopup', selector, function( event ) {
796					event.preventDefault();
797			
798					let $this   = $( this );
799					let popupId = $this.data( 'popup' );
800					let $popup  = $( '#jet-popup-' + popupId );
801			
802					if ( $popup.length && $popup.hasClass( 'jet-popup--show-state' ) ) {
803						self.hidePopup( popupId, false );
804					} else {
805						self.showPopup( popupId, $this );
806					}
807				} );
808			} else {
809				self.checkLoadedSelector( selector );
810			}
811		}
812
813		/**
814		 * Show Popup
815		 *
816		 * @return {void}
817		 */
818		self.showPopup = function( data, $trigger ) {
819			var popupData              = data || {},
820				animeOverlay           = null,
821				animeContainer         = null,
822				animeOverlaySettings   = jQuery.extend(
823					{
824						targets: $( '.jet-popup__overlay', $popup )[0]
825					},
826					self.avaliableEffects[ 'fade' ][ 'show' ]
827				);
828
829			$trigger = $trigger || false;
830
831			if ( ! self.popupAvailableCheck() ) {
832				return false;
833			}
834
835			animeOverlay = anime( animeOverlaySettings );
836
837			$popup.toggleClass( 'jet-popup--hide-state jet-popup--show-state' );
838
839			if ( popupSettings['prevent-scrolling'] ) {
840				$( 'body' ).addClass( 'jet-popup-prevent-scroll' );
841			}
842
843			popupData = window.JetPlugins.hooks.applyFilters( 'jet-popup.show-popup.data', popupData, $popup, $trigger );
844
845			self.showContainer( popupData );
846		};
847
848		/**
849		 * [showContainer description]
850		 * @return {[type]} [description]
851		 */
852		self.showContainer = function( data ) {
853			var popupData        = data || {},
854				popupDefaultData = {
855					forceLoad: popupSettings['force-ajax'] || false, // Trigger Ajax Every Time
856					customContent: '' // Show Popup with Custom Content
857				},
858				animeContainerInstance   = null,
859				$popupContainer  = $( '.jet-popup__container', $popup ),
860				$content         = $( '.jet-popup__container-content', $popup ),
861				animeContainer   = jQuery.extend(
862					{
863						targets: $( '.jet-popup__container', $popup )[0],
864						begin: function( anime ) {
865							isAnimation = true;
866
867							$window.trigger( 'jet-popup/show-event/before-show', {
868								self: self,
869								data: popupData,
870								anime: anime
871							} );
872						},
873						complete: function( anime ) {
874							isAnimation = false;
875							isOpen      = true;
876
877							$window.trigger( 'jet-popup/show-event/after-show', {
878								self: self,
879								data: popupData,
880								anime: anime
881							} );
882						}
883					},
884					self.avaliableEffects[ popupSettings['animation'] ][ 'show' ]
885				);
886
887			popupData = jQuery.extend( popupDefaultData, popupData );
888
889			// init Custom popup content
890			if ( '' !== popupData.customContent ) {
891				$content.html( popupData.customContent );
892				self.elementorFrontendInit();
893
894				// Show Popup Container
895				animeContainerInstance = anime( animeContainer );
896
897				$window.trigger( 'jet-popup/render-content/render-custom-content', {
898					self: self,
899					popup_id: id,
900					data: popupData,
901				} );
902
903				return false;
904			}
905
906			if ( ! popupSettings['use-ajax'] ) {
907				// Show Popup Container
908				animeContainerInstance = anime( animeContainer );
909
910				$window.trigger( 'jet-popup/render-content/render-custom-content', {
911					self: self,
912					popup_id: id,
913					data: popupData,
914				} );
915
916				return false;
917			}
918
919			if ( popupData.forceLoad ) {
920				ajaxContentLoaded = false;
921			}
922
923			if ( ajaxContentLoaded ) {
924				// Show Popup Container
925				animeContainerInstance = anime( animeContainer );
926
927				$window.trigger( 'jet-popup/render-content/show-content', {
928					self: self,
929					popup_id: id,
930					data: popupData,
931				} );
932
933				return false;
934			}
935
936			popupData = jQuery.extend( popupData, {
937				'popup_id': id,
938				'page_url': window.location.href
939			} );
940
941			ajaxGetContentHanler = jQuery.ajax( {
942				type: 'POST',
943				url: window.jetPopupData.ajax_url,
944				data: {
945					'action': 'jet_popup_get_content',
946					'data': popupData
947				},
948				beforeSend: function( jqXHR, ajaxSettings ) {
949
950					if ( null !== ajaxGetContentHanler ) {
951						ajaxGetContentHanler.abort();
952					}
953
954					// Before ajax send Trigger
955					$window.trigger( 'jet-popup/render-content/ajax/before-send', {
956						self: self,
957						popup_id: id,
958						data: popupData
959					} );
960
961					$popup.addClass( 'jet-popup--loading-state' );
962				},
963				error: function( jqXHR, ajaxSettings ) {},
964				success: function( data, textStatus, jqXHR ) {
965					var successType = data.type,
966						contentData = data.content || false,
967						$popupContainer = $( '.jet-popup__container-content', $popup );
968
969					$popup.removeClass( 'jet-popup--loading-state' );
970
971					if ( 'error' === successType ) {
972						var message = data.message;
973
974						$content.html( '<h3>' + message + '</h3>' );
975
976						// Show Popup Container
977						animeContainerInstance = anime( animeContainer );
978					}
979
980					if ( 'success' === successType ) {
981						let popupContent         = contentData['content'],
982							popupContentElements = contentData['contentElements'],
983						    popupScripts         = contentData['scripts'],
984						    popupStyles          = contentData['styles'],
985							popupAfterScripts   = contentData['afterScripts'];
986
987						for ( let { handle: scriptHandler, src: scriptSrc } of popupScripts ) {
988							JetPopupFrontend.addedAssetsPromises.push( JetPopupFrontend.loadScriptAsync( scriptHandler, scriptSrc ) );
989						}
990
991						if ( popupStyles && Object.keys( popupStyles ).length > 0 ) {
992							for ( let styleHandler in popupStyles ) {
993								JetPopupFrontend.addedAssetsPromises.push( JetPopupFrontend.loadStyle( styleHandler, popupStyles[ styleHandler ] ) );
994							}
995						}
996
997						JetPopupFrontend.assetsLoaderPromise().then( async function( value ) {
998							ajaxContentLoaded = true;
999
1000							// Ajax Success Trigger
1001							$window.trigger( 'jet-popup/render-content/ajax/success', {
1002								self: self,
1003								popup_id: id,
1004								data: popupData,
1005								request: data
1006							} );
1007
1008							// Render content
1009							if ( popupContent ) {
1010								$popupContainer.html( popupContent );
1011							}
1012
1013							if ( popupAfterScripts.length ) {
1014								await Promise.all( popupAfterScripts.map(
1015									( { handle, src } ) => JetPopupFrontend.loadScriptAsync( handle, src )
1016								) );
1017							}
1018
1019							// Before ajax frontend init
1020							$( window ).trigger( 'jet-popup/ajax/frontend-init/before', {
1021								$container: $popupContainer,
1022								content: popupContent,
1023								contentElements: popupContentElements,
1024								contentType: popupSettings['content-type'],
1025							} );
1026
1027							// Frontend init
1028							$( window ).trigger( 'jet-popup/ajax/frontend-init', {
1029								$container: $popupContainer,
1030								content: popupContent,
1031								contentElements: popupContentElements,
1032								contentType: popupSettings['content-type'],
1033							} );
1034
1035							// after ajax frontend init
1036							$( window ).trigger( 'jet-popup/ajax/frontend-init/after', {
1037								$container: $popupContainer,
1038								content: popupContent,
1039								contentElements: popupContentElements,
1040								contentType: popupSettings['content-type'],
1041							} );
1042
1043							// Show Popup Container
1044							animeContainerInstance = anime( animeContainer );
1045
1046						}, function( reason ) {
1047							console.log( 'Assets Loaded Error' );
1048						} );
1049					}
1050				}
1051			} );
1052		};
1053
1054		/**
1055		 * Hide Popup
1056		 *
1057		 * @return {void}
1058		 */
1059		self.hidePopup = function ( data ) {
1060			var popupData              = data || {},
1061				$content               = $( '.jet-popup__container-content', $popup ),
1062				constantly             = popupData.constantly || false,
1063				animeOverlay           = null,
1064				animeContainer         = null,
1065				animeOverlaySettings   = jQuery.extend( { targets: $( '.jet-popup__overlay', $popup )[0] }, self.avaliableEffects[ 'fade' ][ 'hide' ] ),
1066				animeContainerSettings = jQuery.extend(
1067					{
1068						targets: $( '.jet-popup__container', $popup )[0],
1069						begin: function( anime ) {
1070							isAnimation = true;
1071
1072							$window.trigger( 'jet-popup/hide-event/before-hide', {
1073								self: self,
1074								data: popupData,
1075								anime: anime
1076							} );
1077						},
1078						complete: function( anime ) {
1079							isAnimation = false;
1080							isOpen = false;
1081							$popup.toggleClass( 'jet-popup--show-state jet-popup--hide-state' );
1082
1083							if ( popupSettings['use-ajax'] && popupSettings['force-ajax'] ) {
1084								$content.html( '' );
1085							}
1086
1087							if ( popupSettings['prevent-scrolling'] && !$( '.jet-popup--show-state' )[0] ) {
1088								$( 'body' ).removeClass( 'jet-popup-prevent-scroll' );
1089							}
1090							// After Popup Hide Action
1091							$window.trigger( 'jet-popup/hide-event/after-hide', {
1092								self: self,
1093								data: popupData,
1094								anime: anime
1095							} );
1096						}
1097					},
1098					self.avaliableEffects[ popupSettings['animation'] ][ 'hide' ]
1099				);
1100
1101			if ( constantly ) {
1102				self.setLocalStorageData( popupId, 'disable' );
1103			}
1104
1105			if ( isAnimation ){
1106				return false;
1107			}
1108
1109			if ( $popup.hasClass('jet-popup--show-state') ) {
1110				animeOverlay = anime( animeOverlaySettings );
1111				animeContainer = anime( animeContainerSettings );
1112			}
1113
1114			// On Hide Handler
1115			self.onHidePopupAction();
1116
1117			// Before Popup Hide Action
1118			$window.trigger( 'jet-popup/close-hide-event/before-hide', {
1119				self: self,
1120				data: popupData
1121			} );
1122		};
1123
1124		/**
1125		 * [elementorFrontendInit description]
1126		 * @return {[type]} [description]
1127		 */
1128		self.elementorFrontendInit = function() {
1129			var $content = $( '.jet-popup__container-content', $popup );
1130
1131			$content.find( 'div[data-element_type]' ).each( function() {
1132				var $this       = $( this ),
1133					elementType = $this.data( 'element_type' );
1134
1135				if (!elementType) {
1136					return;
1137				}
1138
1139				try {
1140					if( 'widget' === elementType ){
1141						elementType = $this.data( 'widget_type' );
1142						window.elementorFrontend.hooks.doAction( 'frontend/element_ready/widget', $this, $ );
1143					}
1144					window.elementorFrontend.hooks.doAction( 'frontend/element_ready/' + elementType, $this, $ );
1145
1146				} catch( err ) {
1147					console.log(err);
1148
1149					$this.remove();
1150
1151					return false;
1152				}
1153
1154			});
1155
1156			// On Show Handler
1157			self.onShowPopupAction();
1158		}
1159
1160		/**
1161		 * [onShowPopupAction description]
1162		 * @return {[type]} [description]
1163		 */
1164		self.onShowPopupAction = function() {};
1165
1166		/**
1167		 * [onHidePopupAction description]
1168		 * @return {[type]} [description]
1169		 */
1170		self.onHidePopupAction = function() {};
1171
1172		/**
1173		 * Avaliable Effects
1174		 */
1175		self.avaliableEffects = {
1176			'none': {
1177				'show': {
1178					duration: 0,
1179					opacity: {
1180						value: [ 1, 1 ],
1181					}
1182				},
1183				'hide': {
1184					duration: 0,
1185					opacity: {
1186						value: [ 1, 1 ],
1187					}
1188				}
1189			},
1190
1191			'fade' : {
1192				'show': {
1193					opacity: {
1194						value: [ 0, 1 ],
1195						duration: 600,
1196						easing: 'easeOutQuart',
1197					},
1198				},
1199				'hide': {
1200					easing: 'easeOutQuart',
1201					opacity: {
1202						value: [ 1, 0 ],
1203						easing: 'easeOutQuart',
1204						duration: 400,
1205					},
1206				}
1207			},
1208
1209			'zoom-in' : {
1210				'show': {
1211					duration: 500,
1212					easing: 'easeOutQuart',
1213					opacity: {
1214						value: [ 0, 1 ],
1215
1216					},
1217					scale: {
1218						value: [ 0.75, 1 ],
1219					}
1220				},
1221				'hide': {
1222					duration: 400,
1223					easing: 'easeOutQuart',
1224					opacity: {
1225						value: [ 1, 0 ],
1226					},
1227					scale: {
1228						value: [ 1, 0.75 ],
1229					}
1230				}
1231			},
1232
1233			'zoom-out' : {
1234				'show': {
1235					duration: 500,
1236					easing: 'easeOutQuart',
1237					opacity: {
1238						value: [ 0, 1 ],
1239
1240					},
1241					scale: {
1242						value: [ 1.25, 1 ],
1243					}
1244				},
1245				'hide': {
1246					duration: 400,
1247					easing: 'easeOutQuart',
1248					opacity: {
1249						value: [ 1, 0 ],
1250					},
1251					scale: {
1252						value: [ 1, 1.25 ],
1253					}
1254				}
1255			},
1256
1257			'rotate' : {
1258				'show': {
1259					duration: 500,
1260					easing: 'easeOutQuart',
1261					opacity: {
1262						value: [ 0, 1 ],
1263
1264					},
1265					scale: {
1266						value: [ 0.75, 1 ],
1267					},
1268					rotate: {
1269						value: [ -65, 0 ],
1270					}
1271				},
1272				'hide': {
1273					duration: 400,
1274					easing: 'easeOutQuart',
1275					opacity: {
1276						value: [ 1, 0 ],
1277					},
1278					scale: {
1279						value: [ 1, 0.9 ],
1280					},
1281				}
1282			},
1283
1284			'move-up' : {
1285				'show': {
1286					duration: 500,
1287					easing: 'easeOutExpo',
1288					opacity: {
1289						value: [ 0, 1 ],
1290
1291					},
1292					translateY: {
1293						value: [ 50, 1 ],
1294					}
1295				},
1296				'hide': {
1297					duration: 400,
1298					easing: 'easeOutQuart',
1299					opacity: {
1300						value: [ 1, 0 ],
1301					},
1302					translateY: {
1303						value: [ 1, 50 ],
1304					}
1305				}
1306			},
1307
1308			'flip-x' : {
1309				'show': {
1310					duration: 500,
1311					easing: 'easeOutExpo',
1312					opacity: {
1313						value: [ 0, 1 ],
1314
1315					},
1316					rotateX: {
1317						value: [ 65, 0 ],
1318					}
1319				},
1320				'hide': {
1321					duration: 400,
1322					easing: 'easeOutQuart',
1323					opacity: {
1324						value: [ 1, 0 ],
1325					}
1326				}
1327			},
1328
1329			'flip-y' : {
1330				'show': {
1331					duration: 500,
1332					easing: 'easeOutExpo',
1333					opacity: {
1334						value: [ 0, 1 ],
1335
1336					},
1337					rotateY: {
1338						value: [ 65, 0 ],
1339					}
1340				},
1341				'hide': {
1342					duration: 400,
1343					easing: 'easeOutQuart',
1344					opacity: {
1345						value: [ 1, 0 ],
1346					}
1347				}
1348			},
1349
1350			'bounce-in' : {
1351				'show': {
1352					opacity: {
1353						value: [ 0, 1 ],
1354						duration: 500,
1355						easing: 'easeOutQuart',
1356					},
1357					scale: {
1358						value: [ 0.2, 1 ],
1359						duration: 800,
1360						elasticity: function(el, i, l) {
1361							return (400 + i * 200);
1362						},
1363					}
1364				},
1365				'hide': {
1366					duration: 400,
1367					easing: 'easeOutQuart',
1368					opacity: {
1369						value: [ 1, 0 ],
1370					},
1371					scale: {
1372						value: [ 1, 0.8 ],
1373					}
1374				}
1375			},
1376
1377			'bounce-out' : {
1378				'show': {
1379					opacity: {
1380						value: [ 0, 1 ],
1381						duration: 500,
1382						easing: 'easeOutQuart',
1383					},
1384					scale: {
1385						value: [ 1.8, 1 ],
1386						duration: 800,
1387						elasticity: function(el, i, l) {
1388							return (400 + i * 200);
1389						},
1390					}
1391				},
1392				'hide': {
1393					duration: 400,
1394					easing: 'easeOutQuart',
1395					opacity: {
1396						value: [ 1, 0 ],
1397					},
1398					scale: {
1399						value: [ 1, 1.5 ],
1400					}
1401				}
1402			},
1403
1404			'slide-in-up' : {
1405				'show': {
1406					opacity: {
1407						value: [ 0, 1 ],
1408						duration: 400,
1409						easing: 'easeOutQuart',
1410					},
1411					translateY: {
1412						value: ['100vh', 0],
1413						duration: 750,
1414						easing: 'easeOutQuart',
1415					}
1416				},
1417				'hide': {
1418					duration: 400,
1419					easing: 'easeInQuart',
1420					opacity: {
1421						value: [ 1, 0 ],
1422					},
1423					translateY: {
1424						value: [0,'100vh'],
1425					}
1426				}
1427			},
1428
1429			'slide-in-right' : {
1430				'show': {
1431					opacity: {
1432						value: [ 0, 1 ],
1433						duration: 400,
1434						easing: 'easeOutQuart',
1435					},
1436					translateX: {
1437						value: ['100vw', 0],
1438						duration: 750,
1439						easing: 'easeOutQuart',
1440					}
1441				},
1442				'hide': {
1443					duration: 400,
1444					easing: 'easeInQuart',
1445					opacity: {
1446						value: [ 1, 0 ],
1447					},
1448					translateX: {
1449						value: [0,'100vw'],
1450					}
1451				}
1452			},
1453
1454			'slide-in-down' : {
1455				'show': {
1456					opacity: {
1457						value: [ 0, 1 ],
1458						duration: 400,
1459						easing: 'easeOutQuart',
1460					},
1461					translateY: {
1462						value: ['-100vh', 0],
1463						duration: 750,
1464						easing: 'easeOutQuart',
1465					}
1466				},
1467				'hide': {
1468					duration: 400,
1469					easing: 'easeInQuart',
1470					opacity: {
1471						value: [ 1, 0 ],
1472					},
1473					translateY: {
1474						value: [0,'-100vh'],
1475					}
1476				}
1477			},
1478
1479			'slide-in-left' : {
1480				'show': {
1481					opacity: {
1482						value: [ 0, 1 ],
1483						duration: 400,
1484						easing: 'easeOutQuart',
1485					},
1486					translateX: {
1487						value: ['-100vw', 0],
1488						duration: 750,
1489						easing: 'easeOutQuart',
1490					}
1491				},
1492				'hide': {
1493					duration: 400,
1494					easing: 'easeInQuart',
1495					opacity: {
1496						value: [ 1, 0 ],
1497					},
1498					translateX: {
1499						value: [0,'-100vw'],
1500					}
1501				}
1502			}
1503
1504		};
1505
1506		/**
1507		 * Get localStorage data.
1508		 *
1509		 * @return {object|boolean}
1510		 */
1511		self.getLocalStorageData = function() {
1512
1513			try {
1514				return JSON.parse( localStorage.getItem( 'jetPopupData' ) );
1515			} catch ( e ) {
1516				return false;
1517			}
1518		};
1519
1520		/**
1521		 * Set localStorage data.
1522		 *
1523		 * @return {object|boolean}
1524		 */
1525		self.setLocalStorageData = function( id, status ) {
1526
1527			var jetPopupData = self.getLocalStorageData() || {},
1528				newData      = {};
1529
1530			newData['status'] = status;
1531
1532			if ( 'disable' === status ) {
1533
1534				var nowDate             = Date.now(),
1535					showAgainDelay      = popupSettings['show-again-delay'],
1536					showAgainDate       = 'none' !== showAgainDelay ? ( nowDate + showAgainDelay ) : 'none';
1537
1538				newData['show-again-date'] = showAgainDate;
1539			}
1540
1541			jetPopupData[ id ] = newData;
1542
1543			localStorage.setItem( 'jetPopupData', JSON.stringify( jetPopupData ) );
1544		}
1545
1546	}
1547
1548	window.JetPopupFrontend.init();
1549
1550}( 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.