Post by Matt on Jun 13, 2006 16:15:35 GMT -5
Created By: Aaron
Creator's Comments:
Description: Splits the categories on the main page with optional header/footer images and a hide/show boards feature (set with cookies so they remain hidden/shown).
Cross-browser: Yes
Main Footer
Creator's Comments:
Description: Splits the categories on the main page with optional header/footer images and a hide/show boards feature (set with cookies so they remain hidden/shown).
Cross-browser: Yes
Main Footer
<script type="text/javascript">
<!--
// Category Splitter
var gHeight = "20px"; // space between categories
var gHeader = "head"; // header image (leave blank if unwanted)
var gFooter = "foot"; // footer image (leave blank if unwanted)
var selector, e = 0, gCell = document.getElementsByTagName("td");
function setCookie(des, table) {
var exp = new Date("December 25, 2050").toGMTString();
document.cookie = "splitter" + table + "=" + des + ";path=/;expires=" + exp + ";";
}
function readCookie(table) {
if(document.cookie.indexOf("splitter" + table) != -1) {
return document.cookie.split("splitter" + table + "=")[1].split(";")[0];
} else {
return "show";
}
}
for(var i = 0; i < gCell.length; i ++) {
if(gCell[i].className == "titlebg" && gCell[i].firstChild.className == "titletext" && gCell[i].firstChild.firstChild && gCell[i].firstChild.firstChild.firstChild.data == "Forum Name") {
var nCenter = document.createElement("center"); nCenter.style.backgroundColor = document.body.bgColor; nCenter.style.paddingTop = "15px";
gCell[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.bgColor = "#FF0000";
for(gRow = gCell[i].parentNode; gRow; gRow = gRow.nextSibling) {
if(gRow.firstChild.className == "catbg" && gRow.firstChild.align != "right") {
if(gHeader) {
var nHeader = document.createElement("div");
nHeader.appendChild(document.createElement("img")); nHeader.firstChild.src = gHeader;
nCenter.appendChild(nHeader);
}
var nTableBody = document.createElement("tbody");
nTableBody.appendChild(gCell[i].parentNode.cloneNode(true));
nTableBody.appendChild(gRow.cloneNode(true));
nTableBody.lastChild.onmouseover = function() {
this.style.textDecoration = "underline";
document.body.style.cursor = "hand";
}
nTableBody.lastChild.onmouseout = function() {
this.style.textDecoration = "none";
document.body.style.cursor = "auto";
}
nTableBody.lastChild.onclick = function() {
for(loopRows = this.nextSibling; loopRows && loopRows.firstChild.className != "catbg"; loopRows = loopRows.nextSibling) {
if(loopRows.style.display) {
loopRows.style.display = ""; selector = "show";
} else {
loopRows.style.display = "none"; selector = "hide";
}
}
setCookie(selector, this.parentNode.parentNode.id.split("table_")[1]);
}
var nTable = gCell[i].parentNode.parentNode.parentNode.cloneNode(false); nTable.id = "splitter_table_" + e; nTable.className = "bordercolor";
nTable.appendChild(nTableBody);
for(loopRows = gRow.nextSibling; loopRows && loopRows.firstChild.className != "catbg"; loopRows = loopRows.nextSibling) {
nTableBody.appendChild(loopRows.cloneNode(true));
nTableBody.lastChild.style.display = readCookie(nTable.id.split("table_")[1]) == "show" ? "" : "none";
}
if(gCell[i].parentNode.parentNode.lastChild.firstChild.className == "catbg") {
nTableBody.appendChild(gCell[i].parentNode.parentNode.lastChild.cloneNode(true));
}
nCenter.appendChild(nTable);
if(gFooter) {
var nFooter = document.createElement("div");
nFooter.appendChild(document.createElement("img")); nFooter.firstChild.src = gFooter;
nCenter.appendChild(nFooter);
}
var nSeparator = document.createElement("div"); nSeparator.style.backgroundColor = document.body.bgColor; nSeparator.style.height = gHeight;
nCenter.appendChild(nSeparator);
e += 1;
}
}
nCenter.removeChild(nCenter.lastChild);
gCell[i].parentNode.parentNode.parentNode.parentNode.replaceChild(nCenter, gCell[i].parentNode.parentNode.parentNode);
break;
}
}
//-->
</script>