Improved UI interactions with things

This commit is contained in:
G2-Games 2024-10-24 12:58:11 -05:00
parent 094fb67649
commit 4809be56a9
2 changed files with 6 additions and 5 deletions

View file

@ -2,7 +2,7 @@ mod database;
mod strings;
mod settings;
use std::{fs, path::Path, sync::{Arc, RwLock}, thread, time::Duration};
use std::{fs, path::Path, sync::{Arc, RwLock}};
use blake3::Hash;
use chrono::{DateTime, TimeDelta, Utc};
use database::{clean_loop, Database, MochiFile};
@ -55,7 +55,7 @@ fn home(settings: &State<Settings>) -> Markup {
h2 { "Files up to " (settings.max_filesize.bytes()) " in size are allowed!" }
hr;
button.main_file_upload onclick="document.getElementById('fileInput').click()" {
h4 { "Upload File" }
h4 { "Upload File(s)" }
p { "Click or Drag and Drop" }
}
h3 { "Expire after:" }

View file

@ -58,21 +58,22 @@ function makeFinished(progressBar, progressText, linkRow, linkAddress, hash) {
const link = progressText.appendChild(document.createElement("a"));
link.textContent = hash;
link.href = linkAddress;
link.target = "_blank";
let button = linkRow.appendChild(document.createElement("button"));
button.textContent = "📝";
let buttonTimeout = null;
button.addEventListener('click', function(e) {
button.addEventListener('click', function(_e) {
if (buttonTimeout) {
clearTimeout(buttonTimeout)
}
navigator.clipboard.writeText(
encodeURI("https://" + window.location.host + "/" + linkAddress)
encodeURI(window.location.protocol + "//" + window.location.host + "/" + linkAddress)
)
button.textContent = "✅";
buttonTimeout = setTimeout(function() {
button.textContent = "📝";
}, 500);
}, 750);
})
progressBar.style.display = "none";