From 98d861a63939a9ecf3153ced658f98c27b83d5d7 Mon Sep 17 00:00:00 2001 From: Cynser <42423063+Cynser@users.noreply.github.com> Date: Thu, 11 Oct 2018 17:27:51 +0100 Subject: [PATCH] Add check for Forensics Wiki URLs --- src/web/HTMLOperation.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/web/HTMLOperation.mjs b/src/web/HTMLOperation.mjs index c20defef..5373113a 100755 --- a/src/web/HTMLOperation.mjs +++ b/src/web/HTMLOperation.mjs @@ -131,14 +131,16 @@ class HTMLOperation { */ function titleFromWikiLink(url) { const splitURL = url.split("/"); - if (splitURL.indexOf("wikipedia.org") < 0) { + if (splitURL.indexOf("wikipedia.org") < 0 && splitURL.indexOf("forensicswiki.org") < 0) { // Not a wiki link, return full URL return `More Informationopen_in_new`; } + const wikiName = splitURL.indexOf("forensicswiki.org") < 0 ? "Wikipedia" : "Forensics Wiki"; + const pageTitle = decodeURIComponent(splitURL[splitURL.length - 1]) .replace(/_/g, " "); - return `${pageTitle}open_in_new on Wikipedia`; + return `${pageTitle}open_in_new on ${wikiName}`; } export default HTMLOperation;