summaryrefslogtreecommitdiff
path: root/page_action.js
blob: ccb7925848dc77212a7cad8140c2c117bef0152e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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);