1var antiForgeryToken = $('input[name="__RequestVerificationToken"]').val(); 2 3function openFeedbackWindow() { 4 swal({ 5 title: 'Submit Feedback', 6 html: ` 7 <textarea id="feedback-text" placeholder="Enter your feedback here..." rows="5" style="width: 100%;"></textarea> 8 <p style="margin-top: 10px; font-size: 0.9em; color: gray;"> 9 A screenshot will automatically be sent upon pressing submit. 10 </p> 11 `, 12 showCancelButton: true, 13 confirmButtonText: 'Submit', 14 cancelButtonText: 'Cancel', 15 preConfirm: function () { 16 const feedback = document.getElementById('feedback-text').value.trim(); 17 18 if (!feedback) { 19 swal.showValidationError('Please enter your feedback!'); 20 return false; 21 } 22 23 return new Promise((resolve) => { 24 resolve(feedback); 25 }); 26 } 27 }).then(function (result) { 28 if (result) { 29 setTimeout(() => { // wait a second to ensure the sweet alert is closed for the screenshot. 30 sendFeedback(false, result); 31 }, 1000); 32 } 33 }).catch(function (error) { 34 console.error('Error:', error); 35 }); 36} 37 38// This function can be called globally from js as long as the side bars are included on the page. 39// Just run sendFeedback(true, "MY MESSAGE") [Paul B. | 2024-12-30] 40function sendFeedback(autoSubmitted, message) { 41 html2canvas(document.body).then(function (canvas) { 42 var base64Image = canvas.toDataURL(); 43 44 let preFeedback = ""; 45 let path = window.location.pathname; 46 47 if (autoSubmitted == true) { 48 preFeedback = 'Auto | ' + path; 49 } 50 else { 51 preFeedback = path; 52 } 53 54 let feedbackModel = { 55 Feedback: preFeedback + ': ' + message, 56 URI: window.location.href, 57 Base64Screenshot: base64Image 58 } 59 60 $.ajax({
61 url: '/Feedback/SubmitFeedback/', 62 type: "POST", 63 data: { 64 submitFeedback: feedbackModel, 65 __RequestVerificationToken: antiForgeryToken 66 }, 67 success: function (response) { 68 if (response.IsSuccess) { 69 if (autoSubmitted == false) { 70 swal('Thank you!', response.Message, 'success'); 71 } 72 else { 73 swal('Sorry!', 'The error has been automatically reported.', 'success') 74 } 75 } 76 else { 77 swal('Error!', response.Message, 'error'); 78 } 79 }, 80 error: function (response) { 81 swal('Oops...', response, 'error'); 82 }, 83 failure: function (response) { 84 swal('Oops...', response.responseText, 'error'); 85 } 86 }); 87 }); 88} 89 90// Listen for errors sent from the ISC Desktop app 91if (window.electron) { 92 window.electron.onReportError((error) => { 93 error = 'ISCDesktop | ' + error; 94 sendFeedback(true, error); 95 }); 96} 97
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.