mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2026-09-22 00:34:55 -05:00
js: Fix copy to clipboard button stuck as "Copied" when clicked twice
This commit is contained in:
@@ -14,9 +14,8 @@ async function copy_to_clipboard(button) {
|
|||||||
await navigator.clipboard.writeText(rawCode);
|
await navigator.clipboard.writeText(rawCode);
|
||||||
|
|
||||||
// TODO: maybe we could add a fancier indicator, like a flash or something
|
// TODO: maybe we could add a fancier indicator, like a flash or something
|
||||||
const originalCopyText = button.innerHTML;
|
|
||||||
button.innerHTML = "Copied!";
|
button.innerHTML = "Copied!";
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
button.innerHTML = originalCopyText;
|
button.innerHTML = "{{ i18n "copy_to_clipboard" }}";
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
@@ -19,9 +19,11 @@
|
|||||||
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" media="print" onload="this.media='all'">
|
<link rel="stylesheet" type="text/css" href="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous" media="print" onload="this.media='all'">
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with resources.Get "js/bobatheme.js" | fingerprint "sha512" }}
|
{{ with resources.Get "js/bobatheme.tmpl.js" }}
|
||||||
|
{{ with resources.ExecuteAsTemplate "js/bobatheme.js" $ . | fingerprint "sha512" }}
|
||||||
<script defer src="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
|
<script defer src="{{ .Permalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
{{ if not hugo.IsServer }}
|
{{ if not hugo.IsServer }}
|
||||||
<script defer data-domain="bbaovanc.com" src="https://plausible.bbaovanc.com/js/bobalytics.outbound-links.js"></script>
|
<script defer data-domain="bbaovanc.com" src="https://plausible.bbaovanc.com/js/bobalytics.outbound-links.js"></script>
|
||||||
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
|
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user