File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change 35
35
<a href="{{.RawURL}}">raw</a>
36
36
</p>
37
37
<p class="font-bold m-0">expires: {{.ExpiresAt}}</p>
38
+ <script>
39
+ function init() {
40
+ const btn = document.querySelector("#copy-btn");
41
+ const res = document.querySelector("#copy-result");
42
+ const text = "{{.Text}}";
43
+ btn.addEventListener("click", () => {
44
+ res.innerHtml = "";
45
+ navigator.clipboard.writeText(text)
46
+ .then(() => res.innerHTML = "success!");
47
+ })
48
+ }
49
+ document.addEventListener("DOMContentLoaded", init);
50
+ </script>
38
51
</header>
39
52
<main>
40
- <script>
41
- function copyText() {
42
- const text = `{{.Text}}`
43
- navigator.clipboard.writeText(text)
44
- }
45
- </script>
46
- <button onclick="copyText()" class="btn mt inline-block">Copy Paste</button>
53
+ <div class="flex gap items-center">
54
+ <button id="copy-btn" class="btn" style="background-color: transparent;">copy</button>
55
+ <div id="copy-result" class=""></div>
56
+ </div>
47
57
<article>
48
58
{{.Contents}}
49
59
</article>
You can’t perform that action at this time.
0 commit comments