From d8bda573008ab1f23e30cb4f1533468090e5dddb Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 10 Jan 2023 09:04:11 +0100 Subject: Better asset handling; paragraph fix for new Pandoc versions; updated emojis --- content/assets/snow.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 content/assets/snow.js (limited to 'content/assets/snow.js') diff --git a/content/assets/snow.js b/content/assets/snow.js new file mode 100644 index 0000000..562e9c0 --- /dev/null +++ b/content/assets/snow.js @@ -0,0 +1,30 @@ +(() => { + function createSnowFlake() { + setTimeout(() => createSnowFlake(), 50 / Math.log10(window.innerWidth / 1000 + 1)); + + if (document.hidden) { + return; + } + + const snowFlake = document.createElementNS("http://www.w3.org/2000/svg", "svg"); + const snowFlakeInner = document.createElementNS("http://www.w3.org/2000/svg", "use"); + const aniDuration = (Math.random() * 3 + 2) * 1000; + + snowFlakeInner.setAttribute("href", "/icons.svg#asterisk"); + + snowFlake.classList.add("o-icon", "o-icon--snow"); + snowFlake.setAttribute("aria-hidden", "true"); + + snowFlake.style.fontSize = Math.random() * 0.5 + 0.7 + 'em'; + snowFlake.style.left = Math.random() * 100 + '%'; + snowFlake.style.animationDuration = aniDuration + 'ms'; + snowFlake.style.opacity = Math.random(); + + setTimeout(() => snowFlake.remove(), aniDuration); + + snowFlake.appendChild(snowFlakeInner); + document.body.appendChild(snowFlake); + } + + createSnowFlake(); +})(); -- cgit v1.2.3-54-g00ecf