Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
My first InvisionFree code, so my location checks may not be the best. If you find a page that displays all of the categories, but this code isn't working, please post the link here so I can fix it.


Anyways, footer.

<script type="text/Javascript">
// Hide/Show Categories with Remembering by Chris/CDDude229
// Do not redistribute outside of iFusion and Studio Zero

var _show = "+"; // Shown while the category is visible
var _hide = "-"; // Shown while the category is hidden

// No need to edit
var aDI = document.getElementsByTagName("div");
if(location.href.match(/\.com\/[A-Z0-9_-]+(\/(index\.php)?)?(\?(act=idx)?)?$/i)){
for(a=0;a<aDI.length;a++){
 if(aDI[a].className == "maintitle" && aDI[a].lastChild.nodeName.toLowerCase() == "a" && aDI[a].lastChild.href.match(/\?c=(\d+)/i)){
  var an = document.createElement("A");
  an.name = RegExp.$1;
  an.href = "javascript:void(0);";
  an.onclick = function(){
   _hideShow(this);
  }
  var stat = (document.cookie.match(new RegExp(an.name+"=1","i"))?true:false);
  an.innerHTML = (stat?_hide:_show);
  aDI[a].appendChild(document.createTextNode(" "));
  aDI[a].appendChild(an);
  if(stat)
   aDI[a-1].getElementsByTagName("table")[0].style.display = "none";
  aDI[a-1].getElementsByTagName("table")[0].id = an.name;
 }
}
}

function _hideShow(_id){
var x = document.getElementById(_id.name);
x.style.display = (x.style.display == "none"?"":"none");
document.cookie = _id.name+"="+(x.style.display == "none"?"1":"0")+";expires="+(new Date()).toGMTString().replace(/\d{4}/,"2050");
_id.innerHTML = (x.style.display == "none"?_hide:_show);
}
</script>


Two variables you can, but aren't required to edit.

var _show = "+"; // Shown while the category is visible
var _hide = "-"; // Shown while the category is hidden


Comments should tell you what they do.

So yeah, enjoy. :P


Last Edit: Jul 1, 2006 6:14:08 GMT by Chris

newBookmarkLockedFalling