This commit is contained in:
ManeraKai 2023-03-07 17:25:43 +03:00
parent ec1b517639
commit 9a7c2ce3cb
2 changed files with 12 additions and 5 deletions

View File

@ -459,10 +459,16 @@ function redirect(url, type, initiator, forceRedirection) {
}
case "anonymousOverflow": {
if (!url.pathname.startsWith('/questions') && url.pathname != '/') return
const threadID = /\/(\d+)\/?$/.exec(url.pathname)
if (threadID) return `${randomInstance}/questions/${threadID[1]}${url.search}`
return `${randomInstance}${url.pathname}${url.search}`
if (url.hostname == "stackoverflow.com") {
const threadID = /\/(\d+)\/?$/.exec(url.pathname)
if (threadID) return `${randomInstance}/questions/${threadID[1]}${url.search}`
return `${randomInstance}${url.pathname}${url.search}`
}
const regex = url.href.match(/https?:\/{2}(?:([a-zA-Z0-9-]+)\.)?stackexchange\.com\//)
if (regex && regex.length > 1) {
const subdomain = regex[1]
return `${randomInstance}/exchange/${subdomain}${url.pathname}${url.search}`
}
}
case "biblioReads": {
if (!url.pathname.startsWith('/book/show/') && url.pathname != '/') return

View File

@ -562,7 +562,8 @@
}
},
"targets": [
"^https?:\\/{2}stackoverflow\\.com\\/"
"^https?:\\/{2}?stackoverflow\\.com\\/",
"^https?:\\/{2}([a-zA-Z0-9-]+\\.)?stackexchange\\.com\\/"
],
"name": "Stack Overflow",
"options": {