-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
60 lines (42 loc) · 1.81 KB
/
main.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//const webList = [];
function createBlockList() {
const input = document.getElementById("websiteURL")
//webList.push(input.value + '/*');
chrome.storage.local.set({input: document.location}, function() {
// console.log('Value is set to ' + value);
});
document.getElementById('displayList').innerHTML += ('<li>'+ input.value +'</li>');
input.value = '';
console.log(displayList);
}
document.getElementById('addWebsite').addEventListener('click', createBlockList);
// chrome.storage.local.get(['key'], function(result) {
// console.log('Value currently is ' + result.key);
// });
document.addEventListener("DOMContentLoaded", function() {
let currentWeb = document.location;
console.log("function invoked");
//if chrome.storage.local contains currentWeb run the location replace .get(input, function)
if (chrome.storage.local.includes(currentWeb)) {
currentWeb = location.replace("https://www.codesmith.io/faq#tuition-financing");
return currentWeb;
}
});
//below: rule variable to note when a banned site has been triggered, with actions
// var bannedSiteRule = {
// conditions: [
// //need to make sure that 'RequestMatcher' actually matches what we want it to
// new chrome.declarativeWebRequest.RequestMatcher({
// //must find a way to make this url suffix pull from the weblist variable above
// url: { hostSuffix: 'example.com' } })
// //lines below would be how to add another url request; comma separates them after }})
// // ,
// // new chrome.declarativeWebRequest.RequestMatcher({
// // url: { hostSuffix: 'foobar.com' } })
// ],
// actions: [
// //need to have below action redirect the request to a different URL (code in line 1)
// //may still need to have cancel request?
// new chrome.declarativeWebRequest.CancelRequest()
// ]
// };