1$(function () { 2 function configureValidation() { 3 jQuery.validator.addMethod( 4 'checkname', 5 function (value, element) { 6 return this.optional(element) || /^[A-Za-z0-9-]*$/.test(value); 7 }, 8 'Use only letters, numbers, and dashes.', 9 ); 10 11 $('#loginform').validate({ 12 errorClass: 'validation--error', 13 rules: { 14 domainfield: { 15 required: true, 16 rangelength: [2, 16], 17 checkname: true, 18 }, 19 }, 20 messages: { 21 domainfield: { 22 required: 'Please enter the name of your organization', 23 rangelength: 'Organization names must be 2-16 characters in length', 24 }, 25 }, 26 }); 27 } 28 29 function onSubmit(e) { 30 //prevent form from submitting 31 e.preventDefault(); 32 33 var $outputMsg = $('#output-message'); 34 $outputMsg.hide(); 35 36 var $domain = $('#domainfield'); 37 if (!$domain.valid()) { 38 return; 39 } 40 var $button = $('#findurl'); 41 $button.prop('disabled', true).text('Searching...'); 42 $domain.prop('disabled', true); 43 44 var domain = $domain.val().toLowerCase(); 45 46 $.getJSON('./admin?fn=findurl&domain=' + domain, function (data) { 47 $button.prop('disabled', false).text('Continue'); 48 $domain.prop('disabled', false); 49 50 if (data['error']) { 51 $outputMsg.text("We're sorry an unexpected error occurred while processing your request.").show(); 52 return; 53 } 54 if (!data['result']) { 55 $outputMsg.text("Sorry, we could not find any organizations matching '" + domain + "'.").show(); 56 return; 57 } 58 $button.text('Redirecting...'); 59 window.location.href = data['url']; 60 }).fail(function () { 61 $button.prop('disabled', false).text('Continue'); 62 $domain.prop('disabled', false); 63 $outputMsg.text("We're sorry an unexpected error occurred while processing your request.").show(); 64 }); 65 } 66 67 configureValidation(); 68 69 $('#findurl').on('click', onSubmit); 70 $('#output-message').hide(); 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.