aboutsummaryrefslogtreecommitdiffstats
path: root/general/clipboard.js
diff options
context:
space:
mode:
Diffstat (limited to 'general/clipboard.js')
-rw-r--r--general/clipboard.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/general/clipboard.js b/general/clipboard.js
new file mode 100644
index 00000000..cbcfa4ad
--- /dev/null
+++ b/general/clipboard.js
@@ -0,0 +1,8 @@
+/* copy code to clipboard */
+function CopyToClipboard(element) {
+ element.style.filter = 'invert(1)';
+ navigator.clipboard.writeText(element.firstElementChild.textContent);
+ setTimeout(function() {
+ element.style.filter = 'invert(0)';
+ }, 100);
+}