1$(document).ready(function () { 2 BindMultipleFileInput(); 3 BindFileUploadButtons(); 4 BindFilPreviewButtons(); 5 6 $('#confirm-delete').on('show.bs.modal', function (e) { 7 $(this).find(".modal-body").html(" <span style='word-wrap: anywhere'>Are you sure you want to delete this file: " + $(e.relatedTarget).data('filename') + "?</span>"); 8 $(this).find('button.confirm-delete').off('click').on('click', function () { 9 window.location = $(e.relatedTarget).data('href'); 10 }); 11 }); 12 topStatusAlignment(); 13 window.addEventListener('scroll', function () { 14 topStatusAlignment(); 15 }); 16 17}); 18 19function syncFooterHeightVar() { 20 const footer = document.querySelector('.FNBFooter_footer'); 21 if (!footer) return; 22 const h = footer.offsetHeight; 23 document.documentElement.style.setProperty('--fnb-footer-height', `${h}px`); 24} 25 26function pinFooterIfShort() { 27 requestAnimationFrame(() => { 28 syncFooterHeightVar(); 29 const docEl = document.documentElement; 30 const body = document.body; 31 const footer = document.querySelector('.FNBFooter_footer'); 32 //const spanish = document.querySelector('.spanish-link-above-footer'); 33 if (!footer) return; 34 35 const contentHeight = Math.max(body.scrollHeight, docEl.scrollHeight); 36 const viewportHeight = docEl.clientHeight; 37 38 const shouldPin = contentHeight <= viewportHeight; 39 40 if (shouldPin) { 41 footer.classList.add('FNBFooter_footer--pinned'); 42 body.classList.add('body-has-pinned-footer'); 43 //if (spanish) spanish.classList.add('spanish-link-above-footer--pinned'); 44 } else { 45 footer.classList.remove('FNBFooter_footer--pinned'); 46 body.classList.remove('body-has-pinned-footer'); 47 //if (spanish) spanish.classList.remove('spanish-link-above-footer--pinned'); 48 } 49 }); 50} 51 52 53function showModal(id) { 54 var modal = new bootstrap.Modal(document.getElementById(id)); 55 modal.show(); 56} 57 58function hideModal(id) { 59 var modal = bootstrap.Modal.getInstance(document.getElementById(id)); 60 modal?.hide(); 61} 62 63function showModalStatic(id) { 64 var modal = new bootstrap.Modal(document.getElementById('session-warning'), { backdrop: 'static', keyboard: false }); 65 modal.show() 66} 67 68function BindFileUploadButtons() { 69 $('[data-file-upload]').off().on('click', function (event) { 70 event.preventDefault(); 71 var id = $(this).data("file-upload") !== "" ? "/" + $(this).data("file-upload") : ""; 72 $('#modalFileUpload').find('.modal-body').load($(this).data("file-modal-url") + id, function () { 73 showModal("modalFileUpload"); 74 }); 75 76 }); 77} 78 79function topStatusAlignment() { 80 var scrolltop = this.window.scrollY; 81 var parentheight = document.querySelector('.GenericPageBanner_container').offsetHeight + document.querySelector('.MainHeader_pageScroll').offsetHeight; 82 83 84 var fixedelement = document.getElementById('progress-sidebar-id'); 85 if (scrolltop <= parentheight) { 86 parentheight = parentheight + 12; 87 var top = parentheight + 'px'; 88 $(".progress-sidebar").css({ 89 'top': top, 90 'position': 'fixed', 91 'left': '0' 92 }) 93 } 94 else { 95 var top = document.querySelector('.MainHeader_pageScroll').offsetHeight + 12; 96 top = top + 'px'; 97 $(".progress-sidebar").css({ 98 'top': top, 99 'position': 'fixed', 100 'left': '0' 101 }) 102 } 103 var scrollHeight = $(document).height(); 104 var scrollPosition = $(window).height() + $(window).scrollTop(); 105 var progressStatusBar = document.getElementById("progress-sidebar-id"); 106 if ((scrollHeight - scrollPosition) / scrollHeight === 0) { // You have scrolled to the bottom of the page 107 //console.log("End of page reached!"); 108 if (progressStatusBar && !progressStatusBar.classList.contains("hide")) { 109 $('.chevron').toggleClass('fa-chevron-left fa-chevron-right'); 110 progressStatusBar.classList.add("hide"); 111 } 112 } else { 113 if ($("#slide-toggle").hasClass("fa-chevron-left")) { 114 if (progressStatusBar.classList.contains("hide")) { 115 progressStatusBar.classList.remove("hide"); 116 } 117 } 118 119 } 120} 121 122var x = window.matchMedia('(min-width:1080px)'); 123if (document.getElementById('progress-sidebar-id')) { 124 x.addEventListener('change', topStatusAlignment()); 125} 126 127function BindFilPreviewButtons() { 128 129 $('[data-file-preview]').off().on('click', function (event) { 130 event.preventDefault(); 131 $('#cover-spin').show(); 132 var id = $(this).data("file-preview"); 133 var title = $(this).data("file-name"); 134
135 $('#filepreview').find('.modal-body').load($(this).data("file-modal-url"), function () { 136 showModal('filepreview'); //$('#filepreview').modal({ show: true }); 137 $('#cover-spin').hide(); 138 $('#filepreview h4').text(title); 139 }); 140 }); 141} 142function containsSpecialCharacters(str) { 143 var regex = new RegExp('[*:|<>\\\/]'); 144 var op = regex.test(str); 145 return op; 146} 147function BindMultipleFileInput() { 148 $(".custom-file-input").off().on("change", function () { 149 var count = $(this).get(0).files.length; 150 var list = $(this).get(0).files; 151 var isvalid = true; 152 for (var i = 0; i < list.length; i++) { 153 var text = list[i].name; 154 if (containsSpecialCharacters(text)) { 155 alert(text + ` file can't be uploaded with the "illegal" character `); 156 isvalid = false; 157 break; 158 } 159 } 160 if (count === 0 || !isvalid) { 161 $(this).siblings(".custom-file-label").removeClass("selected").html("Please select a file1" + ($(this).get(0).hasAttribute("multiple") ? "(s)" : "")); 162 $("#btnUploadSubmit").get(0).disabled = true; 163 $("#btnUploadSubmit").addClass("blue-gradient-button--disabled"); 164 } 165 else { 166 $(this).siblings(".custom-file-label").addClass("selected").html(count + " file" + (count > 1 ? "s" : "") + " selected"); 167 $("#btnUploadSubmit").get(0).disabled = false; 168 $("#btnUploadSubmit").removeClass("blue-gradient-button--disabled"); 169 } 170 $(this).siblings("ul").empty(); 171 for (var i = 0; i < count; i++) { 172 $(this).siblings("ul").append("<li class='word-break'><i class='far fa-file-alt mr-2'></i>" + $(this).get(0).files[i].name + "</li>"); 173 } 174 }); 175 176 $("#btnUploadSubmit").off().on("click", function () { 177 $('#cover-spin').show(0); 178 }); 179} 180 181function SubmitDocument(_trackingCode, _selectedPdt) { 182 $.ajax({
183 url: '/Document/SubmitDocument/', 184 type: 'POST', 185 data: JSON.stringify({ trackingCode: _trackingCode }), 186 contentType: 'application/json', 187 success: function (response) { 188 if (response.Status == "Success") { 189 window.location.href = '/Document/Index?temenosId=' + _trackingCode + '&selectedPdt=' + _selectedPdt; 190 } 191 }, 192 error: function (xhr, error, status) { } 193 }); 194} 195 196function isBase64(str) { 197 try { 198 return btoa(atob(str)) === str; 199 } catch (e) { 200 return false; 201 } 202} 203 204function base64ToArrayBuffer(base64) { 205 var binaryString = window.atob(base64); 206 var binaryLen = binaryString.length; 207 var bytes = new Uint8Array(binaryLen); 208 for (var i = 0; i < binaryLen; i++) { 209 var ascii = binaryString.charCodeAt(i); 210 bytes[i] = ascii; 211 } 212 return bytes; 213} 214function animateProgressSidebar() { 215 $('.chevron').toggleClass('fa-chevron-left fa-chevron-right'); 216 var progressStatusBar = document.getElementById("progress-sidebar-id"); 217 if (progressStatusBar.classList.contains("hide")) { 218 progressStatusBar.classList.remove("hide"); 219 } else { 220 progressStatusBar.classList.add("hide"); 221 } 222} 223function closeStatusTaskBar() { 224 if ($("#slide-toggle").hasClass("fa-chevron-left")) { 225 animateProgressSidebar(); 226 } 227} 228 229 230 231 232
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.