]> git.deb.at Git - deb/packages.git/blob - static/packages.js
crontab: Add missing newline at EOF
[deb/packages.git] / static / packages.js
1
2 function init_toggle_elem(id_str,user_str) {
3         toggle_toggle_elem(id_str,user_str,'hide');
4 }
5
6 function toggle_toggle_elem(id_str,user_str,mode) {
7         var other_mode = ( mode == "hide" ) ? "show" : "hide";
8         var link = document.createElement("a");
9         link.setAttribute("href","javascript:toggle_toggle_elem(\""+id_str+"\",\""+user_str+"\",\""+other_mode+"\")");
10         var txt = document.createTextNode("["+other_mode+" "+user_str+"]");
11         link.appendChild(txt);
12         if (document.getElementById("js_"+id_str).childNodes.length > 0) { 
13                 document.getElementById("js_"+id_str).replaceChild(link,document.getElementById("js_"+id_str).firstChild);
14         } else {
15                 document.getElementById("js_"+id_str).appendChild(link);
16         }
17         toggleDisplay(document.getElementById("html_"+id_str));
18 }
19
20 function toggleDisplay(obj) {
21         if (obj.style.display == "none")
22                 obj.style.display = "";
23         else
24                 obj.style.display = "none";
25 }
26
27 function hide_tab(id) {
28         var tab = document.getElementById(id);
29         if (tab) {
30                 tab.style.display = "none";
31         }
32         var item = document.getElementById(id+"link");
33         if (item) {
34                 item.style.fontWeight = "normal";
35         }
36 }
37
38 function show_tab(id) {
39         var tab = document.getElementById(id);
40         if (tab) {
41                 tab.style.display = "";
42         }
43         var item = document.getElementById(id+"link");
44         if (item) {
45                 item.style.fontWeight = "bold";
46         }
47         var item = document.getElementById("palllink");
48         if (item) {
49                 item.style.fontWeight = "normal";
50         }
51 }
52
53 function init_tab_list(id) {
54         hide_tab("pdeps");
55         hide_tab("pdownload");
56         show_tab("pdesctab");
57         show_tab("pbinaries");
58
59         var tablist = document.getElementById(id);
60         if (tablist) {
61                 var list = document.createElement("ul");
62                 if (document.getElementById("pdesctab")) {
63                         var item = document.createElement("li");
64                         item.setAttribute("id","pdesctablink");
65                         var link = document.createElement("a");
66                         link.setAttribute("href","javascript:go_to_tab(\"pdesctab\")");
67                         var txt = document.createTextNode("[ Description ]");
68                         link.appendChild(txt);
69                         item.appendChild(link);
70                         list.appendChild(item);
71                 }
72                 if (document.getElementById("pbinaries")) {
73                         var item = document.createElement("li");
74                         item.setAttribute("id","pbinarieslink");
75                         var link = document.createElement("a");
76                         link.setAttribute("href","javascript:go_to_tab(\"pbinaries\")");
77                         var txt = document.createTextNode("[ Description ]");
78                         link.appendChild(txt);
79                         item.appendChild(link);
80                         list.appendChild(item);
81                 }
82                 if (document.getElementById("pdeps")) {
83                         var item = document.createElement("li");
84                         item.setAttribute("id","pdepslink");
85                         var link = document.createElement("a");
86                         link.setAttribute("href","javascript:go_to_tab(\"pdeps\")");
87                         var txt = document.createTextNode("[ Dependencies ]");
88                         link.appendChild(txt);
89                         item.appendChild(link);
90                         list.appendChild(item);
91                 }
92                 if (document.getElementById("pdownload")) {
93                         var item = document.createElement("li");
94                         item.setAttribute("id","pdownloadlink");
95                         var link = document.createElement("a");
96                         link.setAttribute("href","javascript:go_to_tab(\"pdownload\")");
97                         var txt = document.createTextNode("[ Download ]");
98                         link.appendChild(txt);
99                         item.appendChild(link);
100                         list.appendChild(item);
101                 }
102                 if (list.childNodes.length > 0) {
103                         var item = document.createElement("li");
104                         item.setAttribute("id","palllink");
105                         var link = document.createElement("a");
106                         link.setAttribute("href","javascript:show_all_tabs()");
107                         var txt = document.createTextNode("[ All ]");
108                         link.appendChild(txt);
109                         item.appendChild(link);
110                         list.appendChild(item);
111                         
112                 }
113                 tablist.appendChild(list);
114         }
115         show_tab("pdesctab");
116         show_tab("pbinaries");
117 }
118
119 function go_to_tab(id) {
120         if (id == "pdeps") {
121                 hide_tab("pdesctab");
122                 hide_tab("pbinaries");
123                 hide_tab("pdownload");
124                 show_tab("pdeps");
125         }
126         if (id == "pdesctab" || id == "pbinaries") {
127                 hide_tab("pdeps");
128                 hide_tab("pdownload");
129                 show_tab("pdesctab");
130                 show_tab("pbinaries");
131         }
132         if (id == "pdownload") {
133                 hide_tab("pdesctab");
134                 hide_tab("pbinaries");
135                 hide_tab("pdeps");
136                 show_tab("pdownload");
137         }
138 }
139
140 function show_all_tabs() {
141         show_tab("pdesctab");
142         show_tab("pbinaries");
143         show_tab("pdeps");
144         show_tab("pdownload");
145         var item = document.getElementById("palllink");
146         if (item) {
147                 item.style.fontWeight = "bold";
148         }
149 }