forked from phaistonian/MyExtensions
-
Notifications
You must be signed in to change notification settings - Fork 2
/
background.html
executable file
·70 lines (53 loc) · 1.63 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html>
<head>
<script src="js/core-lite.js"></script>
<script src="js/js.js"></script>
<script>
// var xhr = new XMLHttpRequest();
// xhr.open('GET', 'http://chrome.dev.pathfinder.gr/test.php', true);
// xhr.send(null);
//new Ext.Notification('once upon a time there was bla');
Ext.initialize();
if(Ext.options) {
Ext.timer = Ext.update.delay(parseInt(Ext.options.interval) * 1000 * 60, Ext);
}
// BG is already processed.
// Used for desktop notifications
Ext.bgDone = true;
Ajax.setOptions({
'timeout' : 30,
'onTimeout' : function() {
alert('There seems to be a network problem at this moment. Aborting all running network operations.');
}
})
chrome.extension.onRequest.addListener(function(req, sender, sendResponse) {
// Handle updates
if(req['bg.reload']) {
//Ext.extensions = localStorage['data'] ? JSON.parse(localStorage['data']) : {};
//Ext.options = localStorage['options'] ? JSON.parse(localStorage['options']) : { 'notify' : { 'comments': true, 'ratings' : true}};
Ext.initialize();
}
if(req['bg.update']) {
Ext.update();
}
if(req['bg.interval']) {
if(Ext.timer) {
clearTimeout(Ext.timer);
}
Ext.options = JSON.parse(localStorage['options']);
if(parseInt(Ext.options.timer) === -1) {
return this;
}
//Ext.load();
//console.log(Ext.options.interval)
Ext.timer = Ext.update.delay(parseInt(Ext.options.interval) * 1000 * 60, Ext);
}
// Check if url matches an extensions page.
// If so, initialize comment counters.
if(req['href']) {
Ext.scanURL(req['href']);
}
});
</script>
</head>
</html>