|
Post by Wormopolis on Dec 19, 2008 16:33:20 GMT -8
Browsers Tested: IE and FF placement: main footer
Lets you create a list of boards (id, name, description) and randomly chooses one of them. Then makes a fake board on the main page under a selected category.
<script type="text/javascript"> <!-- // random board on main page // creates fake board from list of hidden boards and places // under category // By Wormopolis // keep header intact, do not repost
// edit below var categoryID="general"; //category ID to place fake board under var position="top"; // choose top or bottom
// boardlist contains array of boardIDs, Titles, and descriptions. var boardList = [ ["hide1","SPECIAL ONE", "Hidden board test number 1"], ["hide2","SPECIAL TOO", "Hidden board test 2"] //no comma last line ];
//no need to edit below hopefully
rand=Math.floor(Math.random()*boardList.length); tds=document.getElementsByTagName('td'); for (i=0; i<tds.length; i++) { if (tds[i].colSpan=='5' && tds[i].className=='catbg' && tds[i].getElementsByTagName('a')[0].name==categoryID) { boardstop=tds[i].parentNode.nextSibling; boardsbottom=boardstop; while (boardsbottom.nextSibling && boardsbottom.nextSibling.firstChild && boardsbottom.nextSibling.firstChild.width=="8%") { boardsbottom=boardsbottom.nextSibling; } fakerow=tds[i].parentNode.parentNode.insertRow(tds[i].parentNode.rowIndex); for (t=0; t<5; t++) fakerow.insertCell(0);
fakerow.cells[0].width="8%"; fakerow.cells[0].className="windowbg"; fakerow.cells[0].align="center"; fakerow.cells[0].innerHTML='<img src="http://s1.images.proboards.com/off.gif" alt="[ ]" border="0"/>'; fakerow.cells[1].className="windowbg2"; fakerow.cells[1].align="left"; fakerow.cells[1].valign="top"; fakerow.cells[1].innerHTML='<font size="2"><a href="/index.cgi?board='+boardList[rand][0]+'beck" onclick="pb_bubble=1"><b>'+boardList[rand][1]+'</b></a></font><br/><font size="1">'+boardList[rand][2]+'</font>'; fakerow.cells[1].onmouseout=function() {mouseOutHighlightCell(this);setWindowStatus('');return true;}; fakerow.cells[2].className="windowbg"; fakerow.cells[2].width="1%"; fakerow.cells[3].width="1%"; fakerow.cells[3].className="windowbg"; fakerow.cells[4].className="windowbg2"; fakerow.cells[4].width="24%";
if (position=="top") { boardstop.parentNode.insertBefore(fakerow,boardstop); } else { boardstop.parentNode.insertBefore(fakerow,boardsbottom.nextSibling); }
changeCell=fakerow.cells[1];
if (changeCell.attachEvent) changeCell.attachEvent("onmouseover", function g() {mouseOverHighlightCell(changeCell);setWindowStatus(boardList[rand][1]);return true;}); if (changeCell.addEventListener) changeCell.addEventListener("mouseover", function g() {mouseOverHighlightCell(changeCell);setWindowStatus(boardList[rand][1]);return true;},false);
if (changeCell.attachEvent) changeCell.attachEvent("onclick", function g() {if(!pb_bubble)location.href='/index.cgi?board='+boardList[rand][0];}); if (changeCell.addEventListener) changeCell.addEventListener("click", function g() {if(!pb_bubble)location.href='/index.cgi?board='+boardList[rand][0];},false);
} }
// --> </script>
Preview: coming soon
|
|