refactor: move copy function to utils.js

This commit is contained in:
Shishkevich D.
2025-03-07 07:27:33 +00:00
parent 7483fb2ec5
commit 26bf693dbd
6 changed files with 63 additions and 43 deletions

View File

@@ -53,24 +53,6 @@ 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;