-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWait.js
More file actions
58 lines (47 loc) 路 2.18 KB
/
Copy pathWait.js
File metadata and controls
58 lines (47 loc) 路 2.18 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
class Wait extends HTMLDivElement {
constructor() {
super();
const div = document.createElement("div");
const anim_content = this.appendChild(document.createElement("div"));
const link = this.appendChild(document.createElement("style"));
div.classList.add("wait-animated");
div.style.width = this.attributes.getNamedItem("width") ? this.attributes.getNamedItem("width").value + "px" : "100px";
div.style.height = this.attributes.getNamedItem("width") ? this.attributes.getNamedItem("width").value + "px" : "100px";
div.style.background = this.attributes.getNamedItem("background") ? this.attributes.getNamedItem("background").value : "black"
anim_content.style.width = this.attributes.getNamedItem("width") ? (Number(this.attributes.getNamedItem("width")) * 2).value + "px" : "200px";
anim_content.style.height = this.attributes.getNamedItem("width") ? (Number(this.attributes.getNamedItem("width")) * 2).value + "px" : "200px";
anim_content.appendChild(div);
anim_content.classList.add("content");
link.innerText = `
@keyframes wait-anim {
from {
top: 0;
left: 0;
}
25% {
top: 0;
left: ${this.attributes.getNamedItem("width") ? this.attributes.getNamedItem("width").value + "px" : "100px"};
}
50% {
top: ${this.attributes.getNamedItem("width") ? this.attributes.getNamedItem("width").value + "px" : "100px"};
left: ${this.attributes.getNamedItem("width") ? this.attributes.getNamedItem("width").value + "px" : "100px"};
}
75% {
top: ${this.attributes.getNamedItem("width") ? this.attributes.getNamedItem("width").value + "px" : "100px"};
left: 0;
}
to {
top: 0;
left: 0;
}
}
wait-js div.wait-animated {
position: relative;
animation: wait-anim infinite .7s;
}
wait-js div.content {
width: ${this.attributes.getNamedItem("width") ? (Number(this.attributes.getNamedItem("width").value) * 2) + "px" : "200px"};
height: ${this.attributes.getNamedItem("width") ? (Number(this.attributes.getNamedItem("width").value) * 2) + "px" : "200px"};
}`
}
}