PageSourceSearch

https://seldallas.org/wp-content/plugins/jet-popup/assets/js/jet-popup-frontend.js?ver=1.4.1

js seldallas.org collected 2026-10-09 00:28:44 UTC 32,022 bytes, 1,411 lines download raw bytes

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

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.