« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/dependencies')
-rw-r--r--src/content/dependencies/generateAlbumAdditionalFilesList.js6
-rw-r--r--src/content/dependencies/generatePageLayout.js12
-rw-r--r--src/content/dependencies/image.js6
3 files changed, 18 insertions, 6 deletions
diff --git a/src/content/dependencies/generateAlbumAdditionalFilesList.js b/src/content/dependencies/generateAlbumAdditionalFilesList.js
index 9818a43c..ad17206f 100644
--- a/src/content/dependencies/generateAlbumAdditionalFilesList.js
+++ b/src/content/dependencies/generateAlbumAdditionalFilesList.js
@@ -9,7 +9,7 @@ export default {
     'transformContent',
   ],
 
-  extraDependencies: ['getSizeOfAdditionalFile', 'html', 'urls'],
+  extraDependencies: ['getSizeOfMediaFile', 'html', 'urls'],
 
   relations: (relation, album, additionalFiles) => ({
     list:
@@ -55,7 +55,7 @@ export default {
     showFileSizes: {type: 'boolean', default: true},
   },
 
-  generate: (data, relations, slots, {getSizeOfAdditionalFile, urls}) =>
+  generate: (data, relations, slots, {getSizeOfMediaFile, urls}) =>
     relations.list.slots({
       chunks:
         stitchArrays({
@@ -86,7 +86,7 @@ export default {
                   fileLink: fileLink,
                   fileSize:
                     (slots.showFileSizes
-                      ? getSizeOfAdditionalFile(
+                      ? getSizeOfMediaFile(
                           urls
                             .from('media.root')
                             .to('media.albumAdditionalFile', data.albumDirectory, location))
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index fa2cdc18..4c37c5af 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -578,6 +578,16 @@ export default {
           ])),
       ]));
 
+    const styleRulesCSS =
+      html.resolve(slots.styleRules, {normalize: 'string'});
+
+    const fallbackBackgroundStyleRule =
+      (styleRulesCSS.match(/body::before[^}]*background-image:/)
+        ? ''
+        : `body::before {\n` +
+          `    background-image: url("${to('media.path', 'bg.jpg')}");\n` +
+          `}`);
+
     const numWallpaperParts =
       html.resolve(slots.styleRules, {normalize: 'string'})
         .match(/\.wallpaper-part:nth-child/g)
@@ -725,6 +735,8 @@ export default {
             html.tag('style', [
               relations.colorStyleRules
                 .slot('color', slots.color ?? data.wikiColor),
+
+              fallbackBackgroundStyleRule,
               slots.styleRules,
             ]),
 
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index b1f02819..6cbcb7dd 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -5,7 +5,7 @@ export default {
   extraDependencies: [
     'checkIfImagePathHasCachedThumbnails',
     'getDimensionsOfImagePath',
-    'getSizeOfImagePath',
+    'getSizeOfMediaFile',
     'getThumbnailEqualOrSmaller',
     'getThumbnailsAvailableForDimensions',
     'html',
@@ -83,7 +83,7 @@ export default {
   generate(data, relations, slots, {
     checkIfImagePathHasCachedThumbnails,
     getDimensionsOfImagePath,
-    getSizeOfImagePath,
+    getSizeOfMediaFile,
     getThumbnailEqualOrSmaller,
     getThumbnailsAvailableForDimensions,
     html,
@@ -228,7 +228,7 @@ export default {
 
       const fileSize =
         (willLink && mediaSrc
-          ? getSizeOfImagePath(mediaSrc)
+          ? getSizeOfMediaFile(mediaSrc)
           : null);
 
       imgAttributes.add([