1var reWhitespace = /^\s+$/ 2function isWhitespace( s ) 3{ 4 return (isEmpty(s) || reWhitespace.test(s)); 5} 6 7function isEmpty( s ) 8{ 9 return ( ( s == null ) || ( s.length == 0 ) ) 10} 11 12jQuery( function() 13{ 14 // error dialog 15 jQuery('#errorDialog').dialog( 16 { 17 bgiframe: true, 18 autoOpen: false, 19 resizable: false, 20 modal: true, 21 overlay: 22 { 23 backgroundColor: '#000', 24 opacity: 0.5 25 }, 26 buttons: 27 { 28 OK: function() 29 { 30 jQuery(this).dialog('close'); 31 } 32 } 33 }); 34 35 // alert dialog 36 jQuery('#alertDialog').dialog( 37 { 38 bgiframe: true, 39 autoOpen: false, 40 resizable: false, 41 modal: true, 42 overlay: 43 { 44 backgroundColor: '#000', 45 opacity: 0.5 46 }, 47 buttons: 48 { 49 OK: function() 50 { 51 jQuery(this).dialog('close'); 52 } 53 } 54 }); 55}); 56 57function displayAlertDialog( title, alertText ) 58{ 59 var alertTextPrefix = '<span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>'; 60 jQuery('#alertDialog').html( alertTextPrefix + alertText ); 61 jQuery('#alertDialog').dialog('option', 'title', title); 62 jQuery('#alertDialog').dialog('open'); 63} 64 65function displayErrorDialog( errorText ) 66{ 67 var errorTextPrefix = '<span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>Error: '; 68 jQuery('#errorDialog').html( errorTextPrefix + errorText ); 69 jQuery('#errorDialog').dialog('open'); 70} 71 72(function(jQuery) 73{ 74 checkBlank = function( id, textId, text ) 75 { 76 if( isWhitespace( jQuery(id).val() ) ) 77 { 78 jQuery( id ).addClass( 'ui-state-error' ); 79 jQuery( textId ).text( text ); 80 return false; 81 } 82 else 83 { 84 jQuery( id ).removeClass('ui-state-error'); 85 return true; 86 } 87 }; 88 89 validEmail = function( str ) 90 { 91 var at = "@" 92 var dot = "." 93 var lat = str.indexOf(at) 94 var lstr = str.length 95 var ldot = str.indexOf(dot) 96 97 if( str.indexOf(at) == -1 ) 98 { 99 return false 100 } 101 102 if( str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr ) 103 { 104 return false 105 } 106 107 if( str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr ) 108 { 109 return false 110 } 111 112 if( str.indexOf(at, (lat + 1)) != -1 ) 113 { 114 return false 115 } 116 117 if( str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot ) 118 { 119 return false 120 } 121 122 if( str.indexOf(dot, (lat + 2)) == -1 ) 123 { 124 return false 125 } 126 127 if( str.indexOf(" ") != -1 ) 128 { 129 return false 130 } 131 132 return true 133 }; 134 135 checkValidEmail = function( id, textId, text ) 136 { 137 if( !isWhitespace( jQuery(id).val() ) ) 138 { 139 if( !validEmail( jQuery(id).val() ) ) 140 { 141 jQuery( id ).addClass( 'ui-state-error' ); 142 jQuery( textId ).text( text ); 143 return false; 144 } 145 else 146 { 147 return true; 148 } 149 } 150 else 151 { 152 return false; 153 } 154 }; 155} 156)(jQuery);
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.