diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-03-29 16:39:01 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-03-29 20:10:12 -0300 |
commit | bdca511b40d314fcf96283722b846c99b3962071 (patch) | |
tree | e50d3ce2b7518176bf7a90965b42dd1668ef6607 /src/util | |
parent | e52468280288daee71806c3e12028772dd60dbb6 (diff) |
external-links: show domain in style: 'platform' if fallback
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/external-links.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/util/external-links.js b/src/util/external-links.js index 0c6e9d59..846302af 100644 --- a/src/util/external-links.js +++ b/src/util/external-links.js @@ -608,6 +608,17 @@ export function getExternalLinkStringOfStyleFromDescriptor(url, style, descripto return language.$(prefix, descriptor.platform); } + function getPlatformOrDomain() { + // The fallback descriptor has a "platform" which is just + // the word "External". This isn't really useful when you're + // looking for platform info! Compact mode shows the domain. + if (descriptor === fallbackDescriptor) { + return getCompactDomain(); + } else { + return getPlatform(); + } + } + function getDomain() { return urlParts(url).domain; } @@ -710,7 +721,7 @@ export function getExternalLinkStringOfStyleFromDescriptor(url, style, descripto switch (style) { case 'normal': return getNormal(); case 'compact': return getCompact(); - case 'platform': return getPlatform(); + case 'platform': return getPlatformOrDomain(); case 'icon-id': return getIconId(); } } |