Post by Simie on Sept 16, 2007 3:34:22 GMT -8
This code moves the announcements to a seperate table above the other threads...
Global Header
Global Footer
<script type="text/javascript">
// Announcements container by Simie - Open Source
var newIcon = 'http://s4.images.proboards.com/new.gif'; // New post icon
if(location.href.match(/board=/i)){
var sTR = document.getElementsByTagName("tr");
var sTD = document.getElementsByTagName("td");
var newTable = '<table align="center" cellpadding="0" cellspacing="0" width="92%"><tbody><tr><td valign="top" width="100%"><table class="bordercolor" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><table border="0" cellpadding="4" cellspacing="1" width="100%"><tr><td style="height: 20px;" class="titlebg" colspan="8"><font class="titletext">Forum Announcements <a href="javascript:void(0);" onclick="hideShowAnnouncements();">(Hide/Show)</a><font></font></font></td></tr><tbody id="announcementsBox" style="display: none"><tr><td class="catbg" bgcolor="#dadada" width="5%"><font size="2"> </font></td><td class="catbg" bgcolor="#dadada" width="5%"><font size="2"> </font></td><td class="catbg" bgcolor="#dadada" width="48%"><font class="cattext" color="#0e0e0e" size="2"><b>Subject</b></font></td><td class="catbg" align="center" bgcolor="#dadada" width="14%"><font class="cattext" color="#0e0e0e" size="2"><b>Started by</b></font></td><td class="catbg" align="center" bgcolor="#dadada" width="4%"><font class="cattext" color="#0e0e0e" size="2"><b>Replies</b></font></td><td class="catbg" align="center" bgcolor="#dadada" width="4%"><font class="cattext" color="#0e0e0e" size="2"><b>Views</b></font></td><td class="catbg" bgcolor="#dadada" width="20%"><font class="cattext" color="#0e0e0e" size="2"><b>Last Post</b></font></td></tr>';
var ok = false;
var toRemove = new Array();
for(i = 0; i < sTR.length; i++){
if(sTR.innerHTML.match(/Announcement: <b/i) && sTR.firstChild.width == '5%' && sTR.firstChild.className.match(/windowbg(2)?/i)){
newTable += '<tr>'+sTR.innerHTML+'</tr>';
sTR.style.display = 'none';
ok = true;
}
if(sTR.firstChild && sTR.firstChild.colSpan == '7' && sTR.firstChild.height == '5'){
sTR.style.display = 'none';
}
}
newTable += '</tbody></table></td></tr></table></td></tr></table>';
if(newTable.match(/new\.gif/i)){
newTable = newTable.replace(/Forum Ann/, '<img src="'+newIcon+'" alt="new " border="0"></a> Forum Ann');
}
if(ok == true)
document.getElementById('announceContainer').innerHTML = newTable;
function hideShowAnnouncements(){
var ann = document.getElementById('announcementsBox');
if(ann.style.display == 'none'){
ann.style.display = '';
} else if(ann.style.display == ''){
ann.style.display = 'none';
}
}
}
</script>
Editing:
You only need to edit this code if you use a different "NEW" icon than the default proboard one. Simple change this line:
var newIcon = 'http://s4.images.proboards.com/new.gif'; // New post icon
Change the red to the new URL.
Enjoy
Global Header
<div id="announceContainer"></div>
Global Footer
<script type="text/javascript">
// Announcements container by Simie - Open Source
var newIcon = 'http://s4.images.proboards.com/new.gif'; // New post icon
if(location.href.match(/board=/i)){
var sTR = document.getElementsByTagName("tr");
var sTD = document.getElementsByTagName("td");
var newTable = '<table align="center" cellpadding="0" cellspacing="0" width="92%"><tbody><tr><td valign="top" width="100%"><table class="bordercolor" bgcolor="#000000" border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td><table border="0" cellpadding="4" cellspacing="1" width="100%"><tr><td style="height: 20px;" class="titlebg" colspan="8"><font class="titletext">Forum Announcements <a href="javascript:void(0);" onclick="hideShowAnnouncements();">(Hide/Show)</a><font></font></font></td></tr><tbody id="announcementsBox" style="display: none"><tr><td class="catbg" bgcolor="#dadada" width="5%"><font size="2"> </font></td><td class="catbg" bgcolor="#dadada" width="5%"><font size="2"> </font></td><td class="catbg" bgcolor="#dadada" width="48%"><font class="cattext" color="#0e0e0e" size="2"><b>Subject</b></font></td><td class="catbg" align="center" bgcolor="#dadada" width="14%"><font class="cattext" color="#0e0e0e" size="2"><b>Started by</b></font></td><td class="catbg" align="center" bgcolor="#dadada" width="4%"><font class="cattext" color="#0e0e0e" size="2"><b>Replies</b></font></td><td class="catbg" align="center" bgcolor="#dadada" width="4%"><font class="cattext" color="#0e0e0e" size="2"><b>Views</b></font></td><td class="catbg" bgcolor="#dadada" width="20%"><font class="cattext" color="#0e0e0e" size="2"><b>Last Post</b></font></td></tr>';
var ok = false;
var toRemove = new Array();
for(i = 0; i < sTR.length; i++){
if(sTR.innerHTML.match(/Announcement: <b/i) && sTR.firstChild.width == '5%' && sTR.firstChild.className.match(/windowbg(2)?/i)){
newTable += '<tr>'+sTR.innerHTML+'</tr>';
sTR.style.display = 'none';
ok = true;
}
if(sTR.firstChild && sTR.firstChild.colSpan == '7' && sTR.firstChild.height == '5'){
sTR.style.display = 'none';
}
}
newTable += '</tbody></table></td></tr></table></td></tr></table>';
if(newTable.match(/new\.gif/i)){
newTable = newTable.replace(/Forum Ann/, '<img src="'+newIcon+'" alt="new " border="0"></a> Forum Ann');
}
if(ok == true)
document.getElementById('announceContainer').innerHTML = newTable;
function hideShowAnnouncements(){
var ann = document.getElementById('announcementsBox');
if(ann.style.display == 'none'){
ann.style.display = '';
} else if(ann.style.display == ''){
ann.style.display = 'none';
}
}
}
</script>
Editing:
You only need to edit this code if you use a different "NEW" icon than the default proboard one. Simple change this line:
var newIcon = 'http://s4.images.proboards.com/new.gif'; // New post icon
Change the red to the new URL.
Enjoy