added upload button logic

This commit is contained in:
2025-01-23 20:33:21 +01:00
parent ad49d8d8c6
commit 982d47ce83
7 changed files with 110 additions and 28 deletions
+19 -2
View File
@@ -48,12 +48,29 @@ function setSillyValue(value) {
const picInput = document.getElementById("picInput")
const picValue = document.getElementById("picValue")
const picUpload = document.getElementById("picUpload")
const customPicOption = document.getElementById("customPic")
function setPictureValue() {
let src = picInput.value != "custom" ? `/assets/boykissers/${picInput.value}.png` : ""
picValue.src = src
if (picInput.value != "custom") {
let src = `/assets/boykissers/${picInput.value}.png`
picValue.src = src
}
else {
if (picUpload.files.length > 0) {
const file = picUpload.files[0]
const fileName = file.name
picValue.src = URL.createObjectURL(file)
customPicOption.innerHTML = `Custom (${fileName})`
}
else {
customPicOption.innerHTML = "Custom (upload)"
}
}
}
picUpload.oninput = function() { setPictureValue() }
picInput.oninput = function() { setPictureValue() }
function prependZero(number) {