-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
46 lines (44 loc) · 1.1 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
chrome.runtime.onInstalled.addListener(function () {
// console.log("ok");
//storage setting value
chrome.storage.sync.set(
{
bgcolor: [
"#292525",
"#1f1f1f",
"#373737",
"#2c3642",
"#1c2b3c",
"#444444",
"#1e152f",
"#1e3029",
"#0b2637",
"hsl(210deg, 30%, 8%)",
"#182635",
"#191b1f"
],
},
function () {
console.log("storage init colors value");
},
);
// 为特定网址显示图标
chrome.declarativeContent.onPageChanged.removeRules(undefined, function () {
chrome.declarativeContent.onPageChanged.addRules([
{
conditions: [
new chrome.declarativeContent.PageStateMatcher({
pageUrl: { hostEquals: "ziglnag.org" },
}),
new chrome.declarativeContent.PageStateMatcher({
pageUrl: { hostEquals: "sxwangzhiwen.github.io" },
}),
],
actions: [new chrome.declarativeContent.ShowPageAction()],
},
]);
});
chrome.browserAction.setBadgeText({ text: "zig" });
chrome.browserAction.setBadgeBackgroundColor({ color: [255, 255, 255, 255] });
// chrome.action.setBadgeBackgroundColor({color: '#FFFFFF'});
});