@conduction/docusaurus-preset 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/static/lib/canal-footer.js +29 -7
package/package.json
CHANGED
|
@@ -129,15 +129,37 @@
|
|
|
129
129
|
/* Product pages opt out of the boat-sinking mini-game by setting
|
|
130
130
|
`themeConfig.minigames = false` in createConfig(); the Footer
|
|
131
131
|
swizzle then doesn't render the .game-hud / .game-over / boat
|
|
132
|
-
templates. The
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
templates. The static decoration (trapgevel skyline, drift speeds,
|
|
133
|
+
Conduction-house Maps link, drift-boat caches) is still wanted —
|
|
134
|
+
run those first so a no-game build doesn't ship an empty .skyline.
|
|
135
|
+
Then bail out before the game-only wiring rather than null-deref'ing
|
|
136
|
+
on the missing HUD / restart-button. The script's `resize` handler
|
|
137
|
+
re-runs buildSkyline() on viewport changes too, so the skyline
|
|
138
|
+
stays full when a viewer resizes the window. */
|
|
135
139
|
if (!hud || !goRestart || !goPanel) {
|
|
136
|
-
|
|
137
|
-
|
|
140
|
+
buildSkyline();
|
|
141
|
+
rollSpeeds();
|
|
142
|
+
wireConductionHouse();
|
|
143
|
+
captureDriftTemplates();
|
|
144
|
+
const onResizeNoGame = () => {
|
|
145
|
+
clearTimeout(window._canalNoGameResizeT);
|
|
146
|
+
window._canalNoGameResizeT = setTimeout(() => {
|
|
147
|
+
buildSkyline();
|
|
148
|
+
rollSpeeds();
|
|
149
|
+
wireConductionHouse();
|
|
150
|
+
}, 200);
|
|
151
|
+
};
|
|
152
|
+
window.addEventListener('resize', onResizeNoGame);
|
|
153
|
+
/* Mark hydrated and expose hydrate as a no-op (the IIFE's later
|
|
154
|
+
`window.CanalFooter.hydrate = init` already handles the SPA
|
|
155
|
+
re-mount path; we just need _cleanup to tear down the resize
|
|
156
|
+
listener so it doesn't leak across SPA navigations. */
|
|
138
157
|
window.CanalFooter = window.CanalFooter || {};
|
|
139
|
-
window.CanalFooter.hydrate
|
|
140
|
-
window.CanalFooter._cleanup =
|
|
158
|
+
window.CanalFooter.hydrate = window.CanalFooter.hydrate || function () {};
|
|
159
|
+
window.CanalFooter._cleanup = function () {
|
|
160
|
+
window.removeEventListener('resize', onResizeNoGame);
|
|
161
|
+
clearTimeout(window._canalNoGameResizeT);
|
|
162
|
+
};
|
|
141
163
|
return;
|
|
142
164
|
}
|
|
143
165
|
|