blob: 196301e35145d280ded68d6929bc8a8d48ce7c8e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
let scrollToTop = () => {
const c = document.documentElement.scrollTop || document.body.scrollTop;
if (c > 0) {
window.requestAnimationFrame(scrollToTop);
window.scrollTo(0, c - c / 8);
}
};
function copyUrl(text) {
let copyFrom = document.createElement("textarea");
copyFrom.textContent = text;
document.body.appendChild(copyFrom);
copyFrom.select();
document.execCommand("copy");
copyFrom.blur();
document.body.removeChild(copyFrom);
let copiedMessage = document.createElement("div");
copiedMessage.id = "copiedMessage";
copiedMessage.textContent = "Link copied to clipboard";
copiedMessage.classList.add("bg-warning", "shadow", "d-block", "text-center");
document.body.appendChild(copiedMessage);
setTimeout(function() {
copiedMessage.style.opacity = 0;
}, 500);
setTimeout(function() {
document.body.removeChild(copiedMessage);
}, 1500);
}
|