From 9a3e0f6e2922cf05e3f3fc912c45c91f5fff045e Mon Sep 17 00:00:00 2001 From: ebolam Date: Sat, 24 Sep 2022 15:29:54 -0400 Subject: [PATCH] Upload without saving button --- static/koboldai.css | 4 ++++ static/koboldai.js | 13 ++++++++++++- templates/popups.html | 18 ++++++++++++------ 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/static/koboldai.css b/static/koboldai.css index 14917fca..baeeb034 100644 --- a/static/koboldai.css +++ b/static/koboldai.css @@ -532,6 +532,10 @@ border-top-right-radius: var(--tabs_rounding); transform: translateY(22%); } +#upload_without_save_button { + transform: translateY(22%); +} + .settings_button[story_gamesaved="true"] { filter: brightness(40%); } diff --git a/static/koboldai.js b/static/koboldai.js index 311d361f..fb83143d 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -2183,7 +2183,18 @@ function upload_file(file_box) { for (file of fileList) { reader = new FileReader(); reader.onload = function (event) { - socket.emit("upload_file", {'filename': file.name, "data": event.target.result, 'upload_no_save': document.getElementById('upload_no_save').checked}); + socket.emit("upload_file", {'filename': file.name, "data": event.target.result, 'upload_no_save': false}); + }; + reader.readAsArrayBuffer(file); + } +} + +function upload_file_without_save(file_box) { + var fileList = file_box.files; + for (file of fileList) { + reader = new FileReader(); + reader.onload = function (event) { + socket.emit("upload_file", {'filename': file.name, "data": event.target.result, 'upload_no_save': true}); }; reader.readAsArrayBuffer(file); } diff --git a/templates/popups.html b/templates/popups.html index a882f591..83c2f011 100644 --- a/templates/popups.html +++ b/templates/popups.html @@ -11,16 +11,22 @@
Drag file(s) above or click here to Upload File - + + + + + - -