summaryrefslogtreecommitdiff
path: root/page_action.js
diff options
context:
space:
mode:
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);