-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbackground.js
More file actions
48 lines (45 loc) · 1.2 KB
/
Copy pathbackground.js
File metadata and controls
48 lines (45 loc) · 1.2 KB
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
47
48
chrome.runtime.onInstalled.addListener(() => {
console.log('Web Tag Marker extension installed');
chrome.storage.sync.get(['tags'], (result) => {
if (!result.tags) {
const defaultTags = [
{
id: '1',
name: '重要',
foregroundColor: '#000000',
backgroundColor: '#ffff00'
},
{
id: '2',
name: '待办',
foregroundColor: '#ffffff',
backgroundColor: '#ff6b6b'
},
{
id: '3',
name: '已完成',
foregroundColor: '#ffffff',
backgroundColor: '#51cf66'
}
];
chrome.storage.sync.set({ tags: defaultTags });
}
});
// 设置默认黑白名单配置
chrome.storage.local.get(['listMode', 'siteList'], (result) => {
if (!result.listMode) {
chrome.storage.local.set({
listMode: 'blacklist', // 默认黑名单模式
siteList: [] // 空列表
});
}
});
});
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.action === 'syncMarkers') {
chrome.storage.local.get(['markers'], (result) => {
sendResponse(result.markers || {});
});
return true;
}
});