diff options
Diffstat (limited to 'themes/hugo-coder/layouts')
| -rw-r--r-- | themes/hugo-coder/layouts/_default/baseof.html | 87 |
1 files changed, 47 insertions, 40 deletions
diff --git a/themes/hugo-coder/layouts/_default/baseof.html b/themes/hugo-coder/layouts/_default/baseof.html index f981b50..b7ac84e 100644 --- a/themes/hugo-coder/layouts/_default/baseof.html +++ b/themes/hugo-coder/layouts/_default/baseof.html | |||
| @@ -128,9 +128,9 @@ | |||
| 128 | <body class="preload-transitions {{ $csClass }}{{ if .Site.Params.rtl }} rtl{{ end }}" | 128 | <body class="preload-transitions {{ $csClass }}{{ if .Site.Params.rtl }} rtl{{ end }}" |
| 129 | onload="{{ if .Site.Params.enableTwemoji }} twemoji.parse(document.body); {{ end }}" | 129 | onload="{{ if .Site.Params.enableTwemoji }} twemoji.parse(document.body); {{ end }}" |
| 130 | > | 130 | > |
| 131 | <!-- <div id=fireworksContainer style="position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none;"></div> --> | ||
| 132 | 131 | ||
| 133 | <div id="snow" style="position: absolute; top: 0; left: 0; height: 100vh; width: 100vw; --s: 10s; --w: 50vw; --d: 0s;"></div> | 132 | <div id="fireworksContainer" style="position: fixed; left: 0; top: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; display: none;"></div> |
| 133 | <div id="snow" style="position: fixed; top: 0; left: 0; height: 100vh; width: 100vw; --s: 10s; --w: 50vw; --d: 0s; pointer-events: none; z-index: 1; display: none;"></div> | ||
| 134 | 134 | ||
| 135 | {{ partial "float" . }} | 135 | {{ partial "float" . }} |
| 136 | <main class="wrapper"> | 136 | <main class="wrapper"> |
| @@ -180,45 +180,51 @@ | |||
| 180 | {{ if and .Site.Params.googleTagManager .Site.Params.googleTagManager.id }} | 180 | {{ if and .Site.Params.googleTagManager .Site.Params.googleTagManager.id }} |
| 181 | {{- partial "analytics/googletagmanager" . -}} | 181 | {{- partial "analytics/googletagmanager" . -}} |
| 182 | {{ end }} | 182 | {{ end }} |
| 183 | <!-- {{ if eq .RelPermalink "/" }} | ||
| 184 | <script src="https://cdn.jsdelivr.net/npm/fireworks-js@latest/dist/fireworks.js"></script> | ||
| 185 | <script> | ||
| 186 | const c = document.querySelector("#fireworksContainer") | ||
| 187 | const f = new Fireworks(c, { | ||
| 188 | "hue": { | ||
| 189 | "min": 0, | ||
| 190 | "max": 345 | ||
| 191 | }, | ||
| 192 | "delay": { | ||
| 193 | "min": 45, | ||
| 194 | "max": 60 | ||
| 195 | }, | ||
| 196 | "rocketsPoint": 27, | ||
| 197 | "opacity": 0.5, | ||
| 198 | "speed": 15, | ||
| 199 | "acceleration": 1.1, | ||
| 200 | "friction": 0.97, | ||
| 201 | "gravity": 1.5, | ||
| 202 | "particles": 150, | ||
| 203 | "trace": 6, | ||
| 204 | "explosion": 7, | ||
| 205 | "autoresize": true, | ||
| 206 | "brightness": { | ||
| 207 | "min": 50, | ||
| 208 | "max": 80, | ||
| 209 | "decay": { | ||
| 210 | "min": 0.015, | ||
| 211 | "max": 0.03 | ||
| 212 | } | ||
| 213 | }, | ||
| 214 | }) | ||
| 215 | f._randomRocketsPoint = true | ||
| 216 | f.start() | ||
| 217 | </script> | ||
| 218 | {{ end }} --> | ||
| 219 | 183 | ||
| 220 | <script> | 184 | <script> |
| 221 | function r(min, max) { | 185 | const today = new Date(); |
| 186 | const month = today.getMonth(); // 0 = Jan, 11 = Dec | ||
| 187 | const day = today.getDate(); | ||
| 188 | |||
| 189 | const showFireworks = (month === 0 && day >= 1 && day <= 5); | ||
| 190 | const showSnow = (month === 11) || (month === 0 && day > 5 && day <= 31); | ||
| 191 | |||
| 192 | if (showFireworks) { | ||
| 193 | {{ if eq .RelPermalink "/" }} | ||
| 194 | document.getElementById("fireworksContainer").style.display = "block"; | ||
| 195 | const script = document.createElement("script"); | ||
| 196 | script.src = "https://cdn.jsdelivr.net/npm/fireworks-js@latest/dist/fireworks.js"; | ||
| 197 | script.onload = () => { | ||
| 198 | const c = document.querySelector("#fireworksContainer"); | ||
| 199 | const f = new Fireworks(c, { | ||
| 200 | "hue": { "min": 0, "max": 345 }, | ||
| 201 | "delay": { "min": 45, "max": 60 }, | ||
| 202 | "rocketsPoint": 27, | ||
| 203 | "opacity": 0.5, | ||
| 204 | "speed": 15, | ||
| 205 | "acceleration": 1.1, | ||
| 206 | "friction": 0.97, | ||
| 207 | "gravity": 1.5, | ||
| 208 | "particles": 150, | ||
| 209 | "trace": 6, | ||
| 210 | "explosion": 7, | ||
| 211 | "autoresize": true, | ||
| 212 | "brightness": { | ||
| 213 | "min": 50, | ||
| 214 | "max": 80, | ||
| 215 | "decay": { "min": 0.015, "max": 0.03 } | ||
| 216 | } | ||
| 217 | }); | ||
| 218 | f._randomRocketsPoint = true; | ||
| 219 | f.start(); | ||
| 220 | }; | ||
| 221 | document.body.appendChild(script); | ||
| 222 | {{ end }} | ||
| 223 | } else if (showSnow) { | ||
| 224 | const snowContainer = document.getElementById("snow"); | ||
| 225 | snowContainer.style.display = "block"; | ||
| 226 | |||
| 227 | function r(min, max) { | ||
| 222 | return Math.random() * (max - min) + min; | 228 | return Math.random() * (max - min) + min; |
| 223 | } | 229 | } |
| 224 | 230 | ||
| @@ -226,8 +232,9 @@ | |||
| 226 | const el = document.createElement("div"); | 232 | const el = document.createElement("div"); |
| 227 | el.className = "snow"; | 233 | el.className = "snow"; |
| 228 | el.style = `--x: ${r(0, 200)}vw; --y: -${r(0, 100)}vh; --d: ${r(-20, 20)}s; --w: ${r(40, 70)}vw; --s: ${r(12, 20)}s;`; | 234 | el.style = `--x: ${r(0, 200)}vw; --y: -${r(0, 100)}vh; --d: ${r(-20, 20)}s; --w: ${r(40, 70)}vw; --s: ${r(12, 20)}s;`; |
| 229 | snow.appendChild(el); | 235 | snowContainer.appendChild(el); |
| 230 | } | 236 | } |
| 237 | } | ||
| 231 | </script> | 238 | </script> |
| 232 | 239 | ||
| 233 | </body> | 240 | </body> |
