Post by Todge on Oct 5, 2006 8:52:21 GMT -8
This is a edit to a code I've already made, but instead of collapsing ONE catagory, it will collapse as many as you like..
Put it in you Main Footer, preferably near or at the top..
Edit this with the EXACT name of the catagory(ies) you want collapsed..
catToCollapse[0] = 'EXACT NAME OF CATEGORY TO COLLAPSE';
catToCollapse[1] = 'EXACT NAME OF CATEGORY TO COLLAPSE';
Continue with..
catToCollapse[2] = 'EXACT NAME OF CATEGORY TO COLLAPSE';
catToCollapse[3] = 'EXACT NAME OF CATEGORY TO COLLAPSE';
as necassary..
Put it in you Main Footer, preferably near or at the top..
<script type="text/javascript">
<!--
/*
Collapse selected catagories
By Todge
*/
var catToCollapse = new Array();
// Edit below...
catToCollapse[0] = 'EXACT NAME OF CATEGORY TO COLLAPSE';
catToCollapse[1] = 'EXACT NAME OF CATEGORY TO COLLAPSE';
// Edit above...
// Collapse or expand catagory..
function collapseCat(hiddenCat)
{
if(hiddenCat.nextSibling.style.display == 'none')
{
hiddenCat.firstChild.innerHTML = hiddenCat.firstChild.innerHTML.split(/<font size=/i)[0]+'<font size="-2"> - Click to hide</font>';
}
else
{
hiddenCat.firstChild.innerHTML = hiddenCat.firstChild.innerHTML.split(/<font size=/i)[0]+'<font size="-2"> - Click to show</font>';
}
while(hiddenCat != hiddenCat.parentNode.lastChild && hiddenCat.nextSibling.firstChild.className != 'catbg')
{
hiddenCat = hiddenCat.nextSibling;
if(hiddenCat.style.display == 'none')
{
hiddenCat.style.display = '';
}
else
{
hiddenCat.style.display = 'none';
}
}
}
// Find catagories and make them collapsable
var cat=document.getElementsByTagName('tr');
for(c=0; c<cat.length; c++)
{
if(cat[c].firstChild.className=='catbg' && cat[c].firstChild.colSpan=='5')
{
for(t=0; t<catToCollapse.length; t++)
{
if(cat[c].firstChild.innerHTML.match('>'+catToCollapse[t]+'<'))
{
cat[c].style.cursor = 'pointer';
cat[c].onclick = function(){collapseCat(this);}
collapseCat(cat[c]);
}
}
}
}
// -->
</script>
Edit this with the EXACT name of the catagory(ies) you want collapsed..
catToCollapse[0] = 'EXACT NAME OF CATEGORY TO COLLAPSE';
catToCollapse[1] = 'EXACT NAME OF CATEGORY TO COLLAPSE';
Continue with..
catToCollapse[2] = 'EXACT NAME OF CATEGORY TO COLLAPSE';
catToCollapse[3] = 'EXACT NAME OF CATEGORY TO COLLAPSE';
as necassary..