Skip to content

Commit

Permalink
copy button
Browse files Browse the repository at this point in the history
Signed-off-by: ClaytonTDM <claytontdm@gmail.com>
  • Loading branch information
ClaytonTDM committed Oct 8, 2024
1 parent a6aa887 commit 643fce0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions game/level/izombieleveleditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,27 @@
cloneFromPlants(l, f)
);
$("dAll").appendChild(levelDataElement);
const copyButtonElement = document.createElement("button");
copyButtonElement.style.position = "absolute";
copyButtonElement.style.left = "calc(75% - 17px)";
copyButtonElement.style.top = "50%";
copyButtonElement.style.transform = "translate(-50%, -50%)";
copyButtonElement.style.width = "35px";
copyButtonElement.style.height = "34px";
copyButtonElement.style.cursor = "pointer";
copyButtonElement.style.backgroundColor = "#fff";
copyButtonElement.style.borderStyle = "hidden solid hidden hidden";
copyButtonElement.style.borderRadius = "0px 10px 10px 0px";
copyButtonElement.style.borderColor = "#767676";
copyButtonElement.style.borderWidth = "2px";
copyButtonElement.style.zIndex = "1000";
copyButtonElement.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-copy" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="#000" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M0 0h24v24H0z" stroke="none"/><path d="M7 9.667A2.667 2.667 0 0 1 9.667 7h8.666A2.667 2.667 0 0 1 21 9.667v8.666A2.667 2.667 0 0 1 18.333 21H9.667A2.667 2.667 0 0 1 7 18.333z"/><path d="M4.012 16.737A2 2 0 0 1 3 15V5c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1"/></svg>`;
copyButtonElement.onclick = function () {
levelDataElement.select();
levelDataElement.setSelectionRange(0, 99999); // for mobile
navigator.clipboard.writeText(levelDataElement.value);
};
$("dAll").appendChild(copyButtonElement);
let buttonElement =
document.createElement("input");
buttonElement.setAttribute(
Expand Down

0 comments on commit 643fce0

Please sign in to comment.