Post by Todge on Jul 30, 2005 5:33:17 GMT -8
Here's a code I made a little while ago for V3.. It still works for V4...
The code should go at the bottom of your footer... To limit conflicts, it is better to go at the bottom of whatever footer you have second..
You edit this part... (red)
var newMessage = "- There are new messages in this forum";
var noNewMessage = " - There are no new messages in this forum";
var hide = 'URL OF IMAGE WHILE CATAGORY IS HIDDEN';
var show = 'URL OF IMAGE WHILE CATAGORY IS SHOWN';
var newImage = 'on.gif';
var guest = 'no';
var showBoards = 'default';
newMessage is any message you would like in the cat bar if there are new messages available..
noNewMessage is any message you would like in the cat bar if there are no new messages available..
hide is the URL of an image you'd like in the cat bar while it is hidden.. Leave it blank for no image..
show is the URL of an image you'd like in the cat bar while it is open.. Leave it blank for no image..
newImage is the image name of the image you have to the left of the boards when there are new messages available.. it is set to ProBoards standard image..
guest.. change this to 'yes' if you'd like the catagories colapsed for guests..
showBoards.. default: all catagories will be collapsed except those with new messages.. change this to 'none' for all catagories to be collapsed regardless of any new messages..
*fixed spelling in thread title for searching
The code should go at the bottom of your footer... To limit conflicts, it is better to go at the bottom of whatever footer you have second..
<script language="JavaScript">
<!--
/*
Catagory collapse by Todge
Copyright © 2005
Please keep this header intact
*/
// You change these....
var newMessage = "- There are new messages in this forum";
var noNewMessage = " - There are no new messages in this forum";
var hide = '';
var show = '';
var newImage = 'on.gif';
var guest = 'no';
var showBoards = 'default';
try
{
if(document.getElementsByTagName('TD')[2].innerHTML.search('Guest') !=-1 && guest == 'no')
{
end;
}
// Set variables
var boards = document.getElementsByTagName('TR');
var forums = new Array();
var start = 0;
var message = noNewMessage;
if(noNewMessage == '' && newMessage == '')
{
newMessage = '<NOTHING>';
}
while(boards[start].getElementsByTagName('TD')[0].width != '8%')
{
start++;
}
start--;
if(showBoards == 'default')
{
var newM = '';
var noNewM = 'none';
}
else
{
var newM = showBoards;
var noNewM = showBoards;
}
if(hide == '')
{
hide = 'http://proboards.com/images/blank.gif';
}
if(show == '')
{
show = 'http://proboards.com/images/blank.gif';
}
// Put images and relevent message in catagory bar and collapse the forums
var TD = document.getElementsByTagName('TD');
for(t=0; t<TD.length; t++)
{
if(TD[t].className == 'windowbg2' && TD[t].width == '66%')
{
TD[t].width = '';
}
}
for(t=start; t<boards.length; t++)
{
var TD = boards[t].getElementsByTagName('TD')[0];
if(TD.className == 'catbg' && TD.colSpan == '5' && TD.align != 'right')
{
for(f=t+1; f<boards.length; f++)
{
if(boards[f].getElementsByTagName('TD')[0].className != 'windowbg')
{
break;
}
if(boards[f].getElementsByTagName('TD')[0].innerHTML.search(newImage) != -1)
{
message = newMessage;
}
}
TD.innerHTML = '<table width="100%"><TD>'+TD.innerHTML+'<font size="-2"> '+message+'</font></TD><TD align="right"><img name="pic'+t+'" src="'+hide+'"></TD>';
message = noNewMessage;
}
}
for(t=start; t<boards.length; t++)
{
TD = boards[t].getElementsByTagName('TD')[0];
forums[t] = 'skip';
if(TD.className == 'catbg' && TD.colSpan == '5' && TD.align != 'right')
{
forums[t] = TD.getElementsByTagName('b')[0].innerHTML;
if(TD.innerHTML.match(newMessage))
{
showBoards = newM;
}
else
{
showBoards = noNewM;
}
if(showBoards == '')
{
document.images["pic"+t].src = show;
}
}
if(TD.className == 'windowbg' && TD.width == '8%')
{
forums[t] = showBoards;
}
}
function collapse(cat)
{
for(t=start; t<boards.length; t++)
{
if(forums[t] == cat)
{
for(f=t+2; f<boards.length; f++)
{
if(forums[f] != '' && forums[f] != 'none')
{
break;
}
if(forums[f] == 'none')
{
forums[f] = '';
document.images["pic"+t].src = show;
}
else
{
forums[f] = 'none';
document.images["pic"+t].src = hide;
}
}
}
}
for(t=start; t<boards.length; t++)
{
if(boards[t].getElementsByTagName('TD')[0].className == 'catbg' && boards[t].getElementsByTagName('TD')[0].align == 'right')
break;
else
if(forums[t] == 'none')
{
boards[t].style.display = 'none';
}
else
{
boards[t].style.display = '';
}
}
}
collapse();
//Capture mouse clicks and recollapse forums
for(t=start; t<boards.length; t++)
{
TD = boards[t].getElementsByTagName('TD')[0];
if(TD.className == 'catbg' && TD.colSpan == 5 && TD.align != 'right')
{
TD.style.cursor = 'pointer';
TD.onclick = function(){collapse(this.getElementsByTagName('b')[0].innerHTML);}
}
}
}
catch(endCode)
{
}
var catBar = document.getElementsByTagName('TR');
for(t=0; t<catBar.length; t++)
{
if(catBar[t].getElementsByTagName('TD')[0].className=="catbg" && catBar[t].getElementsByTagName('TD')[0].innerHTML.match(/Mark All Boards Read/))
catBar[t].style.display='none';
}
// -->
</script>
You edit this part... (red)
var newMessage = "- There are new messages in this forum";
var noNewMessage = " - There are no new messages in this forum";
var hide = 'URL OF IMAGE WHILE CATAGORY IS HIDDEN';
var show = 'URL OF IMAGE WHILE CATAGORY IS SHOWN';
var newImage = 'on.gif';
var guest = 'no';
var showBoards = 'default';
newMessage is any message you would like in the cat bar if there are new messages available..
noNewMessage is any message you would like in the cat bar if there are no new messages available..
hide is the URL of an image you'd like in the cat bar while it is hidden.. Leave it blank for no image..
show is the URL of an image you'd like in the cat bar while it is open.. Leave it blank for no image..
newImage is the image name of the image you have to the left of the boards when there are new messages available.. it is set to ProBoards standard image..
guest.. change this to 'yes' if you'd like the catagories colapsed for guests..
showBoards.. default: all catagories will be collapsed except those with new messages.. change this to 'none' for all catagories to be collapsed regardless of any new messages..
*fixed spelling in thread title for searching