PageSourceSearch

https://blossomtennis.com/assets/external_validation-c964023d94b6f…8cdca8060f8b8237a7a7cd43a59c5a2569cf3836.js

js blossomtennis.com collected 2026-10-08 03:02:10 UTC 4,918 bytes, 152 lines download raw bytes

1var TOS_PROMPT = "You have not checked off the terms of service box.\n\n" +
2    "To use TeamPages, you need to agree to our terms of service.  Do you " +
3    "accept the TeamPages.com terms of service?";
4var VALIDATION_SETTINGS = { 'debug': false,
5        'errorPlacement': placeErrorMessage,
6        'highlight': highlightError,
7        'unhighlight': unhighlightError,
8        'focusCleanup': false,
9        'errorElement': 'span'
10        };
11// -------------------------------------------------------------- highlightError
12function highlightError( el )
13{
14  $(el).closest('li').addClass('error');
15}
16// ------------------------------------------------------------ unhighlightError
17function unhighlightError(el)
18{
19  $(el).closest('li').removeClass('error').find( 'span.error').html('');
20}
21// ----------------------------------------------------------- placeErrorMessage
22function placeErrorMessage( error, el )
23{
24  el.closest('li').find('span.error').html(''); // remove prebuilt errors
25  if( el.closest( 'li' ).find( 'div.cardtype').length > 0 )
26  {
27    el.closest( 'li' ).find( 'div.cardtype').after( error );
28  }
29  else
30  {
31    if( el.is("select" ) )
32    {
33      if( el.hasClass( 'future_month_year' ) )
34      {
35        el.closest('li').find( 'select.future_month_year').last().closest('div.selector').after( error );
36      }
37      else
38      {
39        el.closest('div.selector').after( error );
40      }
41    }
42    else if( el.is( "input[type=checkbox]" ) )
43    {
44      el.closest('li').find('label').after( error );
45    }
46    else
47    {
48      el.after( error );
49    }
50  }
51}
52// --------------------------------------------------------- addValidatorMethods
53function addValidatorMethods()
54{
55  // TODO: use inheritance
56  if( !$.validator )
57  {
58    console.error( "Validator is not loaded!");
59    return;
60  }
61  $.validator.addMethod( "sportSelected", sportSelected, "Please select a sport");
62  $.validator.addMethod( "visaOrMasterCard", visaOrMasterCard, "Card must be a Visa or MasterCard credit card");
63  $.validator.addMethod( "hasSpace", hasSpace, "This must include a first and last name.");
64  $.validator.addMethod( "matchesField", matchesField, "Your passwords do not match");
65  $.validator.addMethod( "notEqual", notEqual );
66  $.validator.addMethod( "futureMonthYear", futureMonthYear, "Date must be in the future" );
67  $.validator.addMethod( "tosAccepted", acceptedOrPromptTos, "You must accept our terms of service" );
68  $.validator.addClassRules( { 'future_month_year': { 'futureMonthYear': true } } );
69}
70// -------------------------------------------------------------------- hasSpace
71function hasSpace( value, element )
72{
73  return value.match( / / );
74}
75// ---------------------------------------------------------------- matchesField
76function matchesField( value, element, params )
77{
78  return value == params.val();
79}
80// --------------------------------------------------------------- sportSelected
81function sportSelected( value, element )
82{ 
83  return value != '' && element.selectedIndex != 0 ; 
84}
85// ------------------------------------------------------------ visaOrMastercard
86function visaOrMasterCard( number, element )
87{
88  number = number.toString();
89  if( isMasterCard( number ) || isVisaCard( number )) 
90  {
91    return true;
92  }
93  else
94  {
95    return false;
96  }
97}
98// ----------------------------------------------------------- futureMonthYear
99function futureMonthYear( val, el )
100{
101  var dateData = $.map( $(el).closest('li').find( 'select' ), function(x){ return parseInt( x.options[x.selectedIndex].value, 10 ); } );
102  var expiry = new Date( dateData[1], (dateData[0] - 1), 1 );
103  var today = new Date();
104  return new Date( today.getFullYear(), today.getMonth(), 1 ) <= expiry;
105}
106// --------------------------------------------------------- acceptedOrPromptTos
107function acceptedOrPromptTos( value, el )
108{
109  var realTos = $('input[name="' + $(el ).attr('name') + '"][type="checkbox"]' );
110  if( realTos.prop('checked') )
111  {
112    return true;
113  }
114  else
115  {
116    if(  confirm( TOS_PROMPT ) )
117    {
118
119      realTos.click();
120      realTos.prop( 'checked', true );
121      return true;
122    }
123    else
124    {
125      return false;
126    }
127  }
128}
129// -------------------------------------------------------------------- notEqual
130function notEqual( val, el, otherString )
131{
132  return val != otherString;
133}
134// ---------------------------------------------------------------- isMasterCard
135function isMasterCard( number )
136{
137  var mcRegex = /^5[1-5][0-9]{14}$/;
138  number = cleanCardNumber( number );
139  return number.match( mcRegex );
140}
141// ------------------------------------------------------------------ isVisaCard
142function isVisaCard( number )
143{
144  var visaRegex = /^4[0-9]{12}$|^4[0-9]{15}$/;
145  number = cleanCardNumber( number );
146  return number.match( visaRegex );
147}
148// ------------------------------------------------------------- cleanCardNumber
149function cleanCardNumber( num )
150{
151  return num.replace(/\s+|-/, '');
152};

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.