PageSourceSearch

https://www.gcsrewards.org/assets/forms/forms.js?v=435140927

js gcsrewards.org collected 2026-10-02 01:08:38 UTC 18,734 bytes, 513 lines download raw bytes

1// Add US Phone Validation
2jQuery.validator.addMethod('phoneUS', function(phone_number, element) {
3	"use strict";
4    phone_number = phone_number.replace(/\s+/g, ''); 
5    return this.optional(element) || phone_number.length > 9 &&
6        phone_number.match(/^(1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
7}, 'Please enter a valid phone number.');
8
9// Add Email Regex Validation
10jQuery.validator.addMethod('emailRegex', function(value, element) {
11	"use strict";
12    return this.optional(element) || /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/i.test(value);
13}, "Please enter a valid email address.");
14
15jQuery.validator.addMethod("complete_url", function(value, element) {
16	"use strict";
17    // if no url, don't do anything
18    if (value.length === 0) { return true; }
19 
20    // if user has not entered http:// https:// or ftp:// assume they mean http://
21   if(!/^(https?|ftp):\/\//i.test(value)) {
22        value = 'http://'+value; // set both the value
23        $(element).val(value); // also update the form element
24    }
25   return this.optional(element) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(value);
26	
27}, 'Please enter a valid URL.');
28
29$.fn.clearValidation = function(){var v = $(this).validate();$('[name]',this).each(function(){v.successList.push(this);v.showErrors();});v.resetForm();v.reset();};
30
31function validateForms(){
32    "use strict";
33    
34    var regForms = $('#form_body form');
35    var formMessages = $('#formresponse');
36    
37    var options = {
38      focusInvalid: false,
39      rules: {
40          first: {required: true},
41          last: {required: true},
42          email: {required: true, emailRegex: true},
43          emailconfirm: {required: true, equalTo: "#email"},
44          phone: {required: true, phoneUS: true},
45          business: {required: true},
46          comments: {required: true},
47          questions: {required: true},
48          
49          name: {required: true},
50          feedback: {required: true},
51          title: {required: true},
52          location: {required: true},
53          subject: {required: true},
54          
55          vendor: {required: true},
56          website: {complete_url: true},
57          
58          websiteurl: {complete_url: true, required: true},
59          unableaccess: {required: true},
60          helpaccess: {required: true}
61          
62          
63      },
64      messages: {
65          first: 'Please enter your first name.',
66          last: 'Please enter your last name.',
67          email: {required: 'Please enter your email address.', emailRegex: 'Please enter a valid email address.'},
68          emailconfirm: {required: 'Please confirm your email address.', equalTo: 'Email addresses must match.'},
69          phone: {required: 'Please enter your phone number.', phoneUS: 'Please enter a valid phone number.'},
70          business: {required: 'Please enter the business name.'},
71          comments: {required: 'Please enter your comments/questions.'},
72          name: {required: 'Please enter your name.'},
73          feedback: {required: 'Please enter your feedback.'},
74          title: {required: 'Please enter your title and/or location.'},
75          location: {required: 'Please enter your location.'},
76          questions: {required: 'Please enter your questions/inquiries.'},
77          subject: 'Please select a subject.',
78          vendor: 'Please enter the vendor\'s name.',
79          websiteurl: {required: 'Please enter the web address/url of the content.'},
80          unableaccess: 'Please enter how you are unable to access the content.',
81          helpaccess: 'Please enter how we can help you access the content.'
82          
83      },
84        showErrors: function(errorMap, errorList) {
85         this.defaultShowErrors();
86          
87        $.each(this.successList, function(index, value) {
88            return $(value).popover("hide");
89        });
90          return $.each(errorList, function(index, value) {
91             
92          var errormessage = value.message;
93              
94            
95        var tip = $(value.element).popover({
96               html: true,
97               trigger: 'manual',
98               placement: 'auto',
99               container: '#form_body > form',
100               content: value.message,
101                selector: '.form-control'
102           });
103         
104              
105       // tip.data("bs.popover").config.content = value.message;
106        tip.attr('data-content', value.message);
107        return tip.popover('show');
108        
109    }); 
110          
111      },
112      errorPlacement: function(error,element){
113         // var errortext = error.text();
114         // console.log(errortext);
115      },
116      highlight: function(element, errorClass) {
117         $(element).removeClass('valid').addClass('error');
118          $(element).parent().removeClass('valid').addClass('error');
119          $(element).closest('.form-group').addClass('error');
120          
121          $('input#website').removeClass('empty');
122          $('input#website').parent().removeClass('empty');
123          
124          var elementID = $(element).attr('id');
125          if (elementID === 'email' || elementID === 'emailconfirm'){
126              $(element).parent().parent().removeClass('valid').addClass('error');
127          }
128          
129          
130      },
131      unhighlight: function(element) {
132          $(element).removeClass('error').addClass('valid');
133          $(element).parent().removeClass('error').addClass('valid');
134          $(element).closest('.form-group').removeClass('error');
135          
136          var elementID = $(element).attr('id');
137          if (elementID === 'email' || elementID === 'emailconfirm'){
138              $(element).parent().parent().removeClass('error').addClass('valid');
139          }
140          
141           if ($('input#website').val() === ''){
142                  //console.log('website empty');
143                $('input#website').removeClass('valid').addClass('empty');
144                $('input#website').parent().removeClass('valid').addClass('empty');
145              }
146      },
147      
148      invalidHandler: function (event, validator) {
149          
150         
151      },
152      submitHandler: function (form) {
153           $.ajax({
154               type: form.method,
155        		url: form.action,
156        		data: $(form).serialize(),
157                beforeSend: function(){
158                    
159                //    return false;
159  ///////// ************* REMOVE IF LIVE ****************////////
160                    
161                    if ($('.formContainer').hasClass('subscribe')){
162                        $('button#submit.btn-form').html('Subscribing...');
163                        $('.bottomsubscribe').hide();
164                    }
165                    
166                   else if ($('.formContainer').hasClass('unsubscribe')){
167                        $('button#submit.btn-form').html('Unsubscribing...');
168                    }
169                    else if ($('.formContainer').hasClass('update')){
170                        $('button#submit.btn-form').html('Updating...');
171                    }
172                    else {
173                        $('button#submit.btn-form').html('Submitting...');
174                    }
175                    
176                    $('button#submit').attr('disabled', true);
177                    
178                     setTimeout(function(){
179                         
180                         $('button#submit').removeAttr('disabled');
181                         
182					 }, 1500);
183					 
184					//$('#loading').show();
185                    loader();
186                    
187                }, // beforesend
188				success: function(response) {
189					$(formMessages).html(response);
190                    
191                    $(regForms).hide();
192                    validator.resetForm();
193                     $('.formContainer').find('.popover').each(function(){
194                        $(this).popover('dispose');
195                    });
196                    
197                     setTimeout(function(){
198                        $(formMessages).fadeIn();
199                         //$('#loading').fadeOut();
200                         unloader();
201                    },400);
202                                
203    
204                    
205                } // success
206           }); // ajax
207      }
208          
209          } // options
210    
211    var validator = $(regForms).validate(options);
212    
213    //var formheight = $('.formContainer').outerHeight();
214    //$('.formContainer').css('height', formheight);
215    
216var resizeTimer;
217    
218    $(window).on('resize', function(e) {
219        var errortip = $('.popover');
220    if (errortip.length){
221        
222    
223        if(errortip.hasClass('show') === true) {    
224        //errortip.css('display','none');
225            errortip.popover('hide');
226            
227          //  errortip.each(function(){
228         //       $(this).data("bs.popover").config.placement = 'auto';
229         //   });
230            
231        clearTimeout(resizeTimer);
232            resizeTimer = setTimeout(function() {
233                errortip.css('display','block');
234                errortip.popover('update');
235            // Run code here, resizing has "stopped"
236            
237            }, 300);
238            }
239    }
240});
241    
242} // validateforms
243
244function validateForms2(){
245    "use strict";
246    
247    var regForms = $('#form_body2 form');
248    var formMessages = $('#formresponse2');
249    
250    var options = {
251      focusInvalid: false,
252      rules: {
253          first: {required: true},
254          last: {required: true},
255          email2: {required: true, emailRegex: true},
256          emailconfirm: {required: true, equalTo: "#email2"},
257          'program[]': {required: true, minlength: 1}
258          
259          
260      },
261      messages: {
262          first: 'Please enter your first name.',
263          last: 'Please enter your last name.',
264          email2: {required: 'Please enter your email address.', emailRegex: 'Please enter a valid email address.'},
265          emailconfirm: {required: 'Please confirm your email address.', equalTo: 'Email addresses must match.'},
266          'program[]': "Please select at least one option."
267          
268      },
269        showErrors: function(errorMap, errorList) {
270         this.defaultShowErrors();
271          
272        $.each(this.successList, function(index, value) {
273            return $(value).popover("hide");
274        });
275          return $.each(errorList, function(index, value) {
276             
277          var errormessage = value.message;
278              
279            
280        var tip = $(value.element).popover({
281               html: true,
282               trigger: 'manual',
283               placement: 'auto',
284               container: '#form_body2 > form',
285               content: value.message,
286                selector: '.form-control'
287           });
288         
289              
290       // tip.data("bs.popover").config.content = value.message;
291        tip.attr('data-content', value.message);
292        return tip.popover('show');
293         
294    });
295          
296      },
297      errorPlacement: function(error,element){
298          //var errortext = error.text();
299          //console.log(errortext);
300        //var errortext = '<div class="invalid-tooltip">'+error+'</div>';
301         //element.parent().find('.invalid-tooltip').show().empty().html(errortext);
302          
303          //var errortext = '* Required';
304          //element.closest('.form-group > div').find('> span').html(errortext);
305      },
306      highlight: function(element, errorClass) {
307         $(element).removeClass('valid').addClass('error');
308          $(element).parent().removeClass('valid').addClass('error');
309          
310          
311          var elementID = $(element).attr('id');
312          if (elementID === 'email2' || elementID === 'emailconfirm'){
313              $(element).parent().parent().removeClass('valid').addClass('error');
314          }
315          
316          
317      },
318      unhighlight: function(element) {
319          $(element).removeClass('error').addClass('valid');
320          $(element).parent().removeClass('error').addClass('valid');
321          
322          var elementID = $(element).attr('id');
323          if (elementID === 'email2' || elementID === 'emailconfirm'){
324              $(element).parent().parent().removeClass('error').addClass('valid');
325          }
326          
327      },
328      
329      invalidHandler: function (event, validator) {
330          
331         
332      },
333      submitHandler: function (form) {
334           $.ajax({
335               type: form.method,
336        		url: form.action,
337        		data: $(form).serialize(),
338                beforeSend: function(){
339                    
340                    //if ($('.form-container').hasClass('subscribeindex')){
341                    //    $('button#submit.form').html('Subscribing...');
342                   // }
343                    $('#form_body2 button#submit').html('Subscribing...');
344                    $('#form_body2 button#submit').attr('disabled', true);
345                    
346                     setTimeout(function(){
347                         
348                         $('#form_body2 button#submit').removeAttr('disabled');
349                         
350					 }, 1500);
351					 
352					//$('#loading').show();
353                    loader();
354                    
355                }, // beforesend
356				success: function(response) {
357					$(formMessages).html(response);
358                    
359                    $(regForms).hide();
360                    validator.resetForm();
361                     $('.form-container').find('.popover').each(function(){
362                        $(this).popover('dispose');
363                    });
364                    
365                     setTimeout(function(){
366                        $(formMessages).fadeIn();
367                         //$('#loading').fadeOut();
368                         unloader();
369                    },400);
370                                
371    
372                    
373                } // success
374           }); // ajax
375      }
376          
377          } // options
378    
379    var validator = $(regForms).validate(options);
380    
381    //var formheight = $('.formContainer').outerHeight();
382    //$('.formContainer').css('height', formheight);
383    
384var resizeTimer;
385    
386    $(window).on('resize', function(e) {
387        var errortip = $('.popover');
388    if (errortip.length){
389        
390    
391        if(errortip.hasClass('show') === true) {    
392        errortip.css('display','none');
393            //errortip.popover('hide');
394            
395          //  errortip.each(function(){
396         //       $(this).data("bs.popover").config.placement = 'auto';
397         //   });
398            
399        clearTimeout(resizeTimer);
400            resizeTimer = setTimeout(function() {
401                errortip.css('display','block');
402                errortip.popover('update');
403            // Run code here, resizing has "stopped"
404            
405            }, 300);
406            }
407    }
408});
409    
410} // validateforms2
411
412function loader(){
413	"use strict";	
414 		 $('#loading').fadeIn(200);
415    }
416function unloader(){
417	"use strict";	
418        $('#loading').fadeOut(400);
419    }
420
421function ajaxFormInit(){
422	"use strict";
423    
424    var currentform = $('form');
425    
426    $('input[type=tel]').mask('(000) 000-0000');
427    $("input[type=email]").emailautocomplete({
428        domains: ["greenville.k12.sc.us", "gmail.com", "hotmail.com", "yahoo.com", "charter.net", "mac.com", "aol.com", "att.net"]
429    });
430    
431    if ($('#form_body').length) {
432        validateForms();
433        
434        $('#preloader').fadeIn(200);
435    setTimeout(function() {
436         $('#preloader').fadeOut(400);
437     }, 500);
438        
439     
440    
441}
442    
443    if ($('#form_body2').length) {
444        validateForms2();
445    }
446   
447    
448    var w = document.documentElement.clientWidth;
449		var h = document.documentElement.clientHeight;
450		var w2 = window.screen.width;
451		var h2 = window.screen.height;
452		
453		var windowsize = w+'x'+h+' ('+w2+'x'+h2+')';
454		$('input#size').val(windowsize);
455    
456    
457    currentform.find('.form-control').on('focusin', function(){
458		$(this).closest('.form-group > div').addClass('focus');
459        //alert('focused');
460	});
461	currentform.find('.form-control').on('focusout', function(){
462		$(this).closest('.form-group > div').removeClass('focus');
463	});
464    
465    $('input, textarea, select').on('propertychange change click keyup input paste', function(){
466		if ($(this).val() !== ''){
467			$(this).closest('.form-group > div').addClass('hasvalue');
468			//$(this).closest('.form-group > div').addClass('showlabel');
469		}
470		if ($(this).val() === ''){
471			$(this).closest('.form-group > div').removeClass('hasvalue');
472			//$(this).closest('.form-group > div').removeClass('showlabel');
473		}
474	});
475    
476if ($('#main').hasClass('formajax')){
477    $('.sidebar .accordion').find('a').on('click', function(){
478            var title = $(this).text();
479            $('.pagetitle h2').text(title);
480            
481            $('.progress').show();
482            
483            setTimeout(function(){
484                $('.progress').fadeOut(200);
485            },700);
486        });
487        
488            
489            $('.breadcrumbs a.formname').empty();
490            var activelink = $('.sidebar a.activelink').attr('href');
491            var activetext = $('.sidebar a.activelink').text();
492    
493            $('.breadcrumbs a.formname').empty().text(activetext);
494            $('.breadcrumbs a.formname').attr('href', activelink);
495    
496            $('.breadcrumbs ul > li').siblings('li').removeClass('last');
497            $('.breadcrumbs ul > li').last().addClass('last');
498    
499 
500    
501}
502      
503    
504    
505} // ajaxforminit
506
507//jQuery(function($) {
508//	"use strict";
509
510//ajaxFormInit();
511
512
513//}); // end ready

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.