Upload copy.html
Browse files
copy.html
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<html>
|
2 |
+
<head>
|
3 |
+
<meta charset="UTF-8">
|
4 |
+
<title>Copy Text to Clipboard</title>
|
5 |
+
<meta http-equiv="Content-Security-Policy" content="frame-ancestors 'self' *">
|
6 |
+
<style>
|
7 |
+
#copyButton {
|
8 |
+
transition: opacity 1s;
|
9 |
+
padding: 0;
|
10 |
+
}
|
11 |
+
</style>
|
12 |
+
</head>
|
13 |
+
<body>
|
14 |
+
<input type="text" id="textToCopy" value="" style="position: absolute; left: -9999px;">
|
15 |
+
|
16 |
+
<button id="copyButton" onclick="copyToClipboard()">📋</button>
|
17 |
+
|
18 |
+
<script>
|
19 |
+
function getQueryParam(name) {
|
20 |
+
const urlSearchParams = new URLSearchParams(window.location.search);
|
21 |
+
return urlSearchParams.get(name);
|
22 |
+
}
|
23 |
+
|
24 |
+
const textToCopy = document.getElementById("textToCopy");
|
25 |
+
const copyText = getQueryParam("copy");
|
26 |
+
if (copyText) {
|
27 |
+
textToCopy.value = decodeURIComponent(copyText);
|
28 |
+
}
|
29 |
+
|
30 |
+
const copyButton = document.getElementById("copyButton");
|
31 |
+
copyButton.title = textToCopy.value;
|
32 |
+
|
33 |
+
function copyToClipboard() {
|
34 |
+
textToCopy.select();
|
35 |
+
document.execCommand("copy");
|
36 |
+
|
37 |
+
const clipboardContents = textToCopy.value;
|
38 |
+
|
39 |
+
copyButton.textContent = "✔";
|
40 |
+
setTimeout(function () {
|
41 |
+
copyButton.textContent = "📋";
|
42 |
+
copyButton.title = textToCopy.value;
|
43 |
+
}, 1000);
|
44 |
+
}
|
45 |
+
</script>
|
46 |
+
</body>
|
47 |
+
</html>
|