Post by Peter on Apr 29, 2006 13:35:10 GMT
This will split the posts and add a head / base image to the posts.
<script type="text/javascript">
<!--
/*
Split Posts With Head / Base Images
Created By Peter
Copyright © 2005 - expertsonline.pixeldepth.net
All Rights Reserved
This code may not be redistributed without express permission from the creator.
This header must stay intact at all times.
*/
// Set gap size here
var iGapSize = 25;
// Head image url
var iHeadImg = "URL";
// Base image url
var iBaseImg = "URL";
function bTable(tbobj, att){
var nTable = document.createElement("table");
for(a = 0; a < att.length; a ++){
nTable.setAttribute(att[0], att[1]);
}
nTable.appendChild(tbobj);
return nTable;
}
function splitPosts(){
var obj = new Object();
var gPoll = false;
var iInc = 0, cInc = 0, oInc = 0;
var attArray = [["width", "100%"], ["cellSpacing", 1], ["cellPadding", 4]];
var docFragment = document.createDocumentFragment();
var iTable = document.getElementsByTagName("table");
for(t = 0; t < iTable.length; t ++){
if(iTable.item(t).cellPadding == "4" && iTable.item(t).cellSpacing == "1"){
var iRows = iTable.item(t).rows;
for(r = 0; r < iRows.length; r ++){
r = (r < 0)? 0 : r;
var nTb = document.createElement("tbody");
var rNode = iRows.item(r);
if(rNode && rNode.firstChild.colSpan == "2" && rNode.firstChild.className == "titlebg" && r == 0){
nTb.appendChild(rNode);
obj[(iInc ++)] = {
tobj: bTable(nTb, attArray)
};
r --;
}
if(rNode && rNode.firstChild.width == "20%" && rNode.innerHTML.match(/>Poll Question: /)){
gPoll = true;
nTb.appendChild(rNode);
obj[(iInc ++)] = {
tobj: bTable(nTb, attArray)
};
r --;
oInc ++;
}
if(rNode && rNode.firstChild.colSpan == "2" && rNode.firstChild.className == "windowbg2"){
// lets nest that form correctly so people can vote
if(rNode.firstChild.getElementsByTagName("form").item(0) && !document.all){
var pForm = rNode.firstChild.getElementsByTagName("form").item(0);
var fNode = pForm.cloneNode(false);
pForm.parentNode.removeChild(pForm);
while(rNode.firstChild.hasChildNodes()){
pForm.appendChild(rNode.firstChild.childNodes.item(0));
}
rNode.firstChild.appendChild(pForm);
}
obj[(iInc - 1)].tobj.firstChild.appendChild(rNode);
r --;
oInc ++;
}
if(rNode && rNode.firstChild.className == "catbg" && rNode.firstChild.innerHTML.match(/Author/)){
nTb.appendChild(rNode);
obj[(iInc ++)] = {
tobj: bTable(nTb, attArray)
};
r --;
}
if(rNode && rNode.firstChild.width == "20%" && rNode.firstChild.className.match(/^windowbg/i) && rNode.firstChild.innerHTML.match(/member is|guest/i)){
if(cInc == 0){
obj[(iInc - 1)].tobj.firstChild.appendChild(rNode);
r --;
} else {
nTb.appendChild(rNode);
obj[(iInc ++)] = {
tobj: bTable(nTb, attArray)
};
}
cInc ++;
r --;
oInc ++;
}
}
iTable.item(t).parentNode.parentNode.parentNode.id = "marker";
}
}
function createImg(url){
var iImg = document.createElement("img");
iImg.src = url;
return iImg;
}
var iCount = 0;
for(var o in obj){
var hDiv = document.createElement("div");
var nDiv = document.createElement("div");
hDiv.style.height = iGapSize;
nDiv.className = "bordercolor";
nDiv.style.width = "100%";
oInc -= (gPoll)? 1 : 0;
gPoll = false;
if(o > 0 && o <= oInc){
nDiv.appendChild(createImg(iHeadImg));
}
nDiv.appendChild(obj[o].tobj);
if(o > 0 && o <= oInc){
nDiv.appendChild(createImg(iBaseImg));
}
if(iCount > 0){
docFragment.appendChild(hDiv);
}
docFragment.appendChild(nDiv);
iCount ++;
}
if(document.getElementById("marker")){
var iMarker = document.getElementById("marker");
iMarker.parentNode.parentNode.insertBefore(docFragment, iMarker.parentNode);
}
}
if(location.href.match(/action=display/i)){
splitPosts();
}
//-->
</script>
Just change the values in bold.
If you are using another split post code, then remove it.
Goes into your global footer.
<script type="text/javascript">
<!--
/*
Split Posts With Head / Base Images
Created By Peter
Copyright © 2005 - expertsonline.pixeldepth.net
All Rights Reserved
This code may not be redistributed without express permission from the creator.
This header must stay intact at all times.
*/
// Set gap size here
var iGapSize = 25;
// Head image url
var iHeadImg = "URL";
// Base image url
var iBaseImg = "URL";
function bTable(tbobj, att){
var nTable = document.createElement("table");
for(a = 0; a < att.length; a ++){
nTable.setAttribute(att[0], att[1]);
}
nTable.appendChild(tbobj);
return nTable;
}
function splitPosts(){
var obj = new Object();
var gPoll = false;
var iInc = 0, cInc = 0, oInc = 0;
var attArray = [["width", "100%"], ["cellSpacing", 1], ["cellPadding", 4]];
var docFragment = document.createDocumentFragment();
var iTable = document.getElementsByTagName("table");
for(t = 0; t < iTable.length; t ++){
if(iTable.item(t).cellPadding == "4" && iTable.item(t).cellSpacing == "1"){
var iRows = iTable.item(t).rows;
for(r = 0; r < iRows.length; r ++){
r = (r < 0)? 0 : r;
var nTb = document.createElement("tbody");
var rNode = iRows.item(r);
if(rNode && rNode.firstChild.colSpan == "2" && rNode.firstChild.className == "titlebg" && r == 0){
nTb.appendChild(rNode);
obj[(iInc ++)] = {
tobj: bTable(nTb, attArray)
};
r --;
}
if(rNode && rNode.firstChild.width == "20%" && rNode.innerHTML.match(/>Poll Question: /)){
gPoll = true;
nTb.appendChild(rNode);
obj[(iInc ++)] = {
tobj: bTable(nTb, attArray)
};
r --;
oInc ++;
}
if(rNode && rNode.firstChild.colSpan == "2" && rNode.firstChild.className == "windowbg2"){
// lets nest that form correctly so people can vote
if(rNode.firstChild.getElementsByTagName("form").item(0) && !document.all){
var pForm = rNode.firstChild.getElementsByTagName("form").item(0);
var fNode = pForm.cloneNode(false);
pForm.parentNode.removeChild(pForm);
while(rNode.firstChild.hasChildNodes()){
pForm.appendChild(rNode.firstChild.childNodes.item(0));
}
rNode.firstChild.appendChild(pForm);
}
obj[(iInc - 1)].tobj.firstChild.appendChild(rNode);
r --;
oInc ++;
}
if(rNode && rNode.firstChild.className == "catbg" && rNode.firstChild.innerHTML.match(/Author/)){
nTb.appendChild(rNode);
obj[(iInc ++)] = {
tobj: bTable(nTb, attArray)
};
r --;
}
if(rNode && rNode.firstChild.width == "20%" && rNode.firstChild.className.match(/^windowbg/i) && rNode.firstChild.innerHTML.match(/member is|guest/i)){
if(cInc == 0){
obj[(iInc - 1)].tobj.firstChild.appendChild(rNode);
r --;
} else {
nTb.appendChild(rNode);
obj[(iInc ++)] = {
tobj: bTable(nTb, attArray)
};
}
cInc ++;
r --;
oInc ++;
}
}
iTable.item(t).parentNode.parentNode.parentNode.id = "marker";
}
}
function createImg(url){
var iImg = document.createElement("img");
iImg.src = url;
return iImg;
}
var iCount = 0;
for(var o in obj){
var hDiv = document.createElement("div");
var nDiv = document.createElement("div");
hDiv.style.height = iGapSize;
nDiv.className = "bordercolor";
nDiv.style.width = "100%";
oInc -= (gPoll)? 1 : 0;
gPoll = false;
if(o > 0 && o <= oInc){
nDiv.appendChild(createImg(iHeadImg));
}
nDiv.appendChild(obj[o].tobj);
if(o > 0 && o <= oInc){
nDiv.appendChild(createImg(iBaseImg));
}
if(iCount > 0){
docFragment.appendChild(hDiv);
}
docFragment.appendChild(nDiv);
iCount ++;
}
if(document.getElementById("marker")){
var iMarker = document.getElementById("marker");
iMarker.parentNode.parentNode.insertBefore(docFragment, iMarker.parentNode);
}
}
if(location.href.match(/action=display/i)){
splitPosts();
}
//-->
</script>
Just change the values in bold.
If you are using another split post code, then remove it.
Goes into your global footer.