diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index e67ed84..34bd865 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -391,11 +391,23 @@ function redirect(url, type, initiator, forceRedirection) { } return randomInstance case "breezeWiki": - let wiki = url.hostname.match(/^[a-zA-Z0-9-]+(?=\.fandom\.com)/) - if (wiki == "www" || !wiki) wiki = "" - else wiki = "/" + wiki - if (url.href.search(/Special:Search\?query/) > -1) return `${randomInstance}${wiki}${url.pathname}${url.search}`.replace(/Special:Search\?query/, "search?q").replace(/\/wiki/, "") - else return `${randomInstance}${wiki}${url.pathname}${url.search}` + let wiki, + urlpath = "" + if (url.hostname.match(/^[a-zA-Z0-9-]+\.fandom\.com/)) { + wiki = url.hostname.match(/^[a-zA-Z0-9-]+(?=\.fandom\.com)/) + if (wiki == "www" || !wiki) wiki = "" + else wiki = "/" + wiki + urlpath = url.pathname + } else { + wiki = url.pathname.match(/(?<=wiki\/w:c:)[a-zA-Z0-9-]+(?=:)/) + if (!wiki) wiki = "" + else { + wiki = "/" + wiki + "/wiki/" + urlpath = url.pathname.match(/(?<=wiki\/w:c:[a-zA-Z0-9-]+:).+/) + } + } + if (url.href.search(/Special:Search\?query/) > -1) return `${randomInstance}${wiki}${urlpath}${url.search}`.replace(/Special:Search\?query/, "search?q").replace(/\/wiki/, "") + else return `${randomInstance}${wiki}${urlpath}${url.search}` case "rimgo": if (url.href.search(/^https?:\/{2}(?:[im]\.)?stack\./) > -1) return `${randomInstance}/stack${url.pathname}${url.search}` else return `${randomInstance}${url.pathname}${url.search}` diff --git a/src/config/config.json b/src/config/config.json index b4ff8d1..25fa9f1 100644 --- a/src/config/config.json +++ b/src/config/config.json @@ -395,7 +395,7 @@ "instanceList": true } }, - "targets": ["^https?:\\/{2}(?:[a-zA-Z0-9-]+\\.)?fandom\\.com(?=\\/wiki|\\/?$)"], + "targets": ["^https?:\\/{2}(?:[a-zA-Z0-9-]+\\.)?(?:fandom|wikia)\\.com(?=\\/wiki|\\/?$)"], "name": "Fandom", "options": { "enabled": true