User:Fyren/builds.js

if (!document.getElementsByClass) document.getElementsByClass = function(className) {   r = []; e = document.getElementsByTagName("*");

for(i = 0; i < e.length; i++) {     c = e[i].className.split(" "); for(j = 0; j < c.length; j++) if (c[j] == className) {         r.push(e[i]); break; }    }

return r; };

function toggleBuild(i) { var bar = document.getElementById('buildbar' + i); var stats = document.getElementById('buildstats' + i);

if (bar && stats) { if (bar.style.display == 'none') { bar.style.display = ''; stats.style.display = 'none'; } else { bar.style.display = 'none'; stats.style.display = ''; }       } }

function makeBuildToggleLinks { btl = document.getElementsByClass('buildtogglelink'); btlCount = 0;

for(i = 0; i < btl.length; i++) {   toggle = document.createElement('a'); toggle.setAttribute('href', 'javascript:toggleBuild(' + i + ')'); toggletext = document.createTextNode('toggle'); toggle.appendChild(toggletext); btl[i].appendChild(toggle);

document.getElementById('buildbar').id = 'buildbar' + i;   document.getElementById('buildstats').id = 'buildstats' + i;  } }

addOnloadHook(makeBuildToggleLinks);