diff options
author | r <r@freesoftwareextremist.com> | 2022-05-04 15:48:59 +0000 |
---|---|---|
committer | r <r@freesoftwareextremist.com> | 2022-05-04 15:52:23 +0000 |
commit | 471701f0294a4327dacc8d99bc1d8ec04ffc1392 (patch) | |
tree | 07c6c6ce77d1402e7c95c71f05b9920b840d91e0 /static | |
parent | b6c09b4fc61b9b5e3bb66f7926d2455ab921f5c2 (diff) | |
download | bloat-471701f0294a4327dacc8d99bc1d8ec04ffc1392.tar.gz bloat-471701f0294a4327dacc8d99bc1d8ec04ffc1392.zip |
fluoride: Add support for image.png
Diffstat (limited to 'static')
-rw-r--r-- | static/fluoride.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/static/fluoride.js b/static/fluoride.js index 046f6dd..e6a63ef 100644 --- a/static/fluoride.js +++ b/static/fluoride.js @@ -271,6 +271,20 @@ function handleImgPreview(a) { } } +function onPaste(e) { + if (!e.clipboardData.files) + return; + var fp = document.querySelector("#post-file-picker") + var dt = new DataTransfer(); + for (var i = 0; i < fp.files.length; i++) { + dt.items.add(fp.files[i]); + } + for (var i = 0; i < e.clipboardData.files.length; i++) { + dt.items.add(e.clipboardData.files[i]); + } + fp.files = dt.files; +} + document.addEventListener("DOMContentLoaded", function() { checkCSRFToken(); checkAntiDopamineMode(); @@ -309,6 +323,10 @@ document.addEventListener("DOMContentLoaded", function() { for (var j = 0; j < links.length; j++) { handleImgPreview(links[j]); } + + var pf = document.querySelector(".post-form") + if (pf) + pf.addEventListener("paste", onPaste); }); // @license-end |