« get me outta code hell

content: *mostly* port linkExternal to language.formatExternalLink - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-23 17:42:49 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-24 13:45:11 -0400
commitc5e02f9d314118a534fd0e942d87e74864674498 (patch)
treebd47495d4de76d11fdd975df540b63542973f55f /src/content
parent8f17782a5f2adbafd031b269195879eb7f79e05f (diff)
content: *mostly* port linkExternal to language.formatExternalLink
Diffstat (limited to 'src/content')
-rw-r--r--src/content/dependencies/linkExternal.js64
1 files changed, 8 insertions, 56 deletions
diff --git a/src/content/dependencies/linkExternal.js b/src/content/dependencies/linkExternal.js
index 5de612e2..7f090084 100644
--- a/src/content/dependencies/linkExternal.js
+++ b/src/content/dependencies/linkExternal.js
@@ -1,7 +1,3 @@
-// TODO: Define these as extra dependencies and pass them somewhere
-const BANDCAMP_DOMAINS = ['bc.s3m.us', 'music.solatrux.com'];
-const MASTODON_DOMAINS = ['types.pl'];
-
 export default {
   extraDependencies: ['html', 'language', 'wikiData'],
 
@@ -27,6 +23,13 @@ export default {
   },
 
   generate(data, slots, {html, language}) {
+    return (
+      html.tag('a',
+        {href: data.url, class: 'nowrap'},
+        language.formatExternalLink(data.url, {style: 'platform'})));
+  },
+
+    /*
     let isLocal;
     let domain;
     let pathname;
@@ -49,25 +52,6 @@ export default {
       isLocal = true;
     }
 
-    const link = html.tag('a',
-      {
-        href: data.url,
-        class: 'nowrap',
-      },
-
-      // truly unhinged indentation here
-      isLocal
-        ? language.$('misc.external.local')
-
-    : domain.includes('bandcamp.com')
-        ? language.$('misc.external.bandcamp')
-
-    : BANDCAMP_DOMAINS.includes(domain)
-        ? language.$('misc.external.bandcamp.domain', {domain})
-
-    : MASTODON_DOMAINS.includes(domain)
-        ? language.$('misc.external.mastodon.domain', {domain})
-
     : domain.includes('youtu')
         ? slots.mode === 'album'
           ? data.url.includes('list=')
@@ -75,38 +59,6 @@ export default {
             : language.$('misc.external.youtube.fullAlbum')
           : language.$('misc.external.youtube')
 
-    : domain.includes('soundcloud')
-        ? language.$('misc.external.soundcloud')
-
-    : domain.includes('tumblr.com')
-        ? language.$('misc.external.tumblr')
-
-    : domain.includes('twitter.com')
-        ? language.$('misc.external.twitter')
-
-    : domain.includes('deviantart.com')
-        ? language.$('misc.external.deviantart')
-
-    : domain.includes('wikipedia.org')
-        ? language.$('misc.external.wikipedia')
-
-    : domain.includes('poetryfoundation.org')
-        ? language.$('misc.external.poetryFoundation')
-
-    : domain.includes('instagram.com')
-        ? language.$('misc.external.instagram')
-
-    : domain.includes('patreon.com')
-        ? language.$('misc.external.patreon')
-
-    : domain.includes('spotify.com')
-        ? language.$('misc.external.spotify')
-
-    : domain.includes('newgrounds.com')
-        ? language.$('misc.external.newgrounds')
-
-        : domain);
-
     switch (slots.mode) {
       case 'flash': {
         const wrap = content =>
@@ -136,5 +88,5 @@ export default {
       default:
         return link;
     }
-  }
+    */
 };