-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontent.js
40 lines (38 loc) · 848 Bytes
/
content.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
SECONDS_REFRESH = 15;
MSECONDS_REFRESH = SECONDS_REFRESH * 1000; // 3000 millisecs = 3 secs
// var i;
// var idle = false;
// document.onmousemove = function(){
// clearInterval(i);
// idle = false;
// i = setInterval(function(){idle = true}, MSECONDS_REFRESH);
// }
// tracker = null;
tracker = new ActivityTracker();
function repeatSend() {
// if(tracker) {
// tracker.init();
// }
// else {
// tracker = new ActivityTracker();
// }
state = "idle";
if(tracker.isActive()) {
state = "engaged";
}
console.log(state);
chrome.extension.sendRequest({
method: 'getOpenUrls',
data: {
url: document.URL,
domain: document.domain,
status: {
state: state,
time: new Date(),
},
msecondsRefresh: MSECONDS_REFRESH,
},
});
tracker.rollOver();
}
setInterval("repeatSend()", MSECONDS_REFRESH);