Added search redirections from Fandom to BreezeWiki

This commit is contained in:
Hygna 2022-10-05 18:00:27 +01:00
parent a96f3188b7
commit 12b6f9cdbb
No known key found for this signature in database
1 changed files with 2 additions and 1 deletions

View File

@ -390,7 +390,8 @@ function redirect(url, type, initiator) {
let wiki = url.hostname.match(/^[a-zA-Z0-9]+(?=\.fandom\.com)/)
if (wiki == "www" || !wiki) wiki = ""
else wiki = "/" + wiki
return `${randomInstance}${wiki}${url.pathname}${url.search}`.replace(/Special:Search\?query/, "search?q")
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}`
default:
return `${randomInstance}${url.pathname}${url.search}`
}