diff options
Diffstat (limited to 'content/script.js')
-rw-r--r-- | content/script.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/content/script.js b/content/script.js new file mode 100644 index 0000000..5702edf --- /dev/null +++ b/content/script.js | |||
@@ -0,0 +1,22 @@ | |||
1 | function createSnowFlake() { | ||
2 | const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg"); | ||
3 | const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use"); | ||
4 | |||
5 | snowFlakeInner.setAttribute("href", "/symbols.svg#icon-asterisk"); | ||
6 | |||
7 | snowFlake.classList.add("o-icon"); | ||
8 | snowFlake.classList.add("o-icon--snow"); | ||
9 | snowFlake.ariaHidden = true; | ||
10 | |||
11 | snowFlake.style.width = Math.random() * 10 + 10 + 'px'; | ||
12 | snowFlake.style.left = Math.random() * window.innerWidth + 'px'; | ||
13 | snowFlake.style.animationDuration = Math.random() * 3 + 2 + 's'; | ||
14 | snowFlake.style.opacity = Math.random(); | ||
15 | |||
16 | snowFlake.appendChild(snowFlakeInner); | ||
17 | document.body.appendChild(snowFlake); | ||
18 | |||
19 | setTimeout(() => { snowFlake.remove(); }, 5000); | ||
20 | } | ||
21 | |||
22 | window.addEventListener("load", () => { setInterval(createSnowFlake, 100); }) | ||