diff --git a/index.js b/index.js index b740872..cbc519d 100644 --- a/index.js +++ b/index.js @@ -352,5 +352,12 @@ window.viewShape = (key) => { window.shareShape = () => { const code = document.getElementById("code").value.trim(); const url = "https://viewer.shapez.io?" + code; - alert("You can share this url: " + url); + const copyField = document.createElement('textarea'); + copyField.setAttribute('hidden', 'true'); + copyField.value = url; + document.body.appendChild(copyField); + copyField.select(); + document.execCommand('copy'); + document.body.removeChild(copyField); + alert("The Share link was copied to clipboard!"); };