summaryrefslogtreecommitdiff
path: root/background.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 /background.js
parentd880836621f0b4b4ca036e62e34d6edc74b61e81 (diff)
downloadmoz-run-this-page-action-c6845a798c99e96aa0e2f6daece0684a8ac50681.tar.gz
wip
Diffstat (limited to 'background.js')
-rw-r--r--background.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/background.js b/background.js
new file mode 100644
index 0000000..3035416
--- /dev/null
+++ b/background.js
@@ -0,0 +1,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;
+ }
+ }
+});
+