« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--album/squiddles/album.txt4
-rw-r--r--client.js15
-rw-r--r--upd8.js2
3 files changed, 17 insertions, 4 deletions
diff --git a/album/squiddles/album.txt b/album/squiddles/album.txt
index 8d63ee25..93b6b6f9 100644
--- a/album/squiddles/album.txt
+++ b/album/squiddles/album.txt
@@ -132,3 +132,7 @@ Track: Let the Squiddles Sleep (End Theme)
 Artist: Robert J! Lake
 References: Squiddles!
 URLs: https://youtu.be/mpn7lahHvEc
+-----------------------------------------------
+Track: Friendship Aneurysm
+Artist: Alexander Rosetti
+URLs: https://youtu.be/w6RNFIXfiyY
diff --git a/client.js b/client.js
index ffdab814..1ae0a2d0 100644
--- a/client.js
+++ b/client.js
@@ -10,6 +10,15 @@ const fandomAlbumData = albumData.filter(album => album.isFanon);
 const artistNames = artistData.filter(artist => !artist.alias).map(artist => artist.name);
 const allTracks = C.getAllTracks(albumData);
 
+function rebase(href) {
+    const relative = document.documentElement.dataset.rebase;
+    if (relative) {
+        return relative + "/" + href;
+    } else {
+        return href;
+    }
+}
+
 function pick(array) {
     return array[Math.floor(Math.random() * array.length)];
 }
@@ -20,15 +29,15 @@ function getAlbum(el) {
 }
 
 function openAlbum(album) {
-    location.href = `${C.ALBUM_DIRECTORY}/${album.directory}/index.html`;
+    location.href = rebase(`${C.ALBUM_DIRECTORY}/${album.directory}/index.html`);
 }
 
 function openTrack(track) {
-    location.href = `${C.TRACK_DIRECTORY}/${track.directory}/index.html`;
+    location.href = rebase(`${C.TRACK_DIRECTORY}/${track.directory}/index.html`);
 }
 
 function openArtist(artist) {
-    location.href = `${C.ARTIST_DIRECTORY}/${C.getArtistDirectory(artist)}/index.html`;
+    location.href = rebase(`${C.ARTIST_DIRECTORY}/${C.getArtistDirectory(artist)}/index.html`);
 }
 
 for (const a of document.body.querySelectorAll('[data-random]')) {
diff --git a/upd8.js b/upd8.js
index 938e20af..11c64e5a 100644
--- a/upd8.js
+++ b/upd8.js
@@ -701,7 +701,7 @@ async function writePage(directoryParts, titleOrHead, body) {
     // a C.ROOT_DIRECTORY should work. Um... okay, fine, I'll do that.)
     await writeFile(path.join(directory, 'index.html'), rebaseURLs(directory, fixWS`
         <!DOCTYPE html>
-        <html>
+        <html data-rebase="${path.relative(directory, C.SITE_DIRECTORY)}">
             <head>
                 ${[
                     `<meta charset="utf-8">`,