-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackground.js
More file actions
36 lines (31 loc) · 985 Bytes
/
background.js
File metadata and controls
36 lines (31 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
if (message?.kind === 'badge') {
chrome.browserAction.setBadgeBackgroundColor({ tabId: sender?.tab?.id, color: '#32cd32' });
chrome.browserAction.setBadgeText({ tabId: sender?.tab?.id, text: '✓'});
}
return true
})
chrome.browserAction.onClicked.addListener(() => {
chrome.runtime.openOptionsPage()
})
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
if (changeInfo?.status !== 'loading') { return; }
// chrome.storage.local.clear()
chrome.tabs.executeScript(
tabId,
{
"file": "psl.min.js",
"runAt": "document_start"
},
() => {
chrome.tabs.executeScript(
tabId,
{
"file": "inject.js",
"runAt": "document_start"
},
() => {}
);
}
)
});