add clipboard button
This commit is contained in:
parent
3bbf51e5f8
commit
57b841ac3d
|
@ -22,6 +22,11 @@ button {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
&.half {
|
||||||
|
float: left;
|
||||||
|
width: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
&.pagination:not(.normal) {
|
&.pagination:not(.normal) {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 5vmin;
|
bottom: 5vmin;
|
||||||
|
|
|
@ -101,9 +101,9 @@ html(lang="en-gb")
|
||||||
p#added
|
p#added
|
||||||
|
|
||||||
textarea#output(autocomplete="off")
|
textarea#output(autocomplete="off")
|
||||||
br
|
|
||||||
|
|
||||||
button#download download
|
button#clipboard.half copy to clipboard
|
||||||
|
button#download.half download
|
||||||
|
|
||||||
button.pagination.prev#add add another image
|
button.pagination.prev#add add another image
|
||||||
button.pagination.start#reset start again
|
button.pagination.start#reset start again
|
||||||
|
|
16
script.js
16
script.js
|
@ -24,6 +24,18 @@ function download(filename, text) {
|
||||||
document.body.removeChild(element);
|
document.body.removeChild(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyToClipboard() {
|
||||||
|
const button = el("clipboard");
|
||||||
|
|
||||||
|
el("output").select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
button.innerText = "copied!";
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
button.innerText = "copy to clipboard";
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
|
||||||
function el(id) {
|
function el(id) {
|
||||||
return document.getElementById(id);
|
return document.getElementById(id);
|
||||||
}
|
}
|
||||||
|
@ -64,6 +76,7 @@ async function run() {
|
||||||
|
|
||||||
const buttonAddImage = el("add");
|
const buttonAddImage = el("add");
|
||||||
const buttonBackToImage = el("back-to-image");
|
const buttonBackToImage = el("back-to-image");
|
||||||
|
const buttonCopyToClipboard = el("clipboard")
|
||||||
const buttonDownload = el("download");
|
const buttonDownload = el("download");
|
||||||
const buttonGameDataProceed = el("game-data-next");
|
const buttonGameDataProceed = el("game-data-next");
|
||||||
const buttonImageProceed = el("image-next");
|
const buttonImageProceed = el("image-next");
|
||||||
|
@ -241,6 +254,9 @@ async function run() {
|
||||||
download("output.bitsy", textareaGameDataOutput.value);
|
download("output.bitsy", textareaGameDataOutput.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buttonCopyToClipboard.addEventListener("click", copyToClipboard);
|
||||||
|
buttonCopyToClipboard.addEventListener("touchend", copyToClipboard);
|
||||||
|
|
||||||
buttonDownload.addEventListener("click", handleDownload);
|
buttonDownload.addEventListener("click", handleDownload);
|
||||||
buttonDownload.addEventListener("touchend", handleDownload);
|
buttonDownload.addEventListener("touchend", handleDownload);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue