summaryrefslogtreecommitdiff
path: root/page_action.js
diff options
context:
space:
mode:
authorChristian Segundo2023-11-19 16:21:29 +0100
committerChristian Segundo2023-11-19 16:21:29 +0100
commitc6845a798c99e96aa0e2f6daece0684a8ac50681 (patch)
treea75eec68984bcb7ff8f8c5f048b4806d5cb4ff5a /page_action.js
parentd880836621f0b4b4ca036e62e34d6edc74b61e81 (diff)
downloadmoz-run-this-page-action-c6845a798c99e96aa0e2f6daece0684a8ac50681.tar.gz
wip
Diffstat (limited to 'page_action.js')
-rw-r--r--page_action.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/page_action.js b/page_action.js
new file mode 100644
index 0000000..ccb7925
--- /dev/null
+++ b/page_action.js
@@ -0,0 +1,13 @@
+function handleClick(tab) {
+ const newUrl = tab.url.replace('https://', 'https+vim://');
+ console.log(newUrl);
+ newTab = browser.tabs.create({ url: newUrl });
+
+ // TODO: close the tab after it's been opened
+ // this doesn't work as it happens too fast and the app isn't open yet
+ //newTab.then(function(ntab) {
+ //browser.tabs.remove(ntab.id);
+ //})
+}
+
+browser.pageAction.onClicked.addListener(handleClick);