summaryrefslogtreecommitdiff
path: root/background.js
blob: e72c07ab6d5e013c456ebc4cac2bb3ff4322b32b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
chrome.webNavigation.onCommitted.addListener(async details => {
  // Check if the navigation is in the main frame
  if (details.frameId !== 0) {
    return;
  }

  // If the url is in the list of domains, show the page action
  const domains = await StorageGetDomains();
  for (let i = 0; i < domains.length; i++) {
    if (details.url.includes(domains[i])) {
      const gldata = await parsetab(details.tabId);
      if (gldata.repo) {
        browser.pageAction.show(details.tabId);
      }
      return;
    }
  }
});