« get me outta code hell

content: wiki wallpaper parts - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-05-27 19:07:05 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-05-27 19:07:05 -0300
commit03343c785c1743fd0240f975a14700e4edfda799 (patch)
tree5a03567b5fb0bb9ef20a5ddf48b11f3513685936
parentcbde2a5204f82e63c7c86833fb8fc24a74085d9c (diff)
content: wiki wallpaper parts
-rw-r--r--src/content/dependencies/generatePageLayout.js13
-rw-r--r--src/content/dependencies/generateWikiWallpaperStyleTag.js27
2 files changed, 29 insertions, 11 deletions
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index a0552454..0326f415 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -603,13 +603,18 @@ export default {
 
     const fallbackWallpaperStyleTag =
       (slottedWallpaperStyleTag
-        ? ''
+        ? html.blank()
         : relations.wikiWallpaperStyleTag);
 
+    const usingWallpaperStyleTag =
+      (slottedWallpaperStyleTag
+        ? slottedWallpaperStyleTag
+        : html.resolve(fallbackWallpaperStyleTag, {normalize: 'tag'}));
+
     const numWallpaperParts =
-      (slottedWallpaperStyleTag &&
-       slottedWallpaperStyleTag.attributes.has('data-wallpaper-mode', 'parts')
-        ? parseInt(slottedWallpaperStyleTag.attributes.get('data-num-wallpaper-parts'))
+      (usingWallpaperStyleTag &&
+       usingWallpaperStyleTag.attributes.has('data-wallpaper-mode', 'parts')
+        ? parseInt(usingWallpaperStyleTag.attributes.get('data-num-wallpaper-parts'))
         : 0);
 
     const wallpaperPartsHTML =
diff --git a/src/content/dependencies/generateWikiWallpaperStyleTag.js b/src/content/dependencies/generateWikiWallpaperStyleTag.js
index 3024ff79..12d27304 100644
--- a/src/content/dependencies/generateWikiWallpaperStyleTag.js
+++ b/src/content/dependencies/generateWikiWallpaperStyleTag.js
@@ -2,24 +2,37 @@ export default {
   contentDependencies: ['generateWallpaperStyleTag'],
   extraDependencies: ['wikiData'],
 
-  sprawl: ({wikiInfo}) => ({
-    wikiWallpaperFileExtension: wikiInfo.wikiWallpaperFileExtension,
-  }),
+  sprawl: ({wikiInfo}) => ({wikiInfo}),
 
   relations: (relation) => ({
     wallpaperStyleTag:
       relation('generateWallpaperStyleTag'),
   }),
 
-  data: (sprawl) => ({
-    path: [
+  data: ({wikiInfo}) => ({
+    singleWallpaperPath: [
       'media.path',
-      'bg.' + sprawl.wikiWallpaperFileExtension,
+      'bg.' + wikiInfo.wikiWallpaperFileExtension,
     ],
+
+    singleWallpaperStyle:
+      wikiInfo.wikiWallpaperStyle,
+
+    wallpaperPartPaths:
+      wikiInfo.wikiWallpaperParts.map(part =>
+        (part.asset
+          ? ['media.path', part.asset]
+          : null)),
+
+    wallpaperPartStyles:
+      wikiInfo.wikiWallpaperParts.map(part => part.style),
   }),
 
   generate: (data, relations) =>
     relations.wallpaperStyleTag.slots({
-      singleWallpaperPath: data.path,
+      singleWallpaperPath: data.singleWallpaperPath,
+      singleWallpaperStyle: data.singleWallpaperStyle,
+      wallpaperPartPaths: data.wallpaperPartPaths,
+      wallpaperPartStyles: data.wallpaperPartStyles,
     }),
 };