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
|
var LeftPane = {
addTeam: function(id, name, url, icon, active){
var node = document.getElementById(id);
if(node === null){
var ul = document.getElementById('teams');
li = document.createElement('li');
li.id = id;
li.setAttribute("onclick", "LeftPane.switchTo('"+id.replace(/'/g, '"')+"','"+url.replace(/'/g, '"')+"')");
li.setAttribute("title", name);
li.innerHTML = name[0];
if( icon ){
li.style.backgroundImage = "url('"+ icon +"')";
li.innerHTML = "";
}
ul.appendChild(li);
if(active){
LeftPane.setActive(id);
}
LeftPane.switchTo(id, url);
}
},
click: function(i){
var list = document.getElementsByTagName("li");
for(var j=0; j < list.length; j++){
if(i==j){
list[j].click();
break;
}
}
},
alert: function(team){
document.getElementById(team).classList.add('alert');
},
stopAlert: function(team){
document.getElementById(team).classList.remove('alert');
},
switchTo: function(id, url){
leftPane.switchTo(url);
LeftPane.setActive(id);
},
setActive: function(id){
var list = document.getElementsByTagName("li");
for(var i=0; i < list.length; i++){
list[i].className = "inactive";
}
document.getElementById(id).className = "active";
},
clickNext: function(direction){
var list = document.getElementsByTagName("li");
var index = 0;
for(; index < list.length; index++){
if (list[index].className == "active") {
break;
}
}
index += direction; //goto next one
if (index >= list.length) {
index = 0;
} else if (index < 0) {
index = list.length - 1;
}
LeftPane.click(index);
}
};
|