|
Post by MonsterControl on Jan 19, 2012 20:36:26 GMT -4
<script type="text/javascript"> <!-- /* Collapse categories (Admin editable) By Todge Copyright © 2007 Please keep this header intact */
// Edit below...
var hideMessage = " - Click to hide this forum"; var showMessage = " - Click to show this forum"; var newMessage = "<font color=000000> There are new messages in this forum</font>";
// Edit above...
var newMes = 0;
// Set cookie function.. function setCookie(cookieName,cookieValue) { var expireDate = new Date(); expireDate.setMonth(expireDate.getMonth()+6); if(cookieValue == 'new') { document.cookie = cookieName+'=none; expires='+expireDate.toGMTString()+'; path=/'; return; } var cValue = document.cookie; cValue = cValue.split(cookieName)[1].split(';')[0]; if(cookieValue == '' && cValue.match(/none/)) { if(document.all){ cookieValue = 'block';} else{ cookieValue = '';} } else { cookieValue = 'none'; }
document.cookie = cookieName+'='+cookieValue+'; expires='+expireDate.toGMTString()+'; path=/'; return; }
// Collapse or expand category.. function collapseCat(hiddenCat,catName) {
var collapse = document.cookie; collapse = collapse.split(catName+'=')[1].split(';')[0];
if(collapse == '' || collapse == 'block') { hiddenCat.firstChild.innerHTML = hiddenCat.firstChild.innerHTML.split(/<\/font>/i)[0]+'</font><font size="-2">'+hideMessage+'</font>'; } else if(newMes == 1) { hiddenCat.firstChild.innerHTML= hiddenCat.firstChild.innerHTML.split(/<\/font>/i)[0]+'</font><font size="-2">'+newMessage+showMessage+'</font>'; } else { hiddenCat.firstChild.innerHTML = hiddenCat.firstChild.innerHTML.split(/<\/font>/i)[0]+'</font><font size="-2">'+showMessage+'</font>'; }
while(hiddenCat != hiddenCat.parentNode.lastChild && hiddenCat.nextSibling.firstChild.className != 'catbg') { hiddenCat = hiddenCat.nextSibling; hiddenCat.style.display = collapse; } return; }
// Find categories and make them collapsible.. var cat=document.getElementsByTagName('tr'); for(c=0; c<cat.length; c++) { if(cat[c].firstChild && cat[c].firstChild.className=='catbg' && cat[c].firstChild.colSpan=='5' && cat[c].firstChild.align!='right') { var cc = cat[c].getElementsByTagName('b')[0].innerHTML; var cName = cat[c].getElementsByTagName('a')[0].name;
if(cc.match(/ $/)) { cat[c].style.cursor = 'pointer'; cat[c].onclick = function(){ setCookie(this.getElementsByTagName('a')[0].name,''); collapseCat(this,this.getElementsByTagName('a')[0].name);}
var board = cat[c].nextSibling; while(board != board.parentNode.lastChild && board.firstChild.className == 'windowbg') { if(board.getElementsByTagName('img')[0].alt == '[/li][li]') { newMes = 1; break; } board = board.nextSibling; }
var pageCookie = document.cookie; cc = cc.substr(0,cc.length-1); if(!pageCookie.match(cName)) { setCookie(cName,'new'); }
collapseCat(cat[c],cName); newMes = 0; }}}
// Add admin functions... if(location.href.match('action=categorymodify2')) { var colTR = document.createElement('TR'); var colTD1 = document.createElement('TD'); var colTD2 = document.createElement('TD'); var colTD3 = document.createElement('TD');
var catForm = document.forms; for(c=0; c<catForm.length; c++) { if(catForm[c].hidden) { catForm = catForm[c]; break; }}
var colName = catForm.name.value;
colTD1.innerHTML = '<font size="-1">Collapse Category:</font>'; if(colName.substr(colName.length-1,1) == ' ') { catForm.name.value = colName.slice(0,colName.length-1); colTD2.innerHTML = '<font size="-1"><select name="collapse"><option value="0">No</option><option value="1" selected="1">Yes</option></select></font>'; } else { colTD2.innerHTML = '<font size="-1"><select name="collapse"><option value="0" selected="1">No</option><option value="1">Yes</option></select></font>'; } colTD3.innerHTML = '<font size="-2">Selecting "yes" will make this category collapsable.</font>';
colTR.appendChild(colTD1); colTR.appendChild(colTD2); colTR.appendChild(colTD3);
var cats = document.getElementsByTagName('tr'); for(t=0; t<cats.length; t++) { if(cats[t].innerHTML.match('Limit Access:') && cats[t].firstChild.width == '160') { cats[t].parentNode.insertBefore(colTR,cats[t]); }}
catForm.onsubmit = function(){if(catForm.collapse.value == 1){catForm.name.value += ' ';}}
} // --> </script>
|
|
|
Post by MonsterControl on Jan 27, 2012 20:33:51 GMT -4
<script type="text/Javascript"> // Hide/Show Categories v3 by Chris //Do not redistribute without permission of the creator
var hide = "http://s3.images.proboards.com/off.gif"; // Icon shown when the cat is hidden var show = "http://s3.images.proboards.com/on.gif"; // Icon shown when the cat is visible
var icoPos = "left"; // left -> left of the cat name // middle -> to the right of the cat name // right -> to the right side of the cell
var defCats = [ // These are the categories hidden by default. List their IDs only. "cat1", "cat2", "coding" // <-- Last line doesn't have a comma ];
// Don't edit defCats.push("__default"); function sc(_name,_value){ document.cookie = "hs"+_name+"="+escape(_value)+";expires="+(new Date()).toGMTString().replace(/\d{4}/,"2050"); }
function gc(_name){ if(document.cookie.match(new RegExp("hs"+_name+"=(.+?)($|;)","gi"))) return unescape(RegExp.$1); return false; } if(!location.href.match(/action=(?!home)/)){ var dCatReg = new RegExp("^("+defCats.join("|")+")$", "i"), aTD = document.getElementsByTagName("td"), a=0; if(!gc("__default")) for(b=0;b<defCats.length;b++) sc(defCats[b], 1);
while(aTD[++a]){ if(aTD[a].colSpan == 5 && !aTD[a].getElementsByTagName("img")[0]){ var id = aTD[a].getElementsByTagName("a")[0].name; var ico = " <img src='"+(gc(id)==1?hide:show)+"' onclick='_hs(this)' id='"+id+"' /> "; if(icoPos.toLowerCase() == "left") aTD[a].innerHTML = ico+aTD[a].innerHTML; else aTD[a].innerHTML += (icoPos.toLowerCase() == "right"?ico:ico.replace(/<img/i, "<img style='float: right'")); if(gc(id) == 1){ var r = aTD[a].parentNode.nextSibling; while(r.cells[0].colSpan != 5){ r.style.display = "none"; r = r.nextSibling; } } } } }
function _hs(ext){ var m = (ext.src == hide?1:0); ext.src = (m?show:hide); var r = ext.parentNode.parentNode.nextSibling; while(r.cells[0].colSpan != 5){ r.style.display = (m?"":"none"); r = r.nextSibling; } sc(ext.id, (m?0:1)); } </script>
|
|