-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdaemon.js
29 lines (28 loc) · 836 Bytes
/
daemon.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
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.action == "clearCookie") {
clearCookie();
} else if (request.action == 'playend') {
try{
sendResponse({});
}catch(e){}
chrome.tabs.query({
title:'working...'
}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {
action: "playend"
}, function(response) {});
});
}
}
);
function clearCookie() {
var milliseconds = 1000 * 60 * 60 * 24 * 365;
var oneYearAgo = (new Date()).getTime() - milliseconds;
chrome.browsingData.remove({
"since": oneYearAgo
}, {
"cookies": true,
"localStorage": true
}, function() {});
}