-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlinksScripts.js
More file actions
38 lines (31 loc) · 1.22 KB
/
linksScripts.js
File metadata and controls
38 lines (31 loc) · 1.22 KB
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
31
32
33
34
35
36
37
38
<!--Script por Ulises Alvarenga https://github.com/Ulysses-Alv -->
function copyToClipboard(text, elementId, classes, textNode) {
const el = document.createElement('textarea');
el.value = text;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
const icono = document.getElementById(elementId);
icono.textContent = "Copied";
setTimeout(() => recreate(elementId, classes, textNode), 400)
}
function recreate(_elementId, _classes, _textNode) {
const miEnlace = document.getElementById(_elementId);
miEnlace.textContent = "";
const iconoDiscord = document.createElement("i");
iconoDiscord.className = _classes;
const textoEnlace = document.createTextNode(_textNode);
miEnlace.appendChild(iconoDiscord);
miEnlace.appendChild(textoEnlace);
}
const cursor = document.querySelector('.cursor');
document.addEventListener('mousemove', e => {
cursor.setAttribute("style", "top: "+(e.pageY - 10)+"px; left: "+(e.pageX - 10)+"px;")
})
document.addEventListener('click', () => {
cursor.classList.add("expand");
setTimeout(() => {
cursor.classList.remove("expand");
}, 500)
})