forked from danimesq/twitter-mass-unfollow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
29 lines (29 loc) · 906 Bytes
/
background.js
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
chrome.runtime.onInstalled.addListener(async ({ reason }) => {
if (reason === chrome.runtime.OnInstalledReason.INSTALL) {
await chrome.storage.sync.set({
"twitter-mass-unfollow-reload-on-stopped": true,
});
await chrome.storage.sync.set({ "twitter-mass-unfollow-timer": true });
chrome.tabs.create({
url: "options.html",
});
}
chrome.action.disable();
chrome.declarativeContent.onPageChanged.removeRules(undefined, () => {
const rules = [
{
conditions: [
new chrome.declarativeContent.PageStateMatcher({
pageUrl: {
hostSuffix: ".twitter.com",
pathContains: "following",
schemes: ["https"],
},
}),
],
actions: [new chrome.declarativeContent.ShowPageAction()],
},
];
chrome.declarativeContent.onPageChanged.addRules(rules);
});
});