681108e76ef185caaf5925b0530bbaff5fd78f66
[mirrors/Programs.git] / background.html
1 <html><head>
2 <!-- meta http-equiv="refresh" content="10" / -->
3
4 <script>
5
6 function setIcon(badge,title){
7 chrome.browserAction.setBadgeText({'text':badge});
8 chrome.browserAction.setTitle({'title':title});
9 }
10
11 function getKybcaMails(){
12 if(!localStorage["secs"]) localStorage["secs"] = 30;
13 var check_mail_timer = setTimeout("getKybcaMails()", localStorage["secs"] * 1000);
14 var pkReqUrl='https://kyberia.sk/ajax/check_new_mail.php';
15 var pkReq=new XMLHttpRequest();
16 pkReq.onload=function(){
17 var mail = pkReq.responseText.split(";");
18 switch(mail[0].replace(/^\s+|\s+$/g,"")) { //trim() := replace(/^\s+|\s+$/g,"")
19 case "":
20 setIcon("?!", "Connection problem... Not loged in?");
21 localStorage["reconnect"] = 1;
22 break;
23 case "offline":
24 localStorage["reconnect"] = 1;
25 case "0":
26 setIcon("", "No new mail on Kyberia.");
27 break;
28 default:
29 setIcon(mail[0], mail[0]+" new mails! last from: "+mail[1]);
30 }
31 };
32 pkReq.open('GET',pkReqUrl);
33 pkReq.send();
34 }
35
36 chrome.browserAction.onClicked.addListener(function(tab) {
37 chrome.tabs.create({url:'https://kyberia.sk/id/24'});
38 setIcon("", "");
39 });
40 setIcon("?", "Waiting for first contact...");
41
42 getKybcaMails();
43
44 </script></head>
45 <body>
46 <iframe id="lif" src="login.html"></iframe>
47 </body>
48 </html>
49
This page took 1.076472 seconds and 3 git commands to generate.