From e3c91e682c3ce246f0628a4f4786c50d9066fc4d Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 30 Mar 2024 12:31:04 -0300 Subject: external-links: Facebook --- src/static/icons.svg | 1 + src/strings-default.yaml | 1 + src/util/external-links.js | 24 ++++++++++++++++++++++ .../test/snapshot/linkExternal.js.test.cjs | 6 ++++++ test/snapshot/linkExternal.js | 5 +++++ 5 files changed, 37 insertions(+) diff --git a/src/static/icons.svg b/src/static/icons.svg index a2836a46..0a80a917 100644 --- a/src/static/icons.svg +++ b/src/static/icons.svg @@ -10,6 +10,7 @@ + diff --git a/src/strings-default.yaml b/src/strings-default.yaml index 2f0098f4..22484288 100644 --- a/src/strings-default.yaml +++ b/src/strings-default.yaml @@ -522,6 +522,7 @@ misc: music: "MUSIC@DCRC" deviantart: "DeviantArt" + facebook: "Facebook" fandom: _: "Fandom" diff --git a/src/util/external-links.js b/src/util/external-links.js index e59cd318..4d77eb73 100644 --- a/src/util/external-links.js +++ b/src/util/external-links.js @@ -307,6 +307,30 @@ export const externalLinkSpec = [ icon: 'deviantart', }, + { + match: {domain: 'facebook.com'}, + + platform: 'facebook', + handle: {pathname: /^([^/]+)\/?$/}, + + icon: 'facebook', + }, + + { + match: {domain: 'facebook.com'}, + + platform: 'facebook', + handle: {pathname: /^(?:pages|people)\/([^/]+)\/[0-9]+\/?$/}, + + icon: 'facebook', + }, + + { + match: {domain: 'facebook.com'}, + platform: 'facebook', + icon: 'facebook', + }, + { match: {domain: 'mspaintadventures.fandom.com'}, diff --git a/tap-snapshots/test/snapshot/linkExternal.js.test.cjs b/tap-snapshots/test/snapshot/linkExternal.js.test.cjs index bc061610..c53d1586 100644 --- a/tap-snapshots/test/snapshot/linkExternal.js.test.cjs +++ b/tap-snapshots/test/snapshot/linkExternal.js.test.cjs @@ -86,6 +86,9 @@ exports[`test/snapshot/linkExternal.js > TAP > linkExternal (snapshot) > context culdhira chesswanderlust-sama DeviantArt +DoomedCloud +WoodenToaster +Facebook MSPA Wiki (Draconian Dignitary) MSPA Wiki MSPA Wiki @@ -150,6 +153,9 @@ exports[`test/snapshot/linkExternal.js > TAP > linkExternal (snapshot) > context DeviantArt DeviantArt DeviantArt +Facebook +Facebook +Facebook MSPA Wiki (Draconian Dignitary) MSPA Wiki MSPA Wiki diff --git a/test/snapshot/linkExternal.js b/test/snapshot/linkExternal.js index 7f038bc8..39135a30 100644 --- a/test/snapshot/linkExternal.js +++ b/test/snapshot/linkExternal.js @@ -72,6 +72,11 @@ testContentFunctions(t, 'linkExternal (snapshot)', async (t, evaluate) => { 'https://www.deviantart.com/chesswanderlust-sama', 'https://www.deviantart.com/shilloshilloh/art/Homestuck-Jake-English-268874606', + // platform: facebook + 'https://www.facebook.com/DoomedCloud/', + 'https://www.facebook.com/pages/WoodenToaster/280642235307371', + 'https://www.facebook.com/Svixy/posts/400018786702633', + // platform: fandom.mspaintadventures 'https://mspaintadventures.fandom.com/wiki/Draconian_Dignitary', 'https://mspaintadventures.fandom.com/wiki/', -- cgit 1.3.0-6-gf8a5