|
Post by Wormopolis on Nov 6, 2009 3:26:34 GMT -8
Browser Tested: IE and FF placement: top of Main Footer re-organizes the recent posts view so that all the posts that are part of the same thread are next to each other. divides into different boards, then different threads in those boards. Variables change gap width between different boards, and if you want posts in ascending or descending order. <script type="text/javascript"> <!-- // recent posts - group by board & thread // by Wormopolis - www.wormocodes.com // do not repost - keep header intact
var boardDivisionHeight=25; var postOrder="up"; //up or down
if (location.href.match(/action=recent/)) {
groupingArray=new Array();
for (tds=document.getElementsByTagName('td'), t=0; t<tds.length; t++) { if (tds[t].width=='20%' && tds[t].className=='catbg' && tds[t].nextSibling.firstChild && tds[t].nextSibling.firstChild.className=='cattext') { boardlink=tds[t].nextSibling.firstChild.getElementsByTagName('a')[0]; threadRow=tds[t].parentNode; postRow=tds[t].parentNode.nextSibling; var holdingTable=postRow.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode; holdingTable.style.display = holdingTable.previousSibling.style.display = holdingTable.previousSibling.previousSibling.style.display = holdingTable.nextSibling.style.display = holdingTable.nextSibling.nextSibling.style.display = "none"; boardlinkBID=boardlink.href.split('board=')[1].split('&')[0]; boardlinkTID=boardlink.href.split('thread=')[1].split('&')[0]; found=false; for (i=0; i<groupingArray.length; i++) { if (groupingArray[i][0]==boardlinkBID) { found=true; break; } } if (!found) { lt=groupingArray.length; groupingArray[lt]=new Array(); groupingArray[lt][0]=boardlinkBID; groupingArray[lt][1]=new Array(); //of triplets (threadID, title, and post array) groupingArray[lt][1][0]=new Array(); groupingArray[lt][1][0][0]=boardlinkTID; groupingArray[lt][1][0][1]=threadRow.cloneNode(true); groupingArray[lt][1][0][2]=new Array(); //postArray groupingArray[lt][1][0][2][0]=postRow.cloneNode(true); } else { // board found in array, check for thread id found2=false; for (j=0; j<groupingArray[i][1].length; j++) { if(groupingArray[i][1][j][0]==boardlinkTID) { found2=true; break; } } if (!found2) { // thread id not found, add thread id, title, and post to array gr3=groupingArray[i][1].length; groupingArray[i][1][gr3]=new Array(); groupingArray[i][1][gr3][0]=boardlinkTID; groupingArray[i][1][gr3][1]=threadRow.cloneNode(true); groupingArray[i][1][gr3][2]=new Array(); groupingArray[i][1][gr3][2][0]=postRow.cloneNode(true); } else { // thread id found, add post into array gr2=groupingArray[i][1][j][2].length; groupingArray[i][1][j][2][gr2]=postRow.cloneNode(true); } }
} } groupedDiv=document.createElement('div'); holdingTable.parentNode.insertBefore(groupedDiv, holdingTable.parentNode.lastChild); for (worm=0; worm<groupingArray.length; worm++) { tempTbl=document.createElement('table'); tempTbl.className='bordercolor'; tempTbl.width='100%'; tempTbl.insertRow(0); tempTbl.rows[0].insertCell(0); tempTbl2=document.createElement('table'); tempTbl2.width="100%"; tempTbl2.insertRow(0); for (opo=0; opo<groupingArray[worm][1].length; opo++) { tempTbl2.firstChild.appendChild(groupingArray[worm][1][opo][1]); if (postOrder=='up') { for (lis=groupingArray[worm][1][opo][2].length-1; lis>=0; lis--) { tempTbl2.firstChild.appendChild(groupingArray[worm][1][opo][2][lis]); } } else { for (lis=0; lis<groupingArray[worm][1][opo][2].length; lis++) { tempTbl2.firstChild.appendChild(groupingArray[worm][1][opo][2][lis]); } } if (opo!=groupingArray[worm][1].length-1) { keep=document.createElement('tr'); keep2=document.createElement('td'); keep.appendChild(keep2); keep2.appendChild(document.createElement('hr')); keep.style.height='10px'; keep2.colSpan=2; tempTbl2.firstChild.appendChild(keep); } } tempTbl.rows[0].cells[0].appendChild(tempTbl2); groupedDiv.appendChild(tempTbl); tempDiv=document.createElement('div'); tempDiv.style.height=boardDivisionHeight; groupedDiv.appendChild(tempDiv); }
}
// --> </script>
Preview: www.wormocodes.com/index.cgi?action=recent&recentgroup
|
|
|
Post by Wormopolis on Feb 11, 2010 3:01:31 GMT -8
need to figure out what the delay is before accepting it into database.
|
|