-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
36 lines (32 loc) · 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
const DEFAULT_FONT_SIZE = '12px';
const DEFAULT_LINE_HEIGHT = '19px';
const HOST_URL = '';
chrome.runtime.onInstalled.addListener(function() {
chrome.storage.sync.get('fontSize', (data) => {
if (!data.fontSize) {
chrome.storage.sync.set({ fontSize: DEFAULT_FONT_SIZE }, function() {
console.log("The font size is ", DEFAULT_FONT_SIZE);
});
}
});
chrome.storage.sync.get('lineHeight', (data) => {
if (!data.lineHeight) {
chrome.storage.sync.set({ lineHeight: DEFAULT_LINE_HEIGHT }, function() {
console.log("The line height is ", DEFAULT_LINE_HEIGHT);
});
}
});
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
chrome.declarativeContent.onPageChanged.addRules([
{
conditions: [
new chrome.declarativeContent.PageStateMatcher({
pageUrl: {hostEquals: HOST_URL},
})
],
actions: [
new chrome.declarativeContent.ShowPageAction()
]
}]);
});
});