aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2023-05-28 11:04:33 +0300
committerManeraKai <manerakai@protonmail.com>2023-05-28 11:04:33 +0300
commit2edc497f2a647a9270d9d724204841f94ebf47f8 (patch)
tree49296fba49440d20d51edd992724518b2bb7908b /src/pages
parentAdded subdomain support for LibMedium (diff)
downloadlibredirect-2edc497f2a647a9270d9d724204841f94ebf47f8.zip
Added Redirect as a shortcut
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/background/background.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 467259cd..d7f96a34 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -97,6 +97,19 @@ browser.commands.onCommand.addListener(async command => {
else if (command == "copyRaw") {
servicesHelper.copyRaw(url)
}
+ else if (command == "redirect") {
+ browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
+ if (tabs[0].url) {
+ const url = new URL(tabs[0].url)
+ const newUrl = servicesHelper.redirect(url, "main_frame", null, true)
+ if (newUrl) {
+ browser.tabs.update(tabs[0].id, { url: newUrl }, () => {
+ tabIdRedirects[tabs[0].id] = true
+ })
+ }
+ }
+ })
+ }
else if (command == "reverse") {
browser.tabs.query({ active: true, currentWindow: true }, async tabs => {
if (tabs[0].url) {