From 2edc497f2a647a9270d9d724204841f94ebf47f8 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Sun, 28 May 2023 11:04:33 +0300 Subject: Added Redirect as a shortcut --- src/pages/background/background.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/pages') 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) { -- cgit 1.4.1