« get me outta code hell

content: generateIconForURL -> linkExternalAsIcon - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/content/dependencies/generateIconForURL.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-03-29 18:05:32 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-03-29 18:05:32 -0300
commitbee8e687a3e332203d31ad88a107f1ec9fa125aa (patch)
treec907e481361e5952ca14c67f499aef5c6d3ac567 /src/content/dependencies/generateIconForURL.js
parent0e7e812ac63813c04e4e4f0cb00f734a6f44dc46 (diff)
content: generateIconForURL -> linkExternalAsIcon
Diffstat (limited to 'src/content/dependencies/generateIconForURL.js')
-rw-r--r--src/content/dependencies/generateIconForURL.js51
1 files changed, 0 insertions, 51 deletions
diff --git a/src/content/dependencies/generateIconForURL.js b/src/content/dependencies/generateIconForURL.js
deleted file mode 100644
index 4473ccbf..00000000
--- a/src/content/dependencies/generateIconForURL.js
+++ /dev/null
@@ -1,51 +0,0 @@
-const BANDCAMP_DOMAINS = [
-  'bc.s3m.us',
-  'music.solatrux.com',
-];
-
-const MASTODON_DOMAINS = [
-  'types.pl',
-];
-
-export default {
-  extraDependencies: ['html', 'language', 'to'],
-
-  data(url) {
-    return {url};
-  },
-
-  generate(data, {html, language, to}) {
-    const domain = new URL(data.url).hostname;
-    const [id, msg] = (
-      domain.includes('bandcamp.com')
-        ? ['bandcamp', language.$('misc.external.bandcamp')]
-      : BANDCAMP_DOMAINS.includes(domain)
-        ? ['bandcamp', language.$('misc.external.bandcamp.domain', {domain})]
-      : MASTODON_DOMAINS.includes(domain)
-        ? ['mastodon', language.$('misc.external.mastodon.domain', {domain})]
-      : domain.includes('youtu')
-        ? ['youtube', language.$('misc.external.youtube')]
-      : domain.includes('soundcloud')
-        ? ['soundcloud', language.$('misc.external.soundcloud')]
-      : domain.includes('tumblr.com')
-        ? ['tumblr', language.$('misc.external.tumblr')]
-      : domain.includes('twitter.com')
-        ? ['twitter', language.$('misc.external.twitter')]
-      : domain.includes('deviantart.com')
-        ? ['deviantart', language.$('misc.external.deviantart')]
-      : domain.includes('instagram.com')
-        ? ['instagram', language.$('misc.external.bandcamp')]
-      : domain.includes('newgrounds.com')
-        ? ['newgrounds', language.$('misc.external.newgrounds')]
-        : ['globe', language.$('misc.external.domain', {domain})]);
-
-    return html.tag('a',
-      {href: data.url, class: 'icon'},
-      html.tag('svg', [
-        html.tag('title', msg),
-        html.tag('use', {
-          href: to('shared.staticFile', `icons.svg#icon-${id}`),
-        }),
-      ]));
-  },
-};