Matt
Graphics Admin
Great admin or greatest admin?
Posts: 4,891
|
Post by Matt on Jun 5, 2006 19:47:34 GMT -5
Created By: Todge Creator's Comments: This will collapse a single category, clicking on the category bar will bring it into view..
It goes in your Main Footer..
<script type="text/javascript"> <!-- /* Collapse ONE catagory By Todge */
var catToCollapse = 'NAME OF CATEGORY TO COLLAPSE';
// Collapse or expand catagory.. function collapseCat(hiddenCat) { if(hiddenCat.nextSibling.style.display == 'none') { hiddenCat.firstChild.innerHTML = catToCollapse+'<font size="-2"> - Click to hide</font>'; } else { hiddenCat.firstChild.innerHTML = catToCollapse+'<font size="-2"> - Click to expand</font>'; } while(hiddenCat.nextSibling.firstChild.className != 'catbg' && hiddenCat != hiddenCat.parentNode.lastChild) { hiddenCat = hiddenCat.nextSibling; if(hiddenCat.style.display == 'none') { hiddenCat.style.display = ''; } else { hiddenCat.style.display = 'none'; } } }
// Find catagory and make it collapsable var cat=document.getElementsByTagName('tr'); for(c=0; c<cat.length; c++) { if(cat[c].firstChild.className=='catbg' && cat[c].firstChild.colSpan=='5' && cat[c].firstChild.innerHTML.match('>'+catToCollapse+'<')) { cat[c].style.cursor = 'pointer'; cat[c].onclick = function(){collapseCat(this);} collapseCat(cat[c]); } } // --> </script>
Edit this line with the EXACT name of the category you want collapsed..
var catToCollapse = 'NAME OF CATEGORY TO COLLAPSE';
|
|
|
Post by myself on Oct 26, 2007 18:56:02 GMT -5
I have a question, do I have to put the category id or the name?
|
|
Matt
Graphics Admin
Great admin or greatest admin?
Posts: 4,891
|
Post by Matt on Oct 26, 2007 20:17:24 GMT -5
I'm not positive so try it with the ID first. Then try the name if that doesn't work.
|
|
Samuel
Former Coding Moderator
:D
Posts: 154
|
Post by Samuel on Oct 27, 2007 14:57:22 GMT -5
It's the name, to work with the ID you'd have to change this line:
cat[c].firstChild.innerHTML.match('>'+catToCollapse+'<'))
but to be honest, I have no idea what to xD. Doesn't really matter anyway though.
|
|
kitezer
I want to help Orca.
Posts: 37
|
Post by kitezer on Oct 27, 2007 21:01:10 GMT -5
May I ask for what reason could this code be useful? 0_o
|
|
Samuel
Former Coding Moderator
:D
Posts: 154
|
Post by Samuel on Oct 28, 2007 6:49:42 GMT -5
I'm sure someone would find it useful, codes are usually made as requests... so there must be a use
|
|
kitezer
I want to help Orca.
Posts: 37
|
Post by kitezer on Oct 28, 2007 18:36:04 GMT -5
Yeah true I just can't figure out what reason could make this code useful.
|
|