forked from will0101/www
-
Notifications
You must be signed in to change notification settings - Fork 0
/
click-to-copy.html
32 lines (26 loc) · 1.18 KB
/
click-to-copy.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<div class="flex pt-1 pb-1 ps-4 pe-1 mb-3 black-bg copy-section" style="max-width: 800px; margin-left:auto; margin-right:auto; height:60px; border: 1px solid #949494;">
<code class="white copy-text" style="font-size:16px;">sh <(curl tea.xyz)</code>
<button class="hbtn hb-fill-right copy-button" style="height:100%; width:30%;">Copy</button>
</div>
<script>
$(".copy-button").on("click", function() {
var copyText = $(this).siblings(".copy-text").text();
// Update the command to copy 'sh <(curl https://tea.xyz)'
copyText = copyText.replace("sh <(curl tea.xyz)", "sh <(curl https://tea.xyz)");
var tempInput = document.createElement("input");
tempInput.style = "position: absolute; left: -1000px; top: -1000px";
tempInput.value = copyText;
document.body.appendChild(tempInput);
tempInput.select();
document.execCommand("copy");
document.body.removeChild(tempInput);
// Change the button text to 'Copied'
var button = $(this);
var originalText = button.text();
button.text("Copied!");
// Change the button text back to original after 2 seconds
setTimeout(function() {
button.text(originalText);
}, 2000);
});
</script>