Added support for redirecting wikia.com urls
Closes https://github.com/libredirect/libredirect/issues/476
This commit is contained in:
parent
86306f0d7c
commit
3d1a9105c0
|
@ -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}`
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue