1/* RUNS RIGHT AT THE END OF HEAD TAG 2THE PURPOSE OF THESE FUNCTIONS ARE TO BE USEABLE INSIDE HTML LIKE onclick= */ 3function confirmSubmit(target) { 4 5 if(target.dataset.ssrflag == "SSR-FLAG-SUBMIT-BINDING"){ 6 console.warn(target,"has been marked by SSR as SSR-FLAG-SUBMIT-BINDING - skipping confirmSubmit and ideally you should remove confirmSubmit from the html") 7 return false 8 } 9 10 var message = target.dataset.message 11 if (message == "") { 12 message = "Are you sure?" 13 } 14 var confirmation = confirm(message); 15 if (confirmation) { 16 return true; // Allow form submission 17 } else { 18 return false; // Cancel form submission 19 } 20} 21 22 function printExternalPDF(src) { 23 //printJS('{{ .GetData.GetPacketURL }}'); 24 25 // create iframe element 26 const iframe = document.createElement('iframe'); 27 28 // create object URL for your blob or file and set it as the iframe's src 29 iframe.src = src; 30 iframe.name = 'pdf'; 31 32 // call the print method in the iframe onload handler 33 iframe.onload = () => { 34 const pdfFrame = window.frames["pdf"]; 35 pdfFrame.focus(); 36 pdfFrame.print(); 37 } 38 document.body.appendChild(iframe); 39 40} 41 42//onclick = show on submit an id 43function showOnSubmit(id) { 44 //var id = target.dataset.message 45 if (id == "") { 46 return 47 } 48 var element = document.getElementById(id) 49 if (element) { 50 element.classList.remove("ds-none") 51 } 52} 53 54function hideOnSubmit(id) { 55 //var id = target.dataset.message 56 if (id == "") { 57 return 58 } 59 var element = document.getElementById(id) 60 if (element) { 61 element.classList.add("ds-none") 62 } 63} 64 65function toggleOnSubmit(show,hide) { 66 hideOnSubmit(hide) 67 showOnSubmit(show) 68} 69 70/* 71// Must be wrapped in a fieldset to work 72<fieldset> 73<input type="checkbox" ... onclick="resetCheckboxes(event)" /> 74</fieldset> 75*/ 76function resetCheckboxes(event) { 77 let target = event.target; 78 79 // If the clicked checkbox is the "N/A" checkbox, return early 80 if (target.id.indexOf('_reset') !== -1) return; 81 82 // Get the fieldset that contains this checkbox 83 let fieldset = target.closest('fieldset'); 84 85 // Find the "N/A" checkbox 86 let naCheckbox = fieldset.querySelector('input[type="checkbox"][id$="_reset"]'); 87 let naCheckboxLabel = fieldset.querySelector('label[for$="_reset"]'); 88 89 // If a regular checkbox is checked, uncheck the "N/A" checkbox 90 if (target.checked && naCheckbox) { 91 naCheckbox.checked = false; 92 naCheckbox.removeAttribute("name") 93 naCheckbox.classList.add("ds-none") 94 naCheckboxLabel.classList.add("ds-none") 95 //console.log(naCheckbox,"unchecked") 96 97 } 98 99 // If no checkboxes are checked, check the "N/A" checkbox 100 let checkboxes = fieldset.querySelectorAll('input[type="checkbox"]'); 101 let anyChecked = Array.from(checkboxes).some(checkbox => checkbox.checked); 102 if (!anyChecked && naCheckbox) { 103 naCheckbox.checked = true; 104 naCheckbox.setAttribute("name",naCheckbox.dataset.name) 105 naCheckbox.classList.remove("ds-none") 106 naCheckboxLabel.classList.remove("ds-none") 107 } 108 } 109 110 //<form action="/core/object/session/post" onkeydown="contextualSubmit(event,this)" class="sidebar-sibling reverse" method="POST"> 111 /*function contextualSubmit(event,form) { 112 113 // Only prevent default if it's an Enter key press 114 if (event.type != 'keydown' || event.key != 'Enter') { 115 return 116 } 117 118 // let form = event.target 119 if (!form) { 120 console.warn('No form found in the event context'); 121 return; 122 } 123 124 if(form.tagName != "FORM"){ 125 console.warn('Invalid form found in the event context'); 126 return 127 } 128 129 130 131 // Find the default submit button 132 const defaultSubmitButton = form.querySelector('button[type="submit"].submit-default'); 133 134 if (defaultSubmitButton) { 135 136 event.preventDefault(); 137 // Trigger the click on the default submit button 138 defaultSubmitButton.click(); 139 } 140}*/
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.