PageSourceSearch

https://spadellandia.it/wp-content/plugins/jet-popup/assets/js/jet-popup-frontend.js?ver=2.0.0

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