From 362f6e75463716d2d67136d2b942a20849ab32a5 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Thu, 1 Jun 2023 12:46:00 +0300 Subject: [PATCH] Added AnonymousOverflow reverse --- src/assets/javascripts/services.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/assets/javascripts/services.js b/src/assets/javascripts/services.js index 04223a7..8cb7649 100644 --- a/src/assets/javascripts/services.js +++ b/src/assets/javascripts/services.js @@ -642,6 +642,16 @@ async function reverse(url) { } return `https://wikipedia.org${url.pathname}${url.search}${url.hash}` } + case "stackOverflow": { + if (url.pathname.startsWith("/questions/")) { + return `https://stackoverflow.com${url.pathname}${url.search}` + } + if (url.pathname.startsWith("/exchange/")) { + const regex = /\/exchange\/(.*?)(\/.*)/.exec(url.pathname) + if (regex) return `https://${regex[1]}.stackexchange.com${regex[2]}` + } + return + } default: return }