|
Post by Wormopolis on Dec 20, 2008 3:58:15 GMT -8
Browser tested: IE and FF placement: board footer
Changes sub-boards from a list into specified number of columns.
<script type="text/javascript"> <!-- // Sub-boards into columns v2.0 // By Wormopolis - www.wormocodes.com // Please keep header intact, no reposting
var column_setup=3; //edit how many columns you want var showLastPost=true; var newPostColor="#666666";
// No need to edit below unless you know what you are doing (function(){ if (pb_action=='boardindex') { sub_array = new Array(); iTd=document.getElementsByTagName('td'); for (i=0; i<iTd.length; i++) { if (iTd[i].width=='66%' && iTd[i].className=='windowbg2' ) { extra=""; if (showLastPost && iTd[i].nextSibling.nextSibling.nextSibling.firstChild.innerHTML) extra="last post " + iTd[i].nextSibling.nextSibling.nextSibling.innerHTML; sub_array[sub_array.length]=new Array(); sub_array[sub_array.length-1][0]=iTd[i].innerHTML+extra; sub_boards_parent=iTd[i].parentNode; grr=sub_boards_parent.firstChild; sub_array[sub_array.length-1][1]=grr.innerHTML.match(/\[\*\]/) ? true : false; sub_boards_parent.removeChild(grr); grr=sub_boards_parent.firstChild; sub_boards_parent.removeChild(grr); sub_boards_parent.style.display="none"; } } header_kills=sub_boards_parent.parentNode.firstChild.childNodes; new_header=sub_boards_parent.parentNode.firstChild.cloneNode(true); sub_boards_parent.parentNode.firstChild.removeChild(header_kills[3]); sub_boards_parent.parentNode.firstChild.removeChild(header_kills[2]); sub_boards_parent.parentNode.firstChild.removeChild(header_kills[1]); sub_boards_parent.parentNode.cellPadding=0; sub_boards_parent.parentNode.cellSpacing=0; sub_boards_parent.parentNode.firstChild.firstChild.colSpan=column_setup; var newRow=document.createElement('tr'); for (j=0; j<sub_array.length; j++) { newCell=document.createElement('td'); newCell.className='windowbg2'; newCell.style.backgroundColor=(sub_array[j][1] ? newPostColor : ''); newCell.vAlign='top'; newCell.innerHTML=sub_array[j][0]; newRow.appendChild(newCell); if ((j+1)%column_setup==0 && (j+1)!=sub_array.length) { sub_boards_parent.parentNode.appendChild(newRow); newRow=document.createElement('tr'); } } if (j%column_setup!=0) { for (k=0; k<(column_setup-(sub_array.length%column_setup)); k++) { newCell=document.createElement('td'); newCell.className='windowbg2'; newRow.appendChild(newCell); } } sub_boards_parent.parentNode.appendChild(newRow); } })(); // --> </script>
Preview: coming soon
|
|
|
Post by Wormopolis on Dec 28, 2009 2:00:33 GMT -8
added in ability to show last post of subboard in the cell.
|
|
aeralyn
Not New Member
Posts: 3
aeralyn said 0 great things
|
Post by aeralyn on Jul 14, 2012 10:08:27 GMT -8
[replyingto=admin]%3Cfont%20color%3D%22FF5500%22%3EWormopo%3Cfont%20color%3D%22FFFFFF%22%3El%3C/font%3Eis%3C/font%3E[/replyingto]I like the code and how it looks, but was wondering if it was possible to set it up with a space between the columns or at least making it an option?
|
|
|
Post by Wormopolis on Jul 14, 2012 11:51:23 GMT -8
lemme see what you got...
|
|
aeralyn
Not New Member
Posts: 3
aeralyn said 0 great things
|
Post by aeralyn on Jul 14, 2012 15:34:57 GMT -8
Oceanas.proboards.comI put it in the earth board. It looks fine lol I'm probably just being overly picky lol
|
|
|
Post by Wormopolis on Jul 14, 2012 17:17:37 GMT -8
after this line
sub_boards_parent.parentNode.appendChild(newRow);
add this
sub_boards_parent.parentNode.parentNode.cellSpacing=3;
see if that works
|
|
aeralyn
Not New Member
Posts: 3
aeralyn said 0 great things
|
Post by aeralyn on Jul 14, 2012 18:29:39 GMT -8
Yes works! Thank you very much!
|
|
|
Post by Wormopolis on Nov 3, 2012 21:09:23 GMT -8
version update 2.0: added ability to change color of sub-board if there is a new post in that board
also redid the location check and encapsulated code in a function
|
|