From 2fa13de5fa2327d2206bd4f420f264079e4c476c Mon Sep 17 00:00:00 2001 From: edbrz9 Date: Sat, 31 Dec 2022 21:31:15 +0100 Subject: [PATCH] copyme component added to js --- assets/js/ed.brz9.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/assets/js/ed.brz9.js b/assets/js/ed.brz9.js index 202a9b9..eb22eaa 100644 --- a/assets/js/ed.brz9.js +++ b/assets/js/ed.brz9.js @@ -1,4 +1,36 @@ - +Vue.component('copyme', { + template: ` +
+ Copied! +
+ +
+
+ `, + data() { + return { + isCopied: false + } + }, + methods : { + copyToClipboard() { + const textToCopy = this.$refs.copyThis; + const range = document.createRange(); + range.selectNode(textToCopy); + window.getSelection().removeAllRanges(); + window.getSelection().addRange(range); + document.execCommand('copy'); + window.getSelection().removeAllRanges(); + this.copyDone(); + }, + copyDone(){ + this.isCopied = true; + this.$refs.element.addEventListener('animationend', () => { + this.isCopied = false; + }); + } + } +}) Vue.component('ppbut' ,{ template : `