Post by Jordan on Dec 5, 2008 12:21:43 GMT -8
Just as the subject says, this script will allow you to have different on and off icons for each category.
It goes in your main footers and you will need to know your category ID's.
If you don't know your category ID's, an easy way to find them is to go into any board within that category and then click on the category link in the nav bar (Message Board :: Category Name :: Board Name).
Click on the category name, and the ID will be the text in your address bar after the hash sign #.
So for this support forum, the ID for the general section is: support.proboards.com/index.cgi#misc
<script type="text/javascript"><!--
/*
* Different On/Off Icons for each Category
* Created By Triad
* support.proboards.com
*/
var _cat = [
["category_id", "Off_URL", "On_URL"],
["category_id", "Off_URL", "On_URL"] // No comma on the last line.
];
if(location.href.match(/\.com(\/|.+cgi(\?|#.+|\?\w+=(home|\w{15}y.+))?)?$/i)){
for(var tb = document.getElementsByTagName("table"), a = 1; a < tb.length; a++){
if(tb[a-1].className == "bordercolor" && tb.cellPadding == "4" && tb.rows[0].cells[0].innerHTML.match(/forum\sname/i)){
for(r = 1; r < tb.rows.length; r++){
if(tb.rows[r].cells[0].colSpan == "5" && tb.rows[r].cells[0].firstChild.name){
var id = tb.rows[r].cells[0].firstChild.name;
for(x = 0; x < _cat.length; x++){
if(id == _cat[x][0]){
while(tb.rows[++r] && tb.rows[r].cells[0].colSpan != "5"){
if(tb.rows[r].cells[0].firstChild.alt == "[ ]")
tb.rows[r].cells[0].firstChild.src = _cat[x][1];
else
tb.rows[r].cells[0].firstChild.src = _cat[x][2];
} r--;
}
}
}
}
}
}
}
//--></script>
It goes in your main footers and you will need to know your category ID's.
If you don't know your category ID's, an easy way to find them is to go into any board within that category and then click on the category link in the nav bar (Message Board :: Category Name :: Board Name).
Click on the category name, and the ID will be the text in your address bar after the hash sign #.
So for this support forum, the ID for the general section is: support.proboards.com/index.cgi#misc
<script type="text/javascript"><!--
/*
* Different On/Off Icons for each Category
* Created By Triad
* support.proboards.com
*/
var _cat = [
["category_id", "Off_URL", "On_URL"],
["category_id", "Off_URL", "On_URL"] // No comma on the last line.
];
if(location.href.match(/\.com(\/|.+cgi(\?|#.+|\?\w+=(home|\w{15}y.+))?)?$/i)){
for(var tb = document.getElementsByTagName("table"), a = 1; a < tb.length; a++){
if(tb[a-1].className == "bordercolor" && tb.cellPadding == "4" && tb.rows[0].cells[0].innerHTML.match(/forum\sname/i)){
for(r = 1; r < tb.rows.length; r++){
if(tb.rows[r].cells[0].colSpan == "5" && tb.rows[r].cells[0].firstChild.name){
var id = tb.rows[r].cells[0].firstChild.name;
for(x = 0; x < _cat.length; x++){
if(id == _cat[x][0]){
while(tb.rows[++r] && tb.rows[r].cells[0].colSpan != "5"){
if(tb.rows[r].cells[0].firstChild.alt == "[ ]")
tb.rows[r].cells[0].firstChild.src = _cat[x][1];
else
tb.rows[r].cells[0].firstChild.src = _cat[x][2];
} r--;
}
}
}
}
}
}
}
//--></script>