PageSourceSearch

https://www.prepaidgiftbalance.com/combo?browserId=chrome&minifier…s%2Fjs%2Fform-validation.js&t=1789211890000

js prepaidgiftbalance.com collected 2026-10-04 02:18:22 UTC 15,535 bytes, 338 lines download raw bytes

1/* makeURLAbsolute is cribbed from jQuery Mobile, and modified to suit our needs.*/
2/*!
3* jQuery Mobile 1.4.5
4* Git HEAD hash: 68e55e78b292634d3991c795f06f5e37a512decc <> Date: Fri Oct 31 2014 17:33:30 UTC
5* http:/ /jquerymobile.com
6*
7* Copyright 2010, 2014 jQuery Foundation, Inc. and other contributors
8* Released under the MIT license.
9* http:/ /jquery.org/license
10*
11*/
12
13/*Parse a URL into a structure that allows easy access to
14all of the URL components by name.*/
15function parseUrl( url ) {
16	var matches = new RegExp('^\\s*(((([^:\\/#\\?]+:)?(?:(\\/\\/)((?:(([^:@\\/#\\?]+)(?:\\:([^:@\\/#\\?]+))?)@)?(([^:\\/#\\?\\]\\[]+|\\[[^\\/\\]@#?]+\\])(?:\\:([0-9]+))?))?)?)?((\\/?(?:[^\\/\\?#]+\\/+)*)([^\\?#]*)))?(\\?[^#]+)?)(#.*)?').exec( url || "" ) || [];
17
18	/* Create an object that allows the caller to access the sub-matches
19	   by name. Note that IE returns an empty string instead of undefined,
20	   like all other browsers do, so we normalize everything so its consistent
21	   no matter what browser we're running on. */
22	return {
23		href:         matches[  0 ] || "",
24		hrefNoHash:   matches[  1 ] || "",
25		hrefNoSearch: matches[  2 ] || "",
26		domain:       matches[  3 ] || "",
27		protocol:     matches[  4 ] || "",
28		doubleSlash:  matches[  5 ] || "",
29		authority:    matches[  6 ] || "",
30		username:     matches[  8 ] || "",
31		password:     matches[  9 ] || "",
32		host:         matches[ 10 ] || "",
33		hostname:     matches[ 11 ] || "",
34		port:         matches[ 12 ] || "",
35		pathname:     matches[ 13 ] || "",
36		directory:    matches[ 14 ] || "",
37		filename:     matches[ 15 ] || "",
38		search:       matches[ 16 ] || "",
39		hash:         matches[ 17 ] || ""
40	};
41}
42
43/*Turn relPath into an asbolute path. absPath is
44an optional absolute path which describes what
45relPath is relative to.*/
46function makePathAbsolute( relPath, absPath ) {
47	var absStack,
48		relStack,
49		i, d;
50
51	if ( relPath && relPath.charAt( 0 ) === "/" ) {
52		return relPath;
53	}
54
55	relPath = relPath || "";
56	absPath = absPath ? absPath.replace( /^\/|(\/[^\/]*|[^\/]+)$/g, "" ) : "";
57
58	absStack = absPath ? absPath.split( "/" ) : [];
59	relStack = relPath.split( "/" );
60
61	for ( i = 0; i < relStack.length; i++ ) {
62		d = relStack[ i ];
63		switch ( d ) {
64			case ".":
65				break;
66			case "..":
67				if ( absStack.length ) {
68					absStack.pop();
69				}
70				break;
71			default:
72				absStack.push( d );
73				break;
74		}
75	}
76	return "/" + absStack.join( "/" );
77}
78
79/*Turn the specified relative URL into an absolute one. This function
80can handle all relative variants (protocol, site, document, query, fragment).
81 modified to omit the search and hash part of the URL.*/
82function makeUrlAbsolute( relUrl, absUrl ) {
83	var relObj = parseUrl( relUrl );
84	if (relObj.protocol !== "") {
85		return relUrl;
86	}
87	if ( absUrl === undefined ) {
88		absUrl = window.location.href;
89	}
90	var absObj = parseUrl( absUrl );
91
92
93	var protocol = relObj.protocol || absObj.protocol;
94	var doubleSlash = relObj.protocol ? relObj.doubleSlash : ( relObj.doubleSlash || absObj.doubleSlash );
95	var authority = relObj.authority || absObj.authority;
96	var hasPath = relObj.pathname !== "";
97	var pathname = makePathAbsolute( relObj.pathname || absObj.filename, absObj.pathname );
98
99	return protocol + doubleSlash + authority + pathname;
100}
101
102function compareURLs(url1, url2) {
103	var absUrl1 = makeUrlAbsolute(url1);
104	var absUrl2 = makeUrlAbsolute(url2);
105	return absUrl1 === absUrl2;
106}
107
108function injectlinks(source, target) {
109	/* iterate over all source links.*/ 
110	$("#"+source+" li>a").each(function() {
111		/* check for duplicate href.*/
112		var sourceHref = $( this ).attr('href');
113		if (sourceHref != "") {
114			var inject = true;
115			$("#mobileNavbar > ul > ul > li>a").each(function() {
116				if (compareURLs(sourceHref,$( this ).attr('href'))) {
117					inject=false;
118				}
119			});
120			/* inject non-duplicates.*/
121			if (inject) {
122			    var injectedLinks = $( this ).clone();
123                injectedLinks.attr("id", "mobile" + this.id);
124                $("#"+target).append($(injectedLinks).wrap("<li></li>").parent());
125				$(document).trigger("linkInjected", this);
126			}
127		}
128
129	});
130}
131//==================================================================================================================
132//  jQuery prototypes
133//------------------------------------------------------------------------------------------------------------------
134jQuery.fn.extend({
135	//------------------------------------------------------------------------------------------------------------------
136	//  locate the input group (returns the ancestor containing the Group class or the parent of the current element)
137	//------------------------------------------------------------------------------------------------------------------
138	inputGroup: function() {
139		var $rv = $();
140		this.each(function() {
141			$rv = $rv.add($($(this).closest("."+$(this).attr("id")+"Group")[0] ||
142			                $(this).closest("."+$(this).attr("name")+"Group")[0] ||
143			                $(this).parent()[0]));
144		});
145		return $rv;
146	},
147	
148	//------------------------------------------------------------------------------------------------------------------
149	//  addError to input (returns the elements that have had errors added)
150	//------------------------------------------------------------------------------------------------------------------
151	addInputError: function(errorMessage, alert) {
152		alert = (alert !== undefined) ? alert : true; 
153		errorMsg = (errorMessage !== undefined) ? errorMessage : this.attr('error-msg');
154		
155		var $rv = $();
156		this.each(function () {
157			var alertRoleAttr = alert?' role="alert"':'';
158	        if(!$(this).attr("aria-invalid")){
159	        	$rv=$rv.add($(this));
160	            fieldErrorId = typeof ($(this).attr("name")) !== 'undefined' ? $(this).attr("name") + "Error" : "";
161	            $(this).inputGroup().children(".validation-error").length
162	                            ? $(this).inputGroup().children(".validation-error")
163	                            : $(this).inputGroup().append('<div id="' + fieldErrorId + '" class="validation-error"' + alertRoleAttr + '></div>');
164	            var error = $(this).inputGroup().children(".validation-error");
165	            $(this).attr("aria-invalid", "true");
166	            $(this).inputGroup().addClass("has-validation-error");
167	            error.html('<span class="message-icon"><svg data-name="Outline" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">' +
168	            '<path d="M18.67,17.67l-8-16a.79.79,0,0,0-1.34,0l-8,16A.75.75,0,0,0,2,18.75H18a.75.75,0,0,0,.67-1.08ZM3.21,17.25,10,3.68l6.79,13.57ZM9.25,8h1.5v5H9.25Zm1.46,6.29a1.15,1.15,0,0,1,.21.33.94.94,0,0,1,0,.76,1.15,1.15,0,0,1-.21.33,1,1,0,0,1-1.63-1.09,1,1,0,0,1,.21-.33,1,1,0,0,1,.9-.27.6.6,0,0,1,.19.06l.18.09Z"/>' +
169	            '</svg></span>
169<p>' + errorMessage + '</p>');
170	        }
171		});
172		return $rv;
173    },
174
175	//------------------------------------------------------------------------------------------------------------------
176	//Check for Errors (returns the elements have are invalid)
177	//------------------------------------------------------------------------------------------------------------------
178	checkForErrors: function() {
179		var $rv = $();
180		this.each(function() {
181			var isValid=false;
182			if(this.validity.valid){
183			    var visibleId = $(this).attr('id');
184			    if(visibleId && visibleId.match("^visible")){
185			        var hiddenInput = $(this).next();
186			        if(hiddenInput.length && hiddenInput[0].validity.valid){
187			            isValid=true;
188			        }
189			    } else {
190			        isValid=true;
191			    }
192			}
193			if(!isValid){
194	        	$rv=$rv.add($(this));
195			    $(this).trigger( "invalid" );
196			}
197		});
198		return $rv;
199	},
200	
201	//==================================================================================================================
202	//  Remove Errors
203	//------------------------------------------------------------------------------------------------------------------
204	removeErrors: function() {
205		var $rv = $();
206		this.each(function () {
207		    $(this).inputGroup().children(".validation-error").remove();
208		    $(this).inputGroup().removeClass("has-validation-error");
209	        $(this).removeAttr( "aria-invalid" );
210        	$rv=$rv.add($(this));
211		});
212		return $rv;
213	},
214
215	//==================================================================================================================
216	//  add focus class from FORM LABEL
217	//------------------------------------------------------------------------------------------------------------------
218	addFocusClass: function() {
219		this.inputGroup().children("label").removeClass("input-label").addClass("input-focus-label");
220		return this;
221	},
222	
223	//==================================================================================================================
224	//  remove focus class from FORM LABEL
225	//------------------------------------------------------------------------------------------------------------------
226	removeFocusClass: function() {
227		var $rv = this.filter(function () {
228			if (this.value) {return false;}
229			if ($(this).prevAll(".input-group-addon")[0]) {return false;}
230			return $(this).is('input:not([type="date"],[type="hidden"],[type="checkbox"],[type="radio"],[type="button"],[type="submit"]),:not(select)');
231		});
232		$rv.inputGroup().children("label").addClass("input-label").removeClass("input-focus-label");
233		return $rv;
234	},
235	
236	//==================================================================================================================
237	//  Initialize focus class for FORM LABEL
238	//------------------------------------------------------------------------------------------------------------------
239	initializeFocusClass: function() {
240		return this.addFocusClass().removeFocusClass();
241	},
242
243	//==================================================================================================================
244	//  Return whether the first element is required,
245	//  OR
246	//  Set the required attribute for all elements, show/hide the Helper text if it is "(Optional)", 
247	//    and check for errors, which may show or hide a field level error message.
248	//------------------------------------------------------------------------------------------------------------------
249	required: function(isRequired) {
250		if (isRequired == undefined) {
251			// return the value of the required property for the first matched field.
252			return $(this).first().prop("required");
253		}
254		// add/remove the required attribute, set/remove the (Optional) helper text, and fire the change method
255		$(this).inputGroup().children("[id$="+$(this).attr("id")+"Help]").filter(":contains(Optional),:contains(Opcional)").toggle(!isRequired);
256		if (isRequired) {
257			return $(this).filter(function(index){return !$(this).prop("required")}).attr("required",true).removeErrors().checkForErrors();
258		} else {
259			return $(this).filter(function(index){return $(this).prop("required")}).removeAttr("required").removeErrors().checkForErrors();
260		}
261	}
262});
263
264//==================================================================================================================
265//  addError to input.  This function is suitable for using in a jQuery event handler
266//------------------------------------------------------------------------------------------------------------------
267function addInputError(errorField, errorMsg){
268	errorMsg = (typeof errorMsg !== undefined) ? errorMsg : "";
269    if(errorField.originalEvent instanceof Event || (typeof errorField === 'object' && errorField.type == 'invali
269d')) {
270        $(this).addInputError($(this).attr('error-msg') ? $(this).attr('error-msg') : $(this)[0].title ? $(this)[0].title : $(this)[0].validationMessage, true);
271    } else {
272        $(this).addInputError(errorMsg, false);
273    }
274}
275
276//==================================================================================================================
277//  Check for Errors.  This function is suitable for using in a jQuery event handler
278//------------------------------------------------------------------------------------------------------------------
279function checkForErrors(){
280	$(this).checkForErrors();
281    return true;
282}
283
284//==================================================================================================================
285//  Remove Errors.  This function is suitable for using in a jQuery event handler
286//------------------------------------------------------------------------------------------------------------------
287function removeErrors(){
288	$(this).removeErrors();
289}
290
291//==================================================================================================================
292//  add focus class from FORM LABEL.  This function is suitable for using in a jQuery event handler
293//------------------------------------------------------------------------------------------------------------------
294function addFocusClass(){
295    $(this).addFocusClass();
296}
297
298//==================================================================================================================
299//  remove focus class from FORM LABEL.  This function is suitable for using in a jQuery event handler
300//------------------------------------------------------------------------------------------------------------------
301function removeFocusClass(){
302    $(this).removeFocusClass();
303}
304
305//==================================================================================================================
306//  Initialize focus class for FORM LABEL.  This function is suitable for using in a jQuery event handler
307//------------------------------------------------------------------------------------------------------------------
308function initializeFocusClass(){
309    $(this).initializeFocusClass();
310}
311
312//==================================================================================================================
313//  Format Currency amount to two decimal points for FORM INPUT
314//------------------------------------------------------------------------------------------------------------------
315function formatCurrencyAmount(num) {
316    if (num == '') {return '';}
317
318    num = Number(num.toString().replace(/\$|\,/g, ''));
319    num = Math.round((num + Number.EPSILON) * 100) / 100;
320    if (isNaN(num)) {
321        return "0.00";
322    }
323    return num.toFixed(2);
324}
325
326//==================================================================================================================
327//  Apply Standard focus class to FORM LABEL
328//------------------------------------------------------------------------------------------------------------------
329$(document).ready(function() {
330    $('input:not([type="date"],[type="hidden"],[type="checkbox"],[type="radio"],[type="button"],[type="submit"])').initializeFocusClass();
331    $("[id^=visible]").initializeFocusClass();
332    $('input:not([type="date"],[type="hidden"],[type="checkbox"],[type="radio"],[type="button"],[type="submit"])').focus(addFocusClass);
333    $('input:not([type="date"],[type="hidden"],[type="checkbox"],[type="radio"],[type="button"],[type="submit"])').focusout(removeFocusClass);
334    $('input, select, textarea').focus(removeErrors);
335    $('input, select, textarea').blur(checkForErrors);
336    $('input, select, textarea').on('invalid', addInputError);
337});
338

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.