-
Notifications
You must be signed in to change notification settings - Fork 0
/
autonuke.js
49 lines (38 loc) · 1.67 KB
/
autonuke.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
//https://github.com/tre-x
chrome.history.onVisited.addListener(function (HistoryItem) { // user visits website
var o = localStorage["autonukehistory"]; //get settings
var o2 = localStorage["autonukecookies"]
if (o == 1) { //if autonuke history is enabled
chrome.history.deleteUrl({
url: HistoryItem.url //delete the websites history entry
});
}
if (o2 == 1) { //if autonuke cookies is enabled
var cookies = {
start: function () {
return this.logCookies(); //get cookies
},
logCookies: function () {
return new Promise(function (resolve, reject) { //gather
function remove(cookies) { //remove function
for (var i = 0; i < cookies.length; i++) { //for every cookie gathered
chrome.cookies.remove({
url: HistoryItem.url + cookies[i].path, //only remove the websites cookies
name: cookies[i].name
}, function () {
console.log('cookie removed!')
});
}
resolve()
}
chrome.cookies.getAll({ //get all cookies
'url': HistoryItem.url //from website
}, function (cookies) {
remove(cookies) // start removal process for every cookie on that site
});
})
}
}
cookies.start() //execute
}
});