Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'web/assets/js')
-rw-r--r--web/assets/js/util/common.js18
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;