1$(document).ready(function () { 2 3 // check to see if we're returning for errors, and show files that are already uploaded. 4 $('.sfUploaded').each(function () { 5 if ($(this).val() != '') { 6 $(this).siblings('div.uploadfield').hide(); 7 $(this).show(); 8 } 9 }); 10 11 if ($('h3.errormessage').length > 0) { 12 $('html, body').animate({ scrollTop: $('h3.errormessage').offset().top}, 500); 13 $('h3.errormessage').focus(); 14 $('button.gotoerrorfield').click(function(e) { 15 e.preventDefault(); 16 let feid = $(this).attr('feid'); 17 let field = $(`input[name='${feid}']`).first(); 18 $('html, body').animate({ 19 scrollTop: field.parent().parent().offset().top 20 }, 500); 21 if (field.attr('type') === 'radio' || field.attr('type') === 'checkbox') { 22 field[0].focus(); 23 } 24 else if (field.is(':visible')) { 25 field.focus(); 26 } else { 27 field.parent().parent().closest('.sffield').find('input').first().focus(); 28 } 29 }); 30 } 31 32 $('.sfSubmit').click(function (event) { 33 event.preventDefault(); 34 var submitValue = $(this)[0].value; 35 $form = $(this).parents('form'); //get the parent form. 36 $field = $form.find('.sfTuringField'); //check if the form is turing. 37 $el = $('<input type="hidden" name="submitButton" value="' + submitValue + '" />'); 38 $form.append($el[0]); 39 40 if ($field.length > 0) { //recaptcha is enabled. 41 grecaptcha.execute(recaptchaSiteKey, { action: 'formpost' }).then(function (token) { 42 $field[0].value = token; 43 44 setTimeout(function () { $form[0].submit(); }, 100); 45 46 }); 47 } else { //no recaptcha 48 $form[0].submit(); 49 } 50 }); 51 52 $('input.sfUpload').click(function (e) { 53 e.preventDefault(); 54 let filebox = $(this).siblings('input.fileupload'); 55 let parentdiv = $(this).parent(); 56 let uploadeddiv = $(this).parent().siblings('input.sfUploaded'); 57 let uploadedid = $(this).parent().siblings('input.sfUploaded').attr('id'); 58 59 $('#tempdata').val(uploadedid); 60 let file = filebox[0].files[0]; 61 let filename = filebox.val().split('\\').pop(); 62 if (filename == '') return; 63 64 var ajaxData = new FormData(); 65 ajaxData.append(filename, file); 66 $.ajax({ 67 url: '/govofficeservices/api/sf/sfupload.ashx', 68 type: 'POST', 69 method: 'POST', 70 data: ajaxData, 71 cache: false, 72 contentType: false, 73 processData: false, 74 crossDomain: true, 75 timeout: 300000, 76 beforeSend: function () { 77 $('#' + uploadedid + '_spin').css("visibility", "visible"); 78 }, 79 success: function (data) { 80 let id = $('#tempdata').val(); 81 if (data.status == 'ok') { 82 $('#' + id).val(data.file); 83 $('#' + id).siblings('div.uploadfield').hide(); 84 $('#' + id).show(); 85 console.log('file uploaded: ' + data.file); 86 } 87 else if (data.status == 'error') { 88 $('#' + id + '_err').html('failed to upload file: ' + data.message); 89 console.log('failed to upload file: ' + data.message); 90 } 91 $('#' + id + '_spin').css("visibility", "hidden"); 92 }, 93 error: function(xhr, ajaxOptions, thrownError) { 94 if (thrownError == 'abort' || thrownError == 'undefined') return; 95 //alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText); 96 }, 97 complete: function () { 98 let id = $('#tempdata').val(); 99 $('#' + id + '_spin').css("visibility", "hidden"); 100 } 101 }); 102 }); 103}); 104
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.