Content Security Policy (CSP) compatibility beta.
This commit is contained in:
20
pub/src/js/sentri/enableButtonOnImageUpload.js
Normal file
20
pub/src/js/sentri/enableButtonOnImageUpload.js
Normal file
@@ -0,0 +1,20 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const fileInputs = document.querySelectorAll('input[type="file"][data-enable-button]');
|
||||
|
||||
fileInputs.forEach(function (input) {
|
||||
input.addEventListener("change", function () {
|
||||
const buttonId = input.getAttribute("data-enable-button");
|
||||
const button = document.getElementById(buttonId);
|
||||
|
||||
if (input.files.length > 0) {
|
||||
button.removeAttribute("disabled");
|
||||
button.classList.remove("opacity-0");
|
||||
button.classList.add("opacity-100");
|
||||
} else {
|
||||
button.setAttribute("disabled", "disabled");
|
||||
button.classList.remove("opacity-100");
|
||||
button.classList.add("opacity-0");
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user