/[metastatus]/trunk/jar/content/metastatus/main.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/jar/content/metastatus/main.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations)
Wed Jul 14 14:12:27 2004 UTC (19 years, 10 months ago) by dpavlin
File MIME type: application/javascript
File size: 1758 byte(s)
initial import into subversion

1 var metastatusMain = {
2 timer : null,
3 init : function()
4 {
5 metaStatus.check(metastatusMain.update);
6 this.timer = setInterval('metaStatus.check(metastatusMain.update)',
7 60000);
8 },
9 click : function(event) // forces an update
10 {
11 metaStatus.check(metastatusMain.update);
12 },
13 update : function(response)
14 {
15 // for now, just assume there's only one user
16 for (var user in response)
17 {
18 var data = response[user];
19 var panel = document.getElementById('metastatuspanel');
20
21 // set statusbar text to current song (if any)
22 if ('status' in data)
23 window.status = data['status'];
24
25 // setup email icons
26 if ('emailCount' in data)
27 {
28 var Emails = data['emailCount'];
29 var redEmails = 0;
30 if ('emailRedCount' in data)
31 redEmails = data['emailRedCount'];
32
33 // delete old icons
34 while (panel.childNodes.length > 0)
35 panel.removeChild(panel.childNodes.item(0));
36
37 var first = true;
38 // add new icons
39 for (var i = 0; i < redEmails; i++)
40 {
41 var child = document.createElement('image');
42 child.id = 'imagered';
43 if (first)
44 {
45 child.id += 'first';
46 first = false;
47 }
48 panel.appendChild(child);
49 }
50 for (var i = 0; i < Emails; i++)
51 {
52 var child = document.createElement('image');
53 child.id = 'imagegray';
54 if (first)
55 {
56 child.id += 'first';
57 first = false;
58 }
59 panel.appendChild(child);
60 }
61 panel.tooltipText = redEmails+"/"+Emails+" messages";
62 }
63 }
64 }
65 }
66
67 metastatusMain.init();

  ViewVC Help
Powered by ViewVC 1.1.26