paste from clipboard
Anirudh Oppiliappan x@icyphox.sh
Thu, 14 Mar 2024 01:04:08 +0200
2 files changed,
13 insertions(+),
3 deletions(-)
M
views/honkform.html
→
views/honkform.html
@@ -9,7 +9,7 @@ <p>
<details> <summary>more options</summary> <p> -<label class=button id="donker">attach: <input type="file" multiple name="donk"><span>{{ .SavedFile }}</span></label><input type="hidden" id="saveddonkxid" name="donkxid" value="{{ .SavedFile }}"> +<label class=button id="donker">attach: <input id="donkinput" type="file" multiple name="donk"><span>{{ .SavedFile }}</span></label><input type="hidden" id="saveddonkxid" name="donkxid" value="{{ .SavedFile }}"> <p id="donkdescriptor"><label for=donkdesc>description:</label><br> <input type="text" name="donkdesc" value="{{ .DonkDesc }}" autocomplete=off> {{ with .SavedPlace }}
M
views/honkpage.js
→
views/honkpage.js
@@ -355,6 +355,18 @@ })
} function showhonkform(elem, rid, hname) { var form = lehonkform + var donker = document.getElementById("donker") + var honknoise = document.getElementById("honknoise") + var forminput = document.getElementById("donkinput") + forminput.addEventListener('change', () => { + form.submit(); + }); + + honknoise.addEventListener('paste', e => { + forminput.files = e.clipboardData.files + donker.children[1].textContent = e.clipboardData.files[0].name + }); + form.style = "display: block" form.reset() if (elem) {@@ -365,10 +377,8 @@ hideelement(lehonkbutton)
elem = document.getElementById("honkformhost") elem.insertAdjacentElement('afterend', form) } - var donker = document.getElementById("donker") donker.children[1].textContent = "" var ridinput = document.getElementById("ridinput") - var honknoise = document.getElementById("honknoise") if (rid) { ridinput.value = rid if (hname) {