-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbackground.js
More file actions
51 lines (46 loc) · 1.35 KB
/
background.js
File metadata and controls
51 lines (46 loc) · 1.35 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
49
'use strict';
function setDefault() {
chrome.storage.sync.set({
options: { 'lazyLoading': true }
}, function () {
console.log("Set Default Option")
});
chrome.storage.sync.set({
urlsInfo: {
'urlsName': [
'Google Search',
'Youtube Search',
'Bilibili Search',
'Bilibili ID',
'Bilibili Up',
'Baidu Drive',
'Pixiv ID',
'Pixiv Artists',
'Youtube ID',
'Yande.re ID'],
'urls': [
'https://www.google.com/search?q=',
'https://www.youtube.com/results?search_query=',
'https://search.bilibili.com/all?keyword=',
'https://www.bilibili.com/video/av',
'https://space.bilibili.com/',
'https://pan.baidu.com/s/',
'https://www.pixiv.net/member_illust.php?mode=medium&illust_id=',
'https://www.pixiv.net/member.php?id=',
'https://www.youtube.com/watch?v=',
'https://yande.re/post/show/'
]
}
}, function () {
console.log("Set Default URLs");
});
}
chrome.runtime.onInstalled.addListener((details) => {
if (details.reason === chrome.runtime.OnInstalledReason.INSTALL) {
console.log("First install. Setting defaults")
setDefault()
// chrome.runtime.setUninstallURL('https://example.com/extension-survey');
} else {
console.log("Hello from background script")
}
});