PageSourceSearch

https://khoomey.ru/wp-content/plugins/easy-login-woocommerce/xoo-f…/assets/js/xoo-aff-js.js?ver=1.1

js khoomey.ru collected 2026-09-25 08:08:08 UTC 8,319 bytes, 307 lines download raw bytes

1jQuery(document).ready(function($){
2
3
4
5	(function(){
6
7		//initialize datepicker
8		$('.xoo-aff-input-date').each( function( index, dateEl ){
9			var $dateEl = $(dateEl),
10				dateData = $dateEl.data('date');
11			$dateEl.datepicker( dateData );
12		} );
13		
14	}());
15
16
17	var all_states = JSON.parse(xoo_aff_localize.states);
18
19	//-------------------- XXXXXXXXXXXXXXX -------------------- //
20
21	var SelectCountry = function( $select ){
22		
23		var self = this;
24		self.$selectCountry 	= $select; 
25		self.id 				= self.$selectCountry.attr('name');
26		self.$form 				= self.$selectCountry.closest( 'form' );
27		self.$selectState 		= self.$form.find('.xoo-aff-states[data-country_field="'+self.id+'"]');
28		self.$selectPhoneCode 	= self.$form.find('.xoo-aff-phone_code[data-country_field="'+self.id+'"]');
29
30		//Methods
31		self.states = self.$selectState.length ? self.states() : false;
32		//Events
33		self.$selectCountry.on( 'change', { country: self }, this.onChange );
34		self.$selectCountry.trigger('change'); //on load
35
36	}
37
38	SelectCountry.prototype.onChange = function( event ){
39		var self = event.data.country;
40		if( self.states ){
41			self.states.updateStateField( event );
42		}
43
44		if( self.$selectPhoneCode.length ){
45			self.updatePhoneCodeField();
46		}
47	}
48
49	//PhoneCode field handler
50	SelectCountry.prototype.updatePhoneCodeField = function(){
51		var country 	= this,
52			$codeOption = country.$selectPhoneCode.find( 'option[data-country_code="'+country.$selectCountry.val()+'"]' );
53		
54		if( $codeOption ){
55			$codeOption.prop('selected','selected');
56		}
57
58		country.$selectPhoneCode.trigger('change');
59	}
60
61	//State field handler
62	SelectCountry.prototype.states = function(){
63
64		var country 		= this,
65			$selectState 	= country.$selectState,
66			defaultValue 	= country.$selectState.data( 'default_state' );
67
68		var Handler =  {
69
70			init: function(){
71				Handler.$statePlaceholder 	= $selectState.find('option[value="placeholder"]');
72				Handler.$selectStateCont 	= $selectState.parent();
73				Handler.$inputState 		= Handler.createStateInput();
74			},
75
76			getStates: function(){
77				var states = all_states[ country.$selectCountry.val() ];
78				return states === undefined || states.length === 0  ? null : states;
79			},
80
81			createStateInput: function(){
82				return $( '<input type="text" />' )
83					.prop( 'name', $selectState.attr('name') )
84					.prop('placeholder', Handler.$statePlaceholder.html() )
85					.addClass( $selectState.attr('class') );
86			},
87
88			updateStateField: function( event ){
89
90				var country = event.data.country;
91
92				//Remove all current states
93				$selectState.find('option').not(Handler.$statePlaceholder).remove();
94
95				if( country.$selectCountry.val() ){
96					var active_states = Handler.getStates();
97
98					if( !active_states ){
99						Handler.$selectStateCont.find('.select2-container').remove();
100						Handler.$selectStateCont.append( Handler.$inputState );
101					}
102					else{
103						Handler.$inputState.remove();
104						Handler.$selectStateCont.append( $selectState );
105						$.each( active_states, function( state_key, label ){
106							$selectState.append( '<option value="'+state_key+'">'+label+'</option>' );
107						} )
108
109						if( defaultValue ){
110							Handler.$selectStateCont.find( 'option[value='+defaultValue+']' ).prop( 'selected', 'selected' );
111						}
112
113						$selectState.select2();
114					}
115
116					
117				}
118
119			}
120
121		}
122
123		Handler.init();
124
125		return Handler;
126	}
127
128	$.each( $('select.xoo-aff-country'), function( index, el ){
129		new SelectCountry( $(el));
130	} );
131
132
133	//-------------------- XXXXXXXXXXXXXXX -------------------- //
134
135	var password_strength_meter = {
136
137		/**
138		 * Initialize strength meter actions.
139		 */
140		init: function() {
141			$( document.body )
142				.on(
143					'keyup change',
144					'input.xoo-aff-password[check_strength="yes"]',
145					this.strengthMeter
146				);
147		},
148
149		/**
150		 * Strength Meter.
151		 */
152		strengthMeter: function() {
153			var wrapper       = $(this).parents('.xoo-aff-group'),
154				form 		  = wrapper.parents('form');
155				submit        = form.length ? $( 'button[type="submit"]', form ) : false,
156				field         = $(this),
157				strength      = 1,
158				passStrength  = $(this).attr('strength_pass').length ? $(this).attr('strength_pass') : xoo_aff_localize.password_strength.min_password_strength,
159				fieldValue    = field.val();
160
161			password_strength_meter.includeMeter( wrapper, field );
162
163			strength = password_strength_meter.checkPasswordStrength( wrapper, field, passStrength );
164
165
166			if (
167				submit &&
168				fieldValue.length > 0 &&
169				strength < passStrength  &&
170				-1 !== strength
171			) {
172				submit.attr( 'disabled', 'disabled' ).addClass( 'disabled' );
173			} else {
174				submit.removeAttr( 'disabled', 'disabled' ).removeClass( 'disabled' );
175			}
176		},
177
178		/**
179		 * Include meter HTML.
180		 *
181		 * @param {Object} wrapper
182		 * @param {Object} field
183		 */
184		includeMeter: function( wrapper, field ) {
185			var meter = wrapper.find( '.xoo-aff-password-strength' );
186
187			if ( '' === field.val() ) {
188				meter.hide();
189				$( document.body ).trigger( 'xoo-aff-password-strength-hide' );
190			} else if ( 0 === meter.length ) {
191				wrapper.append( '<div class="xoo-aff-password-strength" aria-l
191ive="polite"></div>' );
192				$( document.body ).trigger( 'xoo-aff-password-strength-added' );
193			} else {
194				meter.show();
195				$( document.body ).trigger( 'xoo-aff-password-strength-show' );
196			}
197		},
198
199		/**
200		 * Check password strength.
201		 *
202		 * @param {Object} field
203		 *
204		 * @return {Int}
205		 */
206		checkPasswordStrength: function( wrapper, field, passStrength ) {
207			var meter     = wrapper.find( '.xoo-aff-password-strength' ),
208				hint      = wrapper.find( '.xoo-aff-password-hint' ),
209				hint_html = '<small class="xoo-aff-password-hint">' + xoo_aff_localize.password_strength.i18n_password_hint + '</small>',
210				strength  = wp.passwordStrength.meter( field.val(), wp.passwordStrength.userInputBlacklist() ),
211				error     = '';
212
213			// Reset.
214			meter.removeClass( 'short bad good strong' );
215			hint.remove();
216
217			if ( meter.is( ':hidden' ) ) {
218				return strength;
219			}
220
221			// Error to append
222			if ( strength < passStrength ) {
223				error = ' - ' + xoo_aff_localize.password_strength.i18n_password_error;
224			}
225
226			switch ( strength ) {
227				case 0 :
228					meter.addClass( 'short' ).html( pwsL10n['short'] + error );
229					meter.after( hint_html );
230					break;
231				case 1 :
232					meter.addClass( 'bad' ).html( pwsL10n.bad + error );
233					meter.after( hint_html );
234					break;
235				case 2 :
236					meter.addClass( 'bad' ).html( pwsL10n.bad + error );
237					meter.after( hint_html );
238					break;
239				case 3 :
240					meter.addClass( 'good' ).html( pwsL10n.good + error );
241					break;
242				case 4 :
243					meter.addClass( 'strong' ).html( pwsL10n.strong + error );
244					break;
245				case 5 :
246					meter.addClass( 'short' ).html( pwsL10n.mismatch );
247					break;
248			}
249
250			return strength;
251		}
252	};
253
254	password_strength_meter.init();
255
256	if( $.fn.select2 ){
257		$('select.xoo-aff-select_list , select.xoo-aff-country').each(function( key, el ){
258			$(el).select2();
259		});
260	}
261
262
263	if( $.fn.select2 ){
264
265		function formatState (state) {
266
267			if (!state.id) {
268				return state.text;
269			}
270
271			var cc = state.element.getAttribute('data-country_code');
272				cc = cc ? cc.toLowerCase() : cc;
273
274			var $state = $( '<div class="xoo-aff-flag-cont"><span class="flag ' + cc +'"></span>' + '<span>' + state.text + '</span></div>' );
275
276			return $state;
277
278		};
279
280		
281
282		$('select.xoo-aff-phone_code').each(function( key, el ){
283			$(el).select2({ templateResult: formatState, templateSelection: formatState });
284		});
285	}
286
287
288	//Password toggle visiblity
289	$( 'body' ).on( 'click', '.xoo-aff-pw-toggle', function(){
290
291		var $password = $(this).parents('.xoo-aff-input-group').find('input.xoo-aff-password');
292
293		$(this).toggleClass('active');
294
295		if( $(this).hasClass('active') ){
296			$password.attr('type','text');
297			$(this).find('.xoo-aff-pwtog-hide').show();
298			$(this).find('.xoo-aff-pwtog-show').hide();
299		}
300		else{
301			$password.attr('type','password');
302			$(this).find('.xoo-aff-pwtog-show').show();
303			$(this).find('.xoo-aff-pwtog-hide').hide();
304		}
305
306	} )
307})

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.