actually copy the IP

This commit is contained in:
hokkqi 2020-07-17 18:45:18 +02:00
parent 0aa6f3377d
commit b62071b0cb

View file

@ -21,11 +21,17 @@
/>
<br />
<div class="ip">
<div class="ip" onclick="copyIP()">
<img src="./assets/images/new/ip address.png" alt="" />
</div>
<div class="buttons">
<div id="discord">
<a href="https://discord.gg/tzxXz5D">
<img src="./assets/images/new/discord.png" alt="" class="button" />
</a>
</div>
<div id="audio_stream">
<a href="https://discord.gg/tzxXz5D"
><img
@ -35,14 +41,6 @@
/></a>
</div>
<div id="discord">
<a
href="https://docs.google.com/forms/d/e/1FAIpQLSfDjBqwumbZkjznuFKWVsbVTARF1jxbFsJc0jYflWhsQ8Pzmw/viewform"
>
<img src="./assets/images/new/discord.png" alt="" class="button" />
</a>
</div>
<div id="vip">
<a href="https://forms.gle/7RequadVcZM344po8">
<img src="./assets/images/new/vip.png" alt="" class="button" />
@ -86,5 +84,36 @@
<a href="https://twitter.com/hokkqi" target="_blank">HOKKQI</a>
</p>
</div>
<input
style="display: none;"
type="text"
value="mc.nonstop.world"
id="ip"
/>
<div id="snackbar">Copied IP to clipboard!</div>
<script>
function copyIP() {
console.log("Trying to copy IP");
let copyText = document.getElementById("ip");
//console.log(copyText);
copyText.select();
copyText.setSelectionRange(0, 99999); /*For mobile devices*/
document.execCommand("copy");
// incase that failed
if (navigator.clipboard) {
navigator.clipboard.writeText(copyText.value);
}
var x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function () {
x.className = x.className.replace("show", "");
}, 3000);
}
</script>
</body>
</html>