1$(document).ready(function() { 2 $.validator.addMethod('passwordValidate', function(value, element, param) { 3 return value.match(/^.*(?=.*\d)(?=.*[A-Za-z]).*$/) && value.length >= 7; 4 }); 5 6 $.validator.addMethod('complete_url', function(val, elem) { 7 if (val.length == 0) { 8 return true; 9 } // if no url, don't do anything 10 11 // http://docs.jquery.com/Plugins/Validation/Methods/url 12 // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/ 13 return this.optional(elem) || /^(https?:\/\/)?(((([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(val); 14 }); 15 16 $('#new-account-form').validate({ 17 onkeyup: function(element, event) { 18 if (event.which === 9 && this.elementValue(element) === '') { 19 return; 20 } 21 if ($(element).hasClass('error')) { 22 this.element(element); 23 } 24 } 25 ,rules: { 26 password: { 27 required: true 28 ,passwordValidate: true 29 } 30 ,confirm_password: { equalTo: '#password' } 31 ,email: { 32 required: true 33 ,email: true 34 ,remote: { 35 type: 'post' 36 ,url: $('base').attr('href') + 'accounts/check-email' 37 } 38 } 39 ,agree_terms: { required: true } 40 } 41 ,messages: { 42 password: { 43 required: 'Please enter a password' 44 ,passwordValidate: 'Minimum 7 characters and must contain at least one letter & one number' 45 } 46 ,confirm_password: 'Passwords do not match!' 47 ,email: { 48 required: 'Please enter your email address' 49 ,email: 'Please enter a valid email address' 50 ,remote: 'This email address has already been used!' 51 } 52 ,company_name: 'Please enter your website or company name' 53 ,agree_terms: 'You must agree to our Terms of Service and Privacy Policy' 54 ,website_url: 'Please enter a valid URL' 55 } 56 ,errorPlacement: function($error, $element) { 57 $element.closest('label').find('span.err').append($error); 58 } 59 }); 60 61 $('#new-account-form').on('submit', function(e) { 62 var $this = $(this); 63 $this.find('span.err').html(''); 64 if (!$this.valid()) { 65 e.preventDefault(); 66 return false; 67 } 68 }); 69 70 $('#new-account-form').find('input[type="text"]').first().focus(); 71});
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.