diff options
Diffstat (limited to 'web/assets/js/util')
| -rw-r--r-- | web/assets/js/util/common.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/web/assets/js/util/common.js b/web/assets/js/util/common.js index 779af0bf..df826aa9 100644 --- a/web/assets/js/util/common.js +++ b/web/assets/js/util/common.js @@ -64,6 +64,24 @@ function formatSecond(second) { } } +function copyToClipboard(text) { + // !! here old way of copying is used because not everyone can afford https connection + return new Promise((resolve) => { + const textarea = document.createElement("textarea"); + + textarea.value = text; + + document.body.appendChild(textarea); + + textarea.select(); + document.execCommand("copy"); + + document.body.removeChild(textarea); + + resolve(text) + }) +} + function addZero(num) { if (num < 10) { return "0" + num; |
