experiment a little with the use of JavaScript. Right now I use
[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 }