From 3be664d8c78686ca02520ffed4bb7c88f27a4eca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Fri, 26 Apr 2024 15:03:12 +0200 Subject: [PATCH] Rewrite some stuff --- assets/script.js | 8 ++++---- pages/memes/create.html | 16 +++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/assets/script.js b/assets/script.js index 72c45d6..6df4457 100644 --- a/assets/script.js +++ b/assets/script.js @@ -549,6 +549,7 @@ if ("loading" === document.readyState) { async function uploadFile() { const fileInput = document.getElementById('fileInput'); + const fileForm = document.getElementById('uploadForm'); let data = { action: "uploadFiles" }; @@ -556,7 +557,7 @@ async function uploadFile() { data[`userFile${i}`] = fileInput.files[i]; } await doAction("/upload", data, "Súbor bol úspešne nahraný", "Nastala chyba pri nahrávaní súboru", false); - fileInput.reset(); + fileForm.reset(); } async function deleteFile(fileID) { @@ -590,6 +591,7 @@ async function addMeme() { let memeTitleElement = document.getElementById("meme_title_input"); let memeTextElement = document.getElementById("meme_text_input"); let memeImageElement = document.getElementById("meme_image_input"); + let memeFormElement = document.getElementById("memeAddForm"); await doAction("/meme", { action: "addMeme", @@ -597,9 +599,7 @@ async function addMeme() { meme_text: memeTextElement.value, meme_image_id: memeImageElement.value }, "Meme bol zmazaný", "Nastala chyba pri mazaní meme-u", false); - memeTitleElement.reset(); - memeTextElement.reset(); - memeImageElement.reset(); + memeFormElement.reset(); } async function deleteMeme(memeId) { diff --git a/pages/memes/create.html b/pages/memes/create.html index 0173318..655c383 100644 --- a/pages/memes/create.html +++ b/pages/memes/create.html @@ -1,9 +1,11 @@ - - - - - - - \ No newline at end of file +
+ + + + + + + +
\ No newline at end of file