PageSourceSearch

https://rainiersportsman-com-211082.hostingersite.com/wp-content/p…/assets/js/xoo-el-js.js?ver=3.0.4

js rainiersportsman-com-211082.hostingersite.com collected 2026-10-03 04:50:07 UTC 26,446 bytes, 996 lines download raw bytes

1jQuery(document).ready(function($){
2
3	window.xooEl = window.xooEl || {};
4
5	function objectifyForm($form) {
6	    var form = $form instanceof jQuery ? $form[0] : $form;
7
8	    // Use FormData to handle all form inputs
9	    var formData = new FormData(form);
10	    var result = {};
11
12	    formData.forEach(function(value, name) {
13	        // Skip File objects (they go into FormData directly for AJAX)
14	        if (value instanceof File) return;
15
16	        // Handle repeated fields by converting to arrays
17	        if (result.hasOwnProperty(name)) {
18	            if (!Array.isArray(result[name])) {
19	                result[name] = [result[name]];
20	            }
21	            result[name].push(value);
22	        } else {
23	            result[name] = value;
24	        }
25	    });
26
27    return result;
28}
29
30
31
32
33	function parse_notice( message, type ){
34		type = (typeof type !== 'undefined') ? type : 'error';
35		return xoo_el_localize.html.notice[ type ].replace( '%s', message );
36	}
37
38	var classReferral = {
39		'xoo-el-login-tgr': 'login',
40		'xoo-el-reg-tgr': 'register',
41	}
42
43	function getReferral(className){
44		return classReferral[className] ? classReferral[className] : '';
45	}
46
47	function getFormsTrigger( $container ){
48
49		$container = $container || '';
50
51		var isSingle = false;
52
53		if( $container.length && $container.find('.xoo-el-section[data-section="single"]').length ){
54			isSingle = true;
55		}
56
57		var formsTrigger = {
58			'xoo-el-sing-tgr': 'single',
59			'xoo-el-login-tgr': isSingle ? 'single' : 'login',
60			'xoo-el-reg-tgr': isSingle ? 'single' : 'register',
61			'xoo-el-lostpw-tgr': 'lostpw',
62			'xoo-el-resetpw-tgr': 'resetpw',
63			'xoo-el-forcereg-tgr': 'register',
64			'xoo-el-forcelogin-tgr': 'login',
65		}
66
67		return formsTrigger;
68	}
69
70
71	class Container{
72
73		constructor( $container ){
74			this.$container 	= $container;
75			this.$tabs 			= $container.find('ul.xoo-el-tabs').length ? $container.find( 'ul.xoo-el-tabs' ) : null;
76			this.display 		= $container.hasClass('xoo-el-form-inline') ? 'inline' : 'popup';
77			this.formRetries 	= 0;
78
79			if( this.$container.attr('data-active') ){
80				this.toggleForm( this.$container.attr('data-active') );
81			}
82
83			this.createFormsTriggerHTML();
84
85			this.eventHandlers();
86		}
87
88		createFormsTriggerHTML(){
89			var HTML = '<div style="display: none!important;">';
90			$.each( getFormsTrigger(this.$container), function( triggerClass, type ){
91				HTML += '<span class="'+triggerClass+'"></span>';
92			} )
93			HTML += '</div>';
94			this.$container.append(HTML);
95		}
96
97		eventHandlers(){
98			
99			this.$container.on( 'submit', '.xoo-el-action-form', this.submitForm.bind(this) ) ;
100			this.$container.on( 'click', '.xoo-el-edit-em', this.emailFieldEditClick.bind(this) );
101			$( document.body ).on( 'xoo_el_form_submitted', this.singleFormProcess.bind(this) );
102			this.formTriggerEvent();
103		}
104
105
106		emailFieldEditClick(e){
107			this.toggleForm('single');
108			this.$container.find('input[name="xoo-el-sing-user"]').val( $(e.currentTarget).siblings('input').val() ).focus().trigger('keyup');
109		}
110
111
112		formTriggerEvent(){
113
114			var container 	= this,
115				formsTrigger = getFormsTrigger(container.$container);
116
117			$.each( formsTrigger, function( triggerClass, formType ){
118				$( container.$container ).on( 'click', '.' + triggerClass, function(e){
119					e.preventDefault();
120					e.stopImmediatePropagation();
121					container.toggleForm(formType, getReferral(triggerClass) );
122				} )
123			} );
124
125		}
126
127
128		toggleForm( formType, referral ){
129
130			 referral = referral || '';
131
132			this.$container.attr( 'data-active', formType );
133
134			var $section 	= this.$container.find('.xoo-el-section[data-section="'+formType+'"]'),
135				activeClass = 'xoo-el-active';
136
137			//Setting section
138			if( $section.length ){
139
140				var $sectionForm = $section.find('form');
141
142				this.$container.find('.xoo-el-section').removeClass( activeClass );
143				$section.addClass( activeClass );
144				$section.find('.xoo-el-notice').html('').hide();
145				$section.find('.xoo-el-action-form').show();
146
147				if( $sectionForm.length && referral && $sectionForm.find('input[name="_xoo_el_referral"]').length ){
148					$sectionForm.find('input[name="_xoo_el_referral"]').val(referral);
149				}
150
151			}
152
153			//Setting Tab
154			if( this.$tabs ){	
155				this.$tabs.find('li').removeClass( activeClass );
156				if( this.$tabs.find('li[data-tab="'+formType+'"]').length ){
157					this.$tabs.find('li[data-tab="'+formType+'"]').addClass( activeClass );
158				}
159			}
160
161			$(document.body).trigger( 'xoo_el_form_toggled', [ formType, this, referral ] ); //backward compat
162			this.$container.triggerHandler( 'xoo_el_form_toggled', [ formType, this, referral ] ); //backward compat
163
164		}
165
166
167		submitForm(e){
168
169			e.preventDefault();
170
171			var $form 			= $(e.currentTarget),
172				$button 		= $form.find('button[type="submit"]'),
173				$section 		= $form.parents('.xoo-el-section'),
174				buttonTxt 		= $button.text(),
175				$notice			= $section.find('.xoo-el-notice'),
176				formType 		= $section.attr('data-section'),
177				container 		= this;
178
179			$notice.html('');
180
181			$button.html( xoo_el_localize.html.spinner ).addClass('xoo-el-processing');
182
183			var form_data = new FormData($form[0]);
184
185			form_data.append( 'action', 'xoo_el_form_action' );
186			form_data.append( 'display', container.display );
187
188
189			$.ajax({
190				url: xoo_el_localize.adminurl,
191				type: 'POST',
192				processData: false,
193    			contentType: false,
194    			cache: false,
195    			enctype: 'multipart/form-data',
196				data: form_data,
197				complete: function( xhr, status ){
198
199					$button.removeClass('xoo-el-processing').html(buttonTxt); //cleanup
200
201					if( ( status !== 'success' || !xhr.responseJSON || xhr.responseJSON.error === undefined  ) ){
202
203						if( container.formRetries < 2 ){
204							$form.submit();
205							container.formRetries++;
206							return;
207						}
208
209
210						if( xoo_el_localize.errorLog === 'yes' ){
211							$notice.html( parse_notice( "We could not process your request, please check console or try again later.", 'error' ) ).show();
212						}
213						else if( status !== 'error' ){	
214							location.reload();
215						}
216						
217					}
218				},
219				success: function(response){
220
221					container.formRetries = 0;
222
223					//Unexpected response
224					if( response.error === undefined ){
225						console.log(response);
226						//location.reload();
227						return;
228					}
229
230					if( response.notice ){
231
232						$notice.html(response.notice).show();
233
234						//scrollbar position
235						if( container.display === 'inline' ){
236							$('html, body').animate({ scrollTop: $notice.offset().top - 100}, 500);
237						}
238
239					}
240
241					if ( response.error === 0 ){
242						
243						if( response.redirect ){
244							//Redirect
245							setTimeout(function(){
246								window.location = response.redirect;
247							}, xoo_el_localize.redirectDelay );
248						}
249						else{
250							$form.hide();
251						}
252
253						$form.trigger('reset');
254
255						if( formType === 'resetpw' && xoo_el_localize.resetPwPattern === 'link' ){
256							$form.add( '.xoo-el-resetpw-hnotice' ).remove();
257						}
258
259					}
260
261					$( document.body ).trigger( 'xoo_el_form_submitted', [ response, $form, container ] ); //for backward compatibility
262					$form.triggerHandler( 'xoo_el_form_submitted', [ response, $form, container ] );
263					
264				}
265			}).
266			fail(function(jqXHR, textStatus, errorThrown){
267				if( container.formRetries < 2 ) return;
268				$('body, .xoo-el-popup-notice').addClass('xoo-el-popup-notice-active');
269				var iframe = $('.xoo-el-notice-wrap iframe').get(0);
270				iframe.contentWindow.document.open(); // Open the iframe's document
271			    iframe.contentWindow.document.write(jqXHR.responseText); // Write the string
272			    iframe.contentWindow.document.close(); // Close and render the iframe's document
273
274			     var iframeDocument = iframe.contentWindow.document;
275			     
276			     var style = iframeDocument.createElement("style");
277					style.textContent = $('.xoo-el-notice-iframestyle').text();
278
279				// Append the style element to the iframe's head
280				iframeDocument.head.appendChild(style);
281			})
282		}
283
284
285		singleFormProcess( e, response, $form, container ){
286
287			if( this !== container ) return;
288
289			if( response.field ){
290
291				var $field = this.$container.find( response.field );
292
293				if( $field.length ){
294
295					this.toggleForm( $field.closest('.xoo-el-section').attr('data-section') );
296
297					$field.closest('form').show();
298
299					$field.val(response.fieldValue);
300
301					$field.closest('.xoo-el-section').find('.xoo-el-notice').html(response.notice).show();
302
303					var $fieldCont = $field.closest('.xoo-aff-group');
304
305					if( !$fieldCont.find('.xoo-el-edit-em').length ){
306						$fieldCont.addClass('xoo-el-block-edit');
307						$(xoo_el_localize.html.editField).insertAfter($field);
308					}
309
310				}
311			}
312
313		}
314
315	}
316
317
318	class Popup{
319
320		constructor( $popup ){
321			this.$popup = $popup;
322			this.eventHandlers();
323		}
324
325		eventHandlers(){
326
327			if( !xoo_el_localize.preventClosing ){
328				this.$popup.on( 'click', '.xoo-el-close, .xoo-el-modal, .xoo-el-opac', this.closeOnClick.bind(this) );
329				$(document.body).on( 'xoo_el_popup_toggled.xooEscEvent', this.onPopupToggled.bind(this) );
330			}
331
332			$( document.body ).on( 'xoo_el_form_submitted', this.onFormSubmitSuccess.bind(this) );
333			this.$popup.on( 'click', '.xoo-el-action-btn', this.setScrollBarOnSubmit.bind(this) );
334			$(window).on('hashchange load', this.openViaHash.bind(this) );
335			this.triggerPopupOnClick(); //Open popup using link
336			if( xoo_el_localize.checkout && xoo_el_localize.checkout.loginEnabled === 'yes' ){
337				$('body').on( 'click', '.wc-block-checkout__login-prompt, .wc-block-must-login-prompt', this.checkoutPageLinkClick.bind(this) );
338			}
339			
340		}
341
342		onPopupToggled(e, type){
343			if( $('body').hasClass('xoo-el-popup-active') ){
344				$(document).on('keydown.xooEscClose', this.closeOnEscPress.bind(this) );
345			}
346			else{
347				$(document).off('keydown.xooEscClose' );
348			}
349		}
350
351
352		closeOnEscPress(e){
353			if(event.key === "Escape" || event.keyCode === 27 ){
354				popup.toggle('hide');
355			}
356		}
357
358		checkoutPageLinkClick(e){
359			e.preventDefault();
360			$(e.currentTarget).attr('data-redirect', xoo_el_localize.checkout.loginRedirect).addClass('xoo-el-login-tgr').trigger('click');
361		}
362
363		triggerPopupOnClick(){
364
365			$.each( getFormsTrigger(this.$popup), function( triggerClass, formType ){
366
367				$( document.body ).on( 'click', '.' + triggerClass, function(e){
368
369					if( $(this).parents( '.xoo-el-form-container' ).length ) return true; //Let container class handle
370
371					e.preventDefault();
372					e.stopImmediatePropagation();
373
374					popup.toggle('show');
375
376					if( $(this).attr( 'data-redirect' ) ){
377						popup.$popup.find('input[name="xoo_el_redirect"]').val( $(this).attr('data-redirect') );
378					}
379
380					popup.$popup.find( '.'+triggerClass ).trigger('click');
381
382					return false;
383
384				})
385
386			})
387
388		}
389
390		toggle( type ){
391			var $els 		= this.$popup.add( 'body' ),
392				activeClass = 'xoo-el-popup-active'; 
393
394			if( type === 'show' ){
395				$els.addClass(activeClass);
396			}
397			else if( type === 'hide' ){
398				$els.removeClass(activeClass);
399			}
400			else{
401				$els.toggleClass(activeClass);
402			}
403
404			$(document.body).trigger( 'xoo_el_popup_toggled', [ type ] );
405		}
406
407		closeOnClick(e){
408			var elClassList = e.target.classList;
409			if( elClassList.contains( 'xoo-el-close' ) || elClassList.contains('xoo-el-modal') || elClassList.contains('xoo-el-opac') ){
410				this.toggle('hide');
411			}
412		}
413
414		setScrollbarPosition( position ){
415			this.$popup.find('.xoo-el-srcont').scrollTop = position || 0;
416		}
417
418		onFormSubmitSuccess( e, response, $form, container ){
419			this.setScrollbarPosition();
420		}
421
422		setScrollBarOnSubmit(e){
423			var invalid_els = $(e.currentTarget).closest('form').find('input:invalid');
424			if( invalid_els.length === 0 ) return;
425			this.setScrollbarPosition( invalid_els.filter(":first").closest('.xoo-aff-group').position().top );
426		}
427
428		openViaHash(){
429
430	  		var hash = $(location).attr('hash');
431
432	  		if( hash === '#login' || hash === '#register' ){
433
434	  			this.toggle('show');
435
436	  			//Clear hash
437	  			var uri = window.location.toString(),
438	  		 		clean_uri = uri.substring( 0, uri.indexOf("#") );
439	 
440	            window.history.replaceState(
441	            	{},
442	            	document.title, clean_uri
443	            );
444	  		}
445
446	  		if( hash === '#login' ){
447	  			this.$popup.find('.xoo-el-login-tgr').trigger('click');
448	  		}
449	  		else if( hash === '#register' ){
450	  			this.$popup.find('.xoo-el-reg-tgr').trigger('click');
451	  		}
452    
453		}
454
455		
456	}
457
458	class Form{
459
460		constructor( $form ){
461			this.$form 	= $form;
462		}
463
464		eventHandlers(){
465
466		}
467
468	}
469
470	var popup = null;
471
472	//Popup
473	if( $('.xoo-el-container').length ){
474		popup = new Popup( $('.xoo-el-container') );
475	}
476
477	
478	//Auto open popup
479	if( xoo_el_localize.isLoggedIn === "no" && xoo_el_localize.autoOpenPopup === 'yes' && localStorage.getItem( "xoo_el_popup_opened"  ) !== "yes" ){
480		
481		if( xoo_el_localize.autoOpenPopupOnce === "yes" ){
482			localStorage.setItem( "xoo_el_popup_opened", "yes"  );
483		}
484		
485		setTimeout(function(){
486			popup.toggle('show');
487		}, xoo_el_localize.aoDelay);
488	}
489	
490
491	$('.xoo-el-form-container').each(function( key, el ){
492		 new Container( $(el) );
493	})
494
495	//Trigger popup if reset field link is active
496	if( $('form.xoo-el-form-resetpw').length && xoo_el_localize.resetPwPattern === "link" ){
497		if( $('.xoo-el-form-inline').length ){
498			$([document.documentElement, document.body]).animate({
499				scrollTop: $(".xoo-el-form-inline").offset().top
500			}, 500);
501		}
502		else{
503			if( popup ){
504				popup.toggle('show');
505			}
506		}
507	}
508
509
510	if( $( 'body.woocommerce-checkout' ).length && $('.xoo-el-form-inline').length && $( 'a.showlogin' ).length ){
511  		var $inlineForm = $('.xoo-el-form-inline');
512  		$inlineForm.hide();
513  		$( document.body ).on( 'click', 'a.showlogin', function(){
514  			$inlineForm.slideToggle();
515  			$inlineForm.find('.xoo-el-login-tgr').trigger('click');
516  		} );	
517  	}
518
519
520  	if( popup && xoo_el_localize.loginClass && $( '.'+xoo_el_localize.loginClass ).length ){
521  		$( 'body:not(.logged-in) .'+xoo_el_localize.loginClass ).on( 'click', function(e){
522  			e.preventDefault();
523  			e.stopImmediatePropagation();
524  			popup.toggle('show');
525  			popup.$popup.find( '.xoo-el-login-tgr' ).trigger('click');
526  		} );
527  	}
528
529  	if( popup && xoo_el_localize.registerClass && $( '.'+xoo_el_localize.registerClass ).length ){
530  		$( 'body:not(.logged-in) .'+xoo_el_localize.registerClass ).on( 'click', function(e){
531  			e.preventDefault();
532  			e.stopImmediatePropagation();
533  			popup.toggle('show');
534  			popup.$popup.find( '.xoo-el-reg-tgr' ).trigger('click');
535  		} );
536  	}
537
538
539  	$('.xoo-el-notice-close').on('click', function(){
540  		$('body, .xoo-el-popup-notice').removeClass('xoo-el-popup-notice-active');
541  	})
542
543
544
545  	class CodeFormHandler{
546
547  		constructor( $codeForm ){
548
549  			const existing = CodeFormHandler.instances.get($codeForm[0]);
550
551    		if (existing) return existing;
552
553  			this.$codeForm 		= $codeForm;
554  			this.codeFormID 	= this.$codeForm.data('code');
555  			this.$parentForm 	= this.$codeForm.data('parentform') ? $(this.$codeForm.siblings(this.$codeForm.data('parentform')).get(0)) : $();
556
557			this.CodePasted 	= false;
558
559			this.resendData 	= {};
560
561			this.$noticeCont 	= this.$codeForm.find('.xoo-el-code-notice');
562			
563			this.$submitBtn 	= this.$codeForm.find('.xoo-el-code-submit-btn');
564			this.submitBtnTxt 	= this.$submitBtn.html();
565			this.$inputs 		= this.$codeForm.find('.xoo-el-code-input');
566			this.$resendLink 	= this.$codeForm.find('.xoo-el-code-resend-link');
567			this.noticeTimout 	= this.resendTimer = false;
568			this.parentFormValues = {}
569			this.codesent 		= false;
570
571			this.$container 	= this.$codeForm.closest('.xoo-el-form-container');
572
573			this.events();
574
575			CodeFormHandler.instances.set($codeForm[0], this);
576  		}
577
578
579  		events(){
580
581			this.$resendLink.on( 'click', { _thisObj: this }, this.resendCode );
582			this.$codeForm.find('.xoo-el-code-no-change').on( 'click', { _thisObj: this }, this.changeParentInput );
583			this.$codeForm.on( 'submit', { _thisObj: this }, this.onSubmit );
584			this.$inputs.on( 'paste', { _thisObj: this }, this.onCodeInputPaste );
585			this.$inputs.on( 'input', { _thisObj: this }, this.onCodeInputChange );
586			this.$inputs.on( 'keydown ', { _thisObj: this }, this.beforeCodeInputChange );
587
588			this.$container.on( 'xoo_el_form_toggled', this.onParentFormToggled.bind(this) )
589
590
591		}
592
593
594		onParentFormToggled( e, formType, containerObj, referral ){
595
596			let _thisObj = this;
597
598			if( _thisObj.codesent ){
599  				_thisObj.$parentForm.hide();
600  				_thisObj.$codeForm.show();
601  			}
602		}
603
604  		onCodeInputPaste(event){
605
606			var _thisObj 		= event.data._thisObj,
607				_this 			= $(this);
608
609			_thisObj.CodePasted 	= true;
610
611			setTimeout(function(){
612
613				var inputVal 		= _this.val().trim(),
614				inputValLength 		= inputVal.length;
615
616				_thisObj.$inputs.val('');
617
618				for (var i = 0; i < inputValLength; ++i) {
619
620					var chr 		= inputVal.charAt(i),
621						$Codeinput 	= $(_thisObj.$inputs.get(i));
622					
623				    if( $Codeinput.length ){
624				    	$Codeinput.val(chr);
625				    }
626
627				    if( i === (inputValLength - 1) ){
628				    	$Codeinput.focus();
629				    }
630				}
631
632				if( inputValLength === _thisObj.$inputs.length ){
633					_thisObj.$codeForm.trigger('submit');
634				}
635
636				_thisObj.CodePasted = false;
637
638			}, 10 )
639
640		}
641
642		onCodeInputChange(event){
643
644			var _thisObj 		= event.data._thisObj,
645				inputVal 		= $(this).val(),
646				inputValLength 	= inputVal.length;
647
648			if( inputValLength > 1 && !_thisObj.CodePasted  ){
649				$(this).trigger('paste');
650				return;
651			}
652
653			if( _thisObj.CodePasted || _thisObj.processing ){
654				return;
655			}
656
657			_thisObj.processing = true;
658
659			var $nextInput = $(this).next('input.xoo-el-code-input'),
660				$prevInput = $(this).prev('input.xoo-el-code-input');
661
662			
663			//Switch Input
664			if( inputValLength && $nextInput.length !== 0 ){
665				$nextInput.focus();
666			}
667
668			
669			_thisObj.processing = false;
670				
671		}
672
673		beforeCodeInputChange(event){
674
675			var _thisObj 		= event.data._thisObj,
676				inputVal 		= $(this).val(),
677				inputValLength 	= inputVal.length;
678
679
680			var $nextInput = $(this).next('input.xoo-el-code-input'),
681				$prevInput = $(this).prev('input.xoo-el-code-input');
682
683
684			if( inputVal.length && event.keyCode != 8 && event.keyCode !== 13 ){
685
686				if( $nextInput.length && !$nextInput.val() ){
687					$nextInput.focus();
688				}
689				else{
690					$(this).val('');
691				}
692				
693			}
694
695			//Backspace is pressed
696			if( !inputValLength && event.keyCode == 8 && $prevInput.length !== 0 ){
697				$prevInput.focus();
698			}
699
700		}
701
702		onSubmit(event){
703
704			event.preventDefault();
705
706			var _thisObj = event.data._thisObj;
707
708			if( !_thisObj.validateInputs() || !_thisObj.getCodeValue().length ) return false;
709
710			_thisObj.$submitBtn.html( xoo_el_localize.html.spinner ).addClass('xoo-el-processing');
711
712			_thisObj.verifyCode();
713		}
714
715
716		changeParentInput(event){
717			var _thisObj = event.data._thisObj;
718			_thisObj.codesent = false;
719			_thisObj.$codeForm.hide();
720			_thisObj.$parentForm.show();
721			_thisObj.$inputs.val('');
722		}
723
724
725		resendCode(event){
726
727			event.preventDefault();
728
729			var _thisObj = event.data._thisObj;
730
731			_thisObj.startResendTimer();
732
733			var form_data = {
734				action: 'xoo_el_resend_code',
735				'parentFormData': objectifyForm( _thisObj.$parentForm),
736			}
737
738			form_data = Object.assign({}, form_data, _thisObj.resendData);
739
740			_thisObj.$resendLink.addClass('xoo-el-processing');
741
742			$.ajax({
743				url: xoo_el_localize.adminurl,
744				type: 'POST',
745				data: form_data,
746				success: function(response){
747
748					_thisObj.$resendLink.trigger( 'xoo_el_code_resent', [ response, _thisObj ] );
749
750					_thisObj.$resendLink.removeClass('xoo-el-processing');
751
752					if( response.notice ){
753						_thisObj.showNotice( response.notice );
754					}
755					
756				},
757				complete: function(){
758
759				}
760			});
761		}
762
763
764		validateInputs(){
765
766			var passedValidation = true;
767			
768			this.$inputs.each( function( index, input ){
769				var $input = $(input);
770				if( $input.val().trim() === '' ){
771					$input.focus();
772					passedValidation = false;
773					return false;
774				}
775			} );
776				
777			
778			return passedValidation;
779
780		}
781
782		onSuccess(response){
783			this.$codeForm.removeAttr('data-processing');
784			this.codesent = false;
785			this.$codeForm.hide();
786			this.$inputs.val('');
787
788			if( this.$parentForm.length ){
789				if( response.notice ){
790					this.$parentForm.closest('.xoo-el-section').find('.xoo-el-notice').html(response.notice).show();
791				}
792				this.$parentForm.show();
793			}
794			
795		}
796
797		startResendTimer(){
798			var _thisObj 		= this,
799				$cont 			= this.$codeForm.find('.xoo-el-code-resend'),
800				$resendLink 	= $cont.find('.xoo-el-code-resend-link'),
801				$timer 			= $cont.find('.xoo-el-code-resend-timer'),
802				resendTime 		= parseInt( xoo_el_localize.resend_wait );
803
804			if( resendTime === 0 ) return;
805
806			$resendLink.addClass('xoo-el-disabled');
807
808			clearInterval( this.resendTimer );
809
810			this.resendTimer = setInterval(function(){
811				$timer.html('('+resendTime+')');
812				if( resendTime <= 0 ){
813					clearInterval( _thisObj.resendTimer );
814					$resendLink.removeClass('xoo-el-disabled');
815					$timer.html('');
816				}
817				resendTime--;
818			},1000) 
819		}
820
821		showNotice(notice){
822			var _thisObj = this;
823			clearTimeout(this.noticeTimout);
824			this.$noticeCont.html( notice ).show();
825			this.noticeTimout = setTimeout(function(){
826				_thisObj.$noticeCont.hide();
827			},4000)
828		}
829
830		onCodeSent(response){
831
832			var _thisObj = this;
833
834			if( response.error ) return;
835
836			_thisObj.codesent = true;
837
838			_thisObj.$codeForm.show();
839
840			if( response.code_txt ){
841				_thisObj.$codeForm.find('.xoo-el-code-no-txt').html( response.code_txt );
842			}
843			
844			setTimeout(function(){
845				_thisObj.$inputs.first().trigger('click');
846				_thisObj.$inputs.first().focus();
847				_thisObj.$inputs.first().attr('autofocus', true);
848			}, 500)
849			
850			_thisObj.startResendTimer();
851
852
853			_thisObj.parentFormValues = _thisObj.$parentForm.serialize();
854
855			_thisObj.$codeForm.attr('data-processing','yes');
856			
857			_thisObj.$parentForm.hide();
858
859		}
860
861		verifyCode(data){
862
863			var _thisObj = this;
864
865			var form_data = $.extend( {
866				'code': _thisObj.getCodeValue(),
867				'action': 'xoo_el_code_form_submit',
868				'xoo_el_code_ajax': _thisObj.codeFormID,
869				'parentFormData': objectifyForm( _thisObj.$parentForm )
870			}, data );
871
872
873			$.ajax({
874				url: xoo_el_localize.adminurl,
875				type: 'POST',
876				data: form_data,
877				success: function(response){
878					_thisObj.$submitBtn.removeClass('xoo-el-processing').html(_thisObj.submitBtnTxt);
879
880					if( response.notice ){
881						_thisObj.showNotice( response.notice );
882					}
883
884					if( response.error === 0 ){
885						_thisObj.onSuccess(response);
886						_thisObj.$codeForm.trigger( 'xoo_el_on_code_success', [response] );
887					}
888				}
889			});
890		}
891
892		validateFormSubmit(){
893
894			if( this.validateInputs() && this.getCodeValue().length ){
895				this.$submitBtn.html( xoo_el_localize.html.spinner ).addClass('xoo-el-processing');
896				return true;
897			}
898		}
899
900		getCodeValue(){
901			var code = '';
902			this.$inputs.each( function( index, input ){
903				code += $(input).val();
904			});
905			return code;
906		}
907
908  	}
909
910  	CodeFormHandler.instances = new WeakMap();
911
912
913  	$('.xoo-el-code-form').each(function( index, codeForm ){
914
915  		new CodeFormHandler( $(codeForm) );
916
917  	});
918
919
920	window.xooEl.CodeFormHandler = CodeFormHandler; //allow other plugins to acccess this
921
922
923
924  	if( xoo_el_localize.resetPwPattern === "code" ){
925
926	  	class lostPasswordFormHandler{
927
928	  		constructor( $form ){
929	  			this.$form 				= $form;
930	  			this.$section 			= this.$form.closest('.xoo-el-section');
931	  			this.$resetPwSection 	= this.$section.siblings('[data-section="resetpw"]');
932	  			this.$resetPwForm  		= this.$resetPwSection.find('.xoo-el-form-resetpw');
933	  			this.$container 		= this.$section.closest('.xoo-el-form-container');  
934	  			this.codeFormHandler 	= new CodeFormHandler( $form.siblings('.xoo-el-code-form') );
935	  			this.events();
936	  		}
937
938	  		events(){
939	  			this.$form.on( 'xoo_el_form_submitted', this.onFormSubmit.bind(this) );
940	  			this.$resetPwForm.on( 'xoo_el_form_submitted', this.onResetPWFormSubmit.bind(this) );
941	  			this.codeFormHandler.$codeForm.on( 'xoo_el_on_code_success', this.onCodeVerificationSuccess.bind(this) );
942	  			this.$container.on( 'xoo_el_form_toggled', this.onLostPasswordFormToggle.bind(this) );
943	  		}
944	  	
945
946	  		onFormSubmit( e, response, $form, container ){
947	  			let _thisObj = this;
948	  			_thisObj.codeFormHandler.onCodeSent(response);
949	  			_thisObj.$resetPwSection.removeAttr('data-verified','yes');
950	  		}
951
952	  		onResetPWFormSubmit( e, response, $form, containerObj ){
953	  			let _thisObj = this;
954	  			_thisObj.$resetPwSection.removeAttr('data-verified','yes');
955	  			if( response.error ){
956	  				_thisObj.$section.find('.xoo-el-notice').html(response.notice).show();
957	  				if( response.error_code === 'code_reset' ){
958	  					containerObj.toggleForm('lostpw');
959	  				}	
960	  			}
961	  			else{
962	  				containerObj.toggleForm('login');
963	  				this.$container.find('.xoo-el-section[data-section="login"]').find('.xoo-el-notice').html(response.notice).show();
964	  			}
965	  		}
966
967	  		onCodeVerificationSuccess( e, response ){
968	  			let _thisObj = this;
969	  			_thisObj.$container.find('.xoo-el-resetpw-tgr').trigger('click');
970	  			_thisObj.$resetPwSection.attr('data-verified','yes');
971	  		}
972
973	  		onLostPasswordFormToggle( e, formType, containerObj, referral  ){
974
975	  			let _thisObj = this;
976
977	  			if( formType !== 'lostpw'  ) return;
978
979	  			if( _thisObj.$resetPwSection.attr('data-verified') === "yes" ){
980	  				containerObj.toggleForm('resetpw');
981	  			}
982
983
984	  			
985	  		}
986
987	  	}
988
989	  	$('form.xoo-el-form-lostpw').each(function(index, el){
990	  		new lostPasswordFormHandler($(el));
991	  	})
992
993	}
994
995
996})

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.