From 7438e3dcd3d1610fb77396d59189e4ce80fb3120 Mon Sep 17 00:00:00 2001 From: Kate Higa Date: Fri, 11 Feb 2022 16:37:08 -0800 Subject: [PATCH] Fix issue of extension not running until page load --- background.js | 3 +++ manifest.json | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 background.js diff --git a/background.js b/background.js new file mode 100644 index 0000000..df9734b --- /dev/null +++ b/background.js @@ -0,0 +1,3 @@ +chrome.webNavigation.onHistoryStateUpdated.addListener(function(details) { + chrome.tabs.executeScript(details.tabId,{file:"contentScript.js"}); +}); diff --git a/manifest.json b/manifest.json index 19920c3..25f62ad 100644 --- a/manifest.json +++ b/manifest.json @@ -3,14 +3,16 @@ "name": "github-a11y", "description": "This extension helps increase accessibility mindfulness while using GitHub", - "version": "0.1", + "version": "0.2", "content_scripts": [ { "matches": ["https://*.github.com/*"], + "run_at": "document_idle", "js": ["contentScript.js"] } ], - "permissions": [ - "activeTab" - ] - } \ No newline at end of file + "background": { + "scripts": ["background.js"] + }, + "permissions": ["*://github.com/*", "tabs", "webNavigation"] +}