Post by $©Ø®Þ!@Ω™ on Aug 30, 2006 0:12:34 GMT
Code Name: Post Splitter with Head/Base Image v2
Written By: Scorpian
Written for: ProBoards version 4
Cross-Browser: Yes
Placement: Global or Board Footers
Alright, it's here! Version 2 of my post splitter. The main difference between version 1 and version 2 is the fact that version 2 is coded in much more reliable and speedy DOM as opposed to HTML based. However, I did add in a new feature. You have the option to show or hide the author/topic row.
As always, the code is tested and cross-browser. I vigourously tested it with polls, and it all works perfectly fine. It also loads hella faster than v1. Any questions? Feel free to ask. Here is the code:
Enjoy
Written By: Scorpian
Written for: ProBoards version 4
Cross-Browser: Yes
Placement: Global or Board Footers
Alright, it's here! Version 2 of my post splitter. The main difference between version 1 and version 2 is the fact that version 2 is coded in much more reliable and speedy DOM as opposed to HTML based. However, I did add in a new feature. You have the option to show or hide the author/topic row.
As always, the code is tested and cross-browser. I vigourously tested it with polls, and it all works perfectly fine. It also loads hella faster than v1. Any questions? Feel free to ask. Here is the code:
<script type='text/javascript'>
/* Post Splitter with Head/Base images v2
By Scorpian: http://roddyinnovations.com */
/*/_| Edit These |_\*/
var riHead = 'URL_OF_HEAD_IMAGE'; // URL of head image
var riBase = 'URL_OF_BASE_IMAGE'; // URL of base image
var riGap = '25'; // Height of gap
var riAuthor = 'yes'; // Show "author|topics" row? 'yes' or 'no' only
/*/_| Do Not Edit |_\*/
var riTable = document.getElementsByTagName('table');
var headImg = document.createElement('img');
var baseImg = document.createElement('img');
headImg.src = riHead; baseImg.src = riBase;
var tehTab = document.createElement('table');
var tehBody = document.createElement('tbody');
tehTab.cellSpacing = 1; tehTab.cellPadding = 4;
tehTab.className = 'bordercolor'; tehTab.width = '100%';
var gapDiv = document.createElement('div');
gapDiv.style.height = riGap;
var end = false; var insBef = false;
if(location.href.match(/action=display/i)){
for(a=0; a<riTable.length; a++){
if(riTable[a].cellSpacing == 1 && riTable[a].cellPadding == 4 && riTable[a].rows[0].cells[0].colSpan == 2){
riTable[a-1].style.backgroundColor = 'transparent';
riTable[a].className = 'bordercolor';
var newCell = riTable[a-1].insertRow(-1).insertCell(0);
for(b=2; b<riTable[a].rows.length; b++){
if(riTable[a].rows[b-1].cells[0].innerHTML.match(/Poll/i)){
var insBef = true;
newCell.appendChild(gapDiv.cloneNode(true));
}
if(riTable[a].rows[b].cells[0].className.match(/windowbg/i) && !riTable[a].rows[b-1].cells[0].innerHTML.match(/Poll/i)){
var newTable = tehTab.cloneNode(true);
var newTab = tehBody.cloneNode(true);
if(riTable[a].rows[b-1].cells[0].className == 'catbg' && riTable[a].rows[b-2].cells[0].className == 'titlebg'){
newTab.appendChild(riTable[a].rows[b-2].cloneNode(true));
riTable[a].rows[b-2].style.display = 'none';
if(riAuthor == 'yes'){ newTab.appendChild(riTable[a].rows[b-1].cloneNode(true)); }
riTable[a].rows[b-1].style.display = 'none';
}
if(insBef){
newTab.appendChild(riTable[a].rows[0].cloneNode(true));
riTable[a].rows[0].style.display = 'none';
if(riAuthor == 'yes'){ newTab.appendChild(riTable[a].rows[3].cloneNode(true)); }
riTable[a].rows[3].style.display = 'none';
}
newTab.appendChild(riTable[a].rows[b].cloneNode(true));
riTable[a].rows[b].style.display = 'none';
if(riTable[a].rows[b+1] && riTable[a].rows[b+1].cells[0].className == 'titlebg'){
var end = true;
newTab.appendChild(riTable[a].rows[b+1].cloneNode(true));
riTable[a].rows[b+1].style.display = 'none';
if(riTable[a].rows[b+2]){
newTab.appendChild(riTable[a].rows[b+2].cloneNode(true));
riTable[a].rows[b+2].style.display = 'none';
}
}
newCell.appendChild(headImg.cloneNode(true));
newTable.appendChild(newTab);
newCell.appendChild(newTable);
newCell.appendChild(baseImg.cloneNode(true));
if(!end){ newCell.appendChild(gapDiv.cloneNode(true)); }
}
}
if(insBef){
riTable[a].parentNode.insertBefore(headImg.cloneNode(true),riTable[a]);
riTable[a].parentNode.insertBefore(baseImg.cloneNode(true),riTable[a].nextSibling);
}else{
riTable[a].parentNode.parentNode.style.display = 'none';
}
break;
}
}
}
</script>
Enjoy