Remove password when unticking checkbox, addded feature to paste text #45

This commit is contained in:
Marc Ole Bulling
2022-02-26 16:56:19 +01:00
parent 8f84b89402
commit 3cbf388b5f
2 changed files with 23 additions and 8 deletions
+22 -7
View File
@@ -24,14 +24,26 @@ Dropzone.options.uploaddropzone = {
},
};
document.onpaste = function(event){
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
for (index in items) {
var item = items[index];
if (item.kind === 'file') {
dropzoneObject.addFile(item.getAsFile())
document.onpaste = function(event) {
var items = (event.clipboardData || event.originalEvent.clipboardData).items;
for (index in items) {
var item = items[index];
if (item.kind === 'file') {
dropzoneObject.addFile(item.getAsFile());
}
if (item.kind === 'string') {
item.getAsString(function(s) {
let blob = new Blob([s], {
type: 'text/plain'
});
let file = new File([blob], "Pasted Text.txt", {
type: "text/plain",
lastModified: new Date(0)
});
dropzoneObject.addFile(file);
});
}
}
}
}
@@ -43,6 +55,9 @@ function checkBoxChanged(checkBox, correspondingInput) {
} else {
document.getElementById(correspondingInput).removeAttribute("disabled");
}
if (correspondingInput == "password" && disable) {
document.getElementById("password").value = "";
}
}
function parseData(data) {
@@ -82,7 +82,7 @@
</div>
</div>
<script src="./js/admin.js?v=7"></script>
<script src="./js/admin.js?v=8"></script>
<script>
Dropzone.options.uploaddropzone["maxFilesize"] = {{ .MaxFileSize }};
</script>