This commit is contained in:
Aevann1 2022-02-28 04:21:49 +02:00
parent b02c6f163b
commit 4be05d92ac
2 changed files with 25 additions and 21 deletions

View file

@ -11,8 +11,12 @@ function hide_image() {
document.onpaste = function(event) { document.onpaste = function(event) {
files = event.clipboardData.files files = event.clipboardData.files
filename = files[0].name.toLowerCase()
filename = files[0]
if (filename)
{
filename = filename.name.toLowerCase()
if (filename.endsWith(".jpg") || filename.endsWith(".jpeg") || filename.endsWith(".png") || filename.endsWith(".webp") || filename.endsWith(".gif")) if (filename.endsWith(".jpg") || filename.endsWith(".jpeg") || filename.endsWith(".png") || filename.endsWith(".webp") || filename.endsWith(".gif"))
{ {
if (document.activeElement.id == 'post-text') { if (document.activeElement.id == 'post-text') {
@ -33,6 +37,7 @@ document.onpaste = function(event) {
document.getElementById('post-url').value = null; document.getElementById('post-url').value = null;
localStorage.setItem("post_url", "") localStorage.setItem("post_url", "")
} }
}
} }
document.getElementById('file-upload').addEventListener('change', function(){ document.getElementById('file-upload').addEventListener('change', function(){
@ -71,11 +76,10 @@ function autoSuggestTitle() {
var x = new XMLHttpRequest(); var x = new XMLHttpRequest();
x.withCredentials=true; x.withCredentials=true;
x.onreadystatechange = function() { x.onreadystatechange = function() {
if (x.readyState == 4 && x.status == 200) { if (x.readyState == 4 && x.status == 200 && !titleField.value) {
title=JSON.parse(x.responseText)["title"]; title=JSON.parse(x.responseText)["title"];
titleField.value=title; titleField.value=title;
checkForRequired() checkForRequired()
} }
} }

View file

@ -272,7 +272,7 @@
<script src="/static/assets/js/marked.js?v=248"></script> <script src="/static/assets/js/marked.js?v=248"></script>
<script src="/static/assets/js/formatting.js?v=240"></script> <script src="/static/assets/js/formatting.js?v=240"></script>
<script src="/static/assets/js/submit.js?v=250"></script> <script src="/static/assets/js/submit.js?v=251"></script>
{% include "emoji_modal.html" %} {% include "emoji_modal.html" %}
{% include "gif_modal.html" %} {% include "gif_modal.html" %}