PageSourceSearch

https://beta.vinylify.com/wp-content/plugins/easy-login-woocommerce-noise/assets/js/xoo-el-js.js?ver=1.3

js vinylify.com collected 2026-09-29 21:39:22 UTC 9,150 bytes, 319 lines download raw bytes

1jQuery(document).ready(function($){
2
3	//Return if form is not available in the DOM
4	var popup_container = $('.xoo-el-container');
5	if(popup_container.length  === 0){
6		return false;
7	}
8
9
10	var spinner = '<i class="fa fa-circle-o-notch spinner fa-spin" aria-hidden="true"></i>',
11		el_notice = $('.xoo-el-notice');
12
13
14	//Opens popup
15	var open_popup = function(){
16		$('html, body , .xoo-el-container').addClass('xoo-el-popup-active');
17	}
18
19	//Close popup
20	var close_popup = function(e){
21		$.each(e.target.classList,function(key,value){
22			if(value == 'xoo-el-modal' || value == 'xoo-el-close'){
23				$('html, body , .xoo-el-container').removeClass('xoo-el-popup-active');
24				clear_notice();
25				return false;
26			}
27		})
28	}
29
30	$('.xoo-el-modal').on('click',close_popup);
31
32	//Show notice
33	var show_notice = function( notice, notice_type, $context ){
34		notice_type = !notice_type ? 'success' : notice_type;
35		$context 	= !$context ? $('body') : $context;
36		var notice_string = typeof notice == 'object' ? '<span>'+notice.join('<br>')+'</span>' : '<span>'+notice+'</span>';
37		var notice_class  = notice_type == 'error' ? 'xoo-el-notice-error' : 'xoo-el-notice-success';
38		$context.find('.xoo-el-notice').html(notice_string)
39			.addClass(notice_class);
40	}
41
42	var clear_notice = function(){
43		if( el_notice.hasClass('xoo-el-lla-notice') ){
44			return;
45		}
46		el_notice.attr('class','xoo-el-notice').html('');
47		$('.xoo-el-lostpw-success').remove();
48		$('form.xoo-el-action-form').show();
49	}
50
51
52	/* 
53		Handles form interaction
54	*/
55
56	var formHandler = {
57
58		init: function(){
59
60			this.switch_form_to = this.switch_form_to.bind(this);
61			this.submit_form 	= this.submit_form.bind(this);
62
63			//Switch form
64			$(document).on('click','.xoo-el-login-tgr , .xoo-el-reg-tgr , .xoo-el-lostpw-tgr',this.switch_form_to);
65			//Submit form
66			$(document).on('submit','.xoo-el-action-form',this.submit_form);
67
68			formHandler.validation.init();
69
70		},
71
72
73		$formCont: function($target){
74			if( $target.parents('.xoo-el-form-inline').length > 0 ){
75				return $target.parents('.xoo-el-form-inline');
76			}
77			else{
78				return $('.xoo-el-form-popup');
79			}
80		},
81
82		//Navigate to different parts of form Login/Register/Lost Password
83		switch_form_to: function(eventObj){
84
85			var $target = $(eventObj.currentTarget),
86				$formCont 	= formHandler.$formCont( $target ),
87				activeForm;
88
89			if(!$target || $target.is('.xoo-el-login-tgr')){
90				activeForm = 'xoo-el-login-ph';
91			}
92
93			else if($target.is('.xoo-el-reg-tgr')){
94				activeForm = 'xoo-el-register-ph';
95			}
96
97			else if($target.is('.xoo-el-lostpw-tgr')){
98				activeForm = 'xoo-el-lostpw-ph';
99			}
100
101			$.each( ['xoo-el-login-ph','xoo-el-register-ph','xoo-el-lostpw-ph'], function(index,class_name){
102				$formCont.find('.'+class_name).removeClass('xoo-el-active');
103			} )
104			$formCont.find('.'+activeForm).addClass('xoo-el-active');
105
106			if( $formCont.hasClass('xoo-el-form-popup') ){
107				open_popup();
108			}
109			clear_notice();
110		},
111
112
113		submit_form: function(eventObj){
114
115			eventObj.preventDefault();
116			clear_notice();
117
118			var $target 	= $(eventObj.currentTarget),
119				$formCont 	= formHandler.$formCont( $target ),
120				$form 		= $target,
121				form_type 	= $form.find('input[name=_xoo_el_form]').val();
122
123
124			if( !form_type ) return;
125
126			var errors = formHandler.validation.validate( $form, form_type );
127
128			if(errors.length !== 0){
129				show_notice(errors,'error', $formCont);
130				return;
131			}
132
133			this.perform_action($form)
134
135		},
136
137		perform_action: function($form){
138
139			var $button 	= $form.find('.xoo-el-action-btn'),
140				old_btn_txt = $button.text(),
141				$section 	= $form.parents('.xoo-el-section'),
142				$notice_el	= $form.parents('.xoo-el-fields').find('.xoo-el-notice');
143
144            $button.html(spinner).addClass('xoo-el-processing');
145            
146            
147            var form_data = $form.serialize()+'&action=xoo_el_form_action';
148
149			$.ajax({
150				url: xoo_el_localize.adminurl,
151				type: 'POST',
152				data: form_data,
153				success: function(response){
154
155                    // edit rutger
156                    console.log(response);
157				
158					$button.removeClass('xoo-el-processing').html(old_btn_txt);
159					if(response.notice){
160						$notice_el.html(response.notice).show();
161					}else{
162						console.log(response);
163					}
164
165					if(response.error == 1){ //has errors
166
167						if(response.error_code){
168							if( response.error_code === 'xoo-uv-verify-notice-first'){
169								$form.hide().trigger('reset');
170							}
171						}
172	
173
174					}else{
175
176                        if( $('.xoo-el-reg-tgr').data("email") == 'save')
177                        {
178                            console.log('Send email');
179                            jQuery.post(
180                                xoo_el_localize.adminurl,
181                                {
182                                    'action': 'send_saved_email'
183                                },
184                                function(response) {
185
186                                    if (/product/.test(window.location.href)) {
187                                        $('#add-to-cart').prop( "disabled", false ).click();
188                                    } else {
189                                        var redirect = true;
190                                        if($button.hasClass('xoo-el-lostpw-btn')){
191                                            $form.hide();
192                                            redirect = false;
193                                        }
194                                        if(redirect){
195                                            //Redirect
196                                            setTimeout(function(){
197                                                window.location = response.redirect;
198                                            },300);
199                                        }
200                                    }
201                                }
202                            );
203                        }
204                        else
205                        {
206                            console.log('DONT send email');
207                            if (/product/.test(window.location.href)) {
208                                $('#add-to-cart').prop( "disabled", false ).click();
209                            } else {
210                                var redirect = true;
211                                if($button.hasClass('xoo-el-lostpw-btn')){
212                                    $form.hide();
213                                    redirect = false;
214                                }
215                                if(redirect){
216                                    //Redirect
217                                    setTimeout(function(){
218                                        window.location = response.redirect;
219                                    },300);
220                                }
221                            }
222
223                        }
224
225					}
226                },
227                error: function(XMLHttpRequest, textStatus, errorThrown) {
228                    console.log(XMLHttpRequest);
229                    console.log(textStatus);
230                    console.log(errorThrown);
231                }
232			})
233		},
234
235
236		validation: {
237
238			errors: [],
239
240			init: function(){
241
242			},
243
244			validate: function( $form, validate_type){
245
246				if(typeof this[ validate_type] !== 'function'){
247					console.log(validate_type + ' is not a valid input form type.');
248					return;
249				}
250				this[validate_type]( $form );
251				return this.getErrors();
252			},
253
254
255			setError: function(error){
256				this.errors.push(error);
257			},
258
259
260			getErrors: function(){
261				var saveErrors = this.errors;
262				this.errors = []; //clear
263				return saveErrors;
264			},
265
266
267			checkLength: function(input_el,length){
268				return length > input_el.val().trim().length;
269			},
270
271
272			login: function($form){
273
274				var username = $form.find('#xoo-el-username'),
275					password = $form.find('#xoo-el-password');
276
277				//Both fields empty
278				if(this.checkLength(username,1) || this.checkLength(password,1)){
279					this.setError(xoo_el_localize.strings.errors.login.empty);
280				}
281			},
282
283
284			register: function($form){
285
286				var password 		= $form.find('#xoo_el_reg_pass'),
287					password_again 	= $form.find('#xoo_el_reg_pass_again'),
288					strings 		= xoo_el_localize.strings.errors.register;
289
290
291				//Password must be minimum 6 characters.
292				if(this.checkLength(password,6)){
293					this.setError(strings.min_password);
294				}
295				else{//Passwords don't match
296					if( password_again.length > 0 && password.val() !== password_again.val()){
297						this.setError(strings.match_password);
298					}
299				}
300			},
301
302			lostPassword: function($form){
303
304				var email_user = $form.find('#xoo-el-lostpw-email');
305
306				if(this.checkLength(email_user,1)){
307					this.setError(xoo_el_localize.strings.errors.register.valid_email);
308				}
309				
310			},
311		}
312	}
313
314
315
316	//Initialize form handler
317	formHandler.init();
318
319});

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.