Post by daedric on Jun 28, 2009 18:22:51 GMT -5
May I suggest an alternate code for the expand/collapse categories?
See the problem with the current code is that even if you pop open one category when you come back to it the category is always automatically closed.
This code (at least on Firefox) remembers which categories you collapsed and which ones you didn't. I think it only works per session though, so if you close your Firefox I believe it erases it. I haven't checked on other browsers but I assume it works the same.
But it's up to you, really. Just kind of hard when I always have to pop categories open. It might be easier if they started open and then I could close them. XD
See the problem with the current code is that even if you pop open one category when you come back to it the category is always automatically closed.
This code (at least on Firefox) remembers which categories you collapsed and which ones you didn't. I think it only works per session though, so if you close your Firefox I believe it erases it. I haven't checked on other browsers but I assume it works the same.
<!--
/*Expand/Collapse Categories - By iAlex - Open Source*/
var iInsert_Name={
iHere: function(){
if(window.location.href.match(/action=home/) || !window.location.href.match(/action/) && !document.postForm && !document.modifyForm && !document.title.match(/\s-\sLogin/)){
this.iOriginal_Name();
}
},
iOriginal_Name: function(){
var iTd=document.getElementsByTagName('td');
var i=iTd.length-1;
do{
if(iTd.item(i).className=="catbg" && iTd.item(i).colSpan=="5" && iTd.item(i).align!="right"){
var iNew_Font=document.createElement('font');
iNew_Font.size='1';
iNew_Font.innerHTML=' - <a href="javascript: void(0)" onclick="iInsert_Name.iYawn_Tired(this)">Collapse</a>';
iTd.item(i).appendChild(iNew_Font);
if(document.cookie.match(iTd.item(i).firstChild.name+'=iCollapsed')){
iInsert_Name.iYawn_Tired(iNew_Font.getElementsByTagName('a').item(0));
}
}
i--;
}
while(i>6);
},
iYawn_Tired: function(iBored){
(iBored.innerHTML=="Collapse")? document.cookie=iBored.parentNode.parentNode.firstChild.name+'=iCollapsed;expires=Sat, 20 Jan 2050 12:12:12 UTC; path=/;' : document.cookie=iBored.parentNode.parentNode.firstChild.name+'=iCollapsed;expires=Sat, 20 Jan 1990 12:12:12 UTC; path=/;';
(iBored.innerHTML=="Collapse")? iBored.innerHTML='Expand' : iBored.innerHTML='Collapse';
var iNext=iBored.parentNode.parentNode.parentNode.nextSibling;
while(iNext && iNext.firstChild.className!="catbg"){
(iNext.style.display=="none")? iNext.style.display='' : iNext.style.display='none';
iNext=iNext.nextSibling;
}
}
};
iInsert_Name.iHere();
//-->
</script>
But it's up to you, really. Just kind of hard when I always have to pop categories open. It might be easier if they started open and then I could close them. XD