summaryrefslogtreecommitdiff
path: root/background.js
blob: 3035416703494b3e246ae83caf656d6c6dfb788e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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])) {
      browser.pageAction.show(details.tabId);
      return;
    }
  }
});