-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackground.js
19 lines (19 loc) · 855 Bytes
/
background.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
chrome.runtime.getPackageDirectoryEntry(function (root) {
root.getFile("./data/list.json", {}, function (fileEntry) {
fileEntry.file(function (file) {
var reader = new FileReader();
reader.onloadend = function (e) {
let parsed = JSON.parse(this.result);
chrome.webRequest.onBeforeRequest.addListener(
function (details) { return { cancel: true }; },
{ urls: parsed.blockedSites },
["blocking"]
);
chrome.browserAction.setBadgeText({ text: 'ON' });
chrome.browserAction.setBadgeBackgroundColor({ color: '#4688F1' });
chrome.browserAction.setTitle({ title: "Another Ad Block is Active." });
};
reader.readAsText(file);
});
});
})