added it to the rest of the buttons

This commit is contained in:
Boof 2023-03-08 13:32:44 +01:00 committed by GitHub
parent 58d912614c
commit 683a349f5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,9 +16,9 @@
<label style="color: #ffffff;">Input data</label><br>
<textarea style="width: 90%; background: #343538; color: #ffffff;" value="" rows="6" cols="80" id="input"
required></textarea><br>
<button class="button" style="--color:#1e9bff; background: bottom;" type="button"
<button class="button" id="encodebutton" style="--color:#1e9bff; background: bottom;" type="button"
onclick="doencode();">Encode</button>
<button type="button" style="--color: #ff1867; margin-left: 2em; background: bottom;" class="button"
<button type="button" id="decodebutton" style="--color: #ff1867; margin-left: 2em; background: bottom;" class="button"
onclick="dodecode();">Decode</button><br>
<label style="color: #ffffff;">Output</label><br>
<textarea style="width: 90%; background: #343538; color: #ffffff;" id="output" rows="6" cols="80"
@ -39,15 +39,18 @@
function docopy() {
document.getElementById("output").select();
document.execCommand('copy');
copytext()
}
function doencode() {
var output = btoa(document.getElementById("input").value)
document.getElementById("output").value = output;
encodetext()
}
function dodecode() {
var output = atob(document.getElementById("input").value)
document.getElementById("output").value = output;
decodetext()
}
async function copytext() {
@ -55,5 +58,15 @@
await delay(500)
document.getElementById("copy").innerHTML = "Copy"
}
async function encodetext() {
document.getElementById("encodebutton").innerHTML = "Encoded!"
await delay(500)
document.getElementById("encodebutton").innerHTML = "Encode"
}
async function decodetext() {
document.getElementById("decodebutton").innerHTML = "Decoded!"
await delay(500)
document.getElementById("decodebutton").innerHTML = "Decode"
}
</script>
</body>