-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackground.html
45 lines (41 loc) · 1.32 KB
/
background.html
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
<!DOCTYPE html>
<script type="text/javascript" src="libs/3rdparty/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="libs/3rdparty/xmlrpc.js"></script>
<script type="text/javascript" src="libs/backlog.js"></script>
<script type="text/javascript" src="libs/utils.js"></script>
<script type="text/javascript">
var checkInterval = function() {
var interval = localStorage.getItem('refreshInterval');
if (!interval) {
interval = 300;
localStorage.setItem('refreshInterval', interval);
} else if (interval < 180) {
interval = 180;
localStorage.setItem('refreshInterval', interval);
}
return interval;
}
var refreshTimer;
var refresh = function(isInit) {
getComments(isInit);
clearTimeout(refreshTimer);
var interval = checkInterval();
console.log(new Date().toString() + ": " + interval);
refreshTimer = setTimeout(refresh, interval*1000);
};
(function () {
//localStorage.clear();
checkInterval();
if (!(localStorage.getItem('userId') &&
localStorage.getItem('password') &&
localStorage.getItem('spaceId'))) {
if (!localStorage.getItem('lastChecked')) {
localStorage.setItem('lastChecked', JSON.stringify(new Date(1970, 1, 1).toString()));
}
openTab(chrome.extension.getURL('options.html'));
} else {
refresh();
}
})();
</script>
</html>