From 3514f4761afee2da5f9a9a78a1da5b32f0322823 Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Mon, 25 Oct 2021 22:23:27 +0200 Subject: [PATCH] dsffsd --- files/assets/js/comments_v.js | 26 ++++++++++++++++++++++++++ files/assets/js/submit.js | 27 --------------------------- files/templates/comments.html | 12 ++++++------ files/templates/settings_profile.html | 21 ++++++++++++++++++--- files/templates/submission.html | 8 ++++---- files/templates/submit.html | 2 +- 6 files changed, 55 insertions(+), 41 deletions(-) diff --git a/files/assets/js/comments_v.js b/files/assets/js/comments_v.js index 2b7927e77..bbcf646bf 100755 --- a/files/assets/js/comments_v.js +++ b/files/assets/js/comments_v.js @@ -204,4 +204,30 @@ post_comment=function(fullname){ } } xhr.send(form) +} + +document.onpaste = function(event) { + var focused = document.activeElement; + if (focused.id.includes('reply-form-body-')) { + var fullname = focused.dataset.fullname; + f=document.getElementById('file-upload-reply-' + fullname); + files = event.clipboardData.files + filename = files[0].name.toLowerCase() + if (filename.endsWith(".jpg") || filename.endsWith(".jpeg") || filename.endsWith(".png") || filename.endsWith(".webp") || filename.endsWith(".gif")) + { + f.files = files; + document.getElementById('filename-show-reply-' + fullname).textContent = filename; + } + } + else if (focused.id.includes('comment-edit-body-')) { + var id = focused.dataset.id; + f=document.getElementById('file-edit-reply-' + id); + files = event.clipboardData.files + filename = files[0].name.toLowerCase() + if (filename.endsWith(".jpg") || filename.endsWith(".jpeg") || filename.endsWith(".png") || filename.endsWith(".webp") || filename.endsWith(".gif")) + { + f.files = files; + document.getElementById('filename-edit-reply-' + id).textContent = filename; + } + } } \ No newline at end of file diff --git a/files/assets/js/submit.js b/files/assets/js/submit.js index 45fe0cff3..444cf5a01 100755 --- a/files/assets/js/submit.js +++ b/files/assets/js/submit.js @@ -117,33 +117,6 @@ function autoSuggestTitle() { }; -if (window.location.pathname=='/submit') { - window.onload = autoSuggestTitle(); -} - -document.addEventListener('paste', function (event) { - - var nothingFocused = document.activeElement === document.body; - - if (nothingFocused) { - - var clipText = event.clipboardData.getData('Text'); - - var url = new RegExp('^(?:[a-z]+:)?//', 'i'); - - if (url.test(clipText) && window.location.pathname !== '/submit') { - window.location.href = '/submit?url=' + clipText; - } - else if (url.test(clipText) && window.location.pathname == '/submit') { - - document.getElementById("post-URL").value = clipText; - - autoSuggestTitle() - - } - } -}); - function checkForRequired() { var title = document.getElementById("post-title"); diff --git a/files/templates/comments.html b/files/templates/comments.html index e0239d542..8015e7fbe 100755 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -26,7 +26,7 @@ {% if v %} {% include "award_modal.html" %} - + {% endif %} @@ -327,7 +327,7 @@