« get me outta code hell

fix "random" links going to "undefined" - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/static
diff options
context:
space:
mode:
author(quasar) nebula <towerofnix@gmail.com>2021-03-16 16:10:16 -0300
committer(quasar) nebula <towerofnix@gmail.com>2021-03-16 16:10:16 -0300
commit6911f037d68763d1331c877df6b97160c1a9682e (patch)
tree4fabd53deb128e3a518dd69e2030a03811ec6895 /static
parent8b32886b0f5dedd63eb10592ce0ef6d1233689c5 (diff)
fix "random" links going to "undefined"
Diffstat (limited to 'static')
-rw-r--r--static/client.js23
1 files changed, 7 insertions, 16 deletions
diff --git a/static/client.js b/static/client.js
index 9c0e621a..2b58ccb6 100644
--- a/static/client.js
+++ b/static/client.js
@@ -41,21 +41,12 @@ function getFlash(el) {
     return flashData.find(flash => flash.directory === directory);
 }
 
-function openAlbum(directory) {
-    return rebase(`${C.ALBUM_DIRECTORY}/${directory}/`);
-}
-
-function openTrack(directory) {
-    return rebase(`${C.TRACK_DIRECTORY}/${directory}/`);
-}
-
-function openArtist(directory) {
-    return rebase(`${C.ARTIST_DIRECTORY}/${directory}/`);
-}
-
-function openFlash(flash) {
-    return rebase(`${C.FLASH_DIRECTORY}/${flash.directory}/`);
-}
+// TODO: These should pro8a8ly access some shared urlSpec path. We'd need to
+// separ8te the tooling around that into common-shared code too.
+const openAlbum = d => rebase(`album/${d}`);
+const openTrack = d => rebase(`track/${d}`);
+const openArtist = d => rebase(`artist/${d}`);
+const openFlash = d => rebase(`flash/${d}`);
 
 /* i implemented these functions but we dont actually use them anywhere lol
 function isFlashPage() {
@@ -102,7 +93,7 @@ for (const a of document.body.querySelectorAll('[data-random]')) {
         }
 
         setTimeout(() => {
-            a.href = rebase(C.JS_DISABLED_DIRECTORY);
+            a.href = rebase('js-disabled');
         });
         switch (a.dataset.random) {
             case 'album': return a.href = openAlbum(pick(albumData).directory);