Post by CFP wolf on Sept 28, 2009 14:26:37 GMT -5
This code resizes your forum to a custom width, gives you Outer Table borders, splits your categories, removes the "Forum Name" bar and replaces it with the Category Title, gives a class name for the category Name cell, centers the "Mark All Boards Read" icon image, It's a sticky/Normal Thread Splitter(w/adjustable Announcement divider height and background class), a post/Poll Splitter, it separates divider/spacing heights for all three splitters above, it has quick Reply Customize, an adjustable Quick Reply text area size, it can replace "Message:" text with your own or remove completely, it centers the "Info Center" title, text area and buttons and, of course, gives you two extra buttons, Preview and Reset (also centered).
Quick Reply Customize code has NO loops. Straight DOM. Fast.
Multiple Skin Capable.
Instructions and code for multiple skins, will be explained later.
Unhosted Code!
No worries of server problems, since you will always have the code!
I may make a hosted version available, but will ALWAYS provide the raw code. This code looks large, but it is optimized as best as I can. Only the code that needs to run, will run. Execution speed should not be an issue.
* You have the option to enable/disable these features.
Preparation for Code Use: Remove or disable all of the following...
Category, Sticky and Post splitter codes.
Head and Base image codes.
Forum Resize code.*
Outer Table border code.*
Quick Reply customization codes.*
* Remove only if you have enabled these options in this code
For best results, place near the top of your Global Footers. You may have to put some of your other codes above or below this one if you have problems. But there should be a "sweet spot" somewhere. Most users shouldn't run into too many code compatiblility issues. This is only an issue if your forum has A LOT of code. I have worked hard to make it play nice. But, of course, I can not control other people's quality of codes! lol
Variable Explanations:
(Edit the Maroon portions.)
var resizeForum=[1,778]; // Resize Forum? 1=Yes, 0=No , Forum width.
var outerBorder=[1,"4646A4"]; // Outer Table Borders? 1=Yes, 0=No, Border Color.
You have two options in each of the above variables.
In the first option, Use 1=Yes, 0=No. This enables/disables these options.
The second, you specify your forum width in pixels and the color for the Outer Table borders.
var pdivH=25; // Post divider height.
var cdivH=25; // Category Divider Height.
var sdivH=25; // Sticky/Thread Divider Height.
Enter the "gap" height in pixels for the above splitter areas.
var head="URL TO HEAD IMAGE";
var base="URL TO BASE IMAGE";
var stickyImg="URL TO STICKY IMAGE";
var normImg="URL TO NORMAL IMAGE";
Do I need to explain these? lol
Enter the FULL URL to the respective image locations for all the above.
If you do not have sticky/normal images yet, don't worry. The code will use your Head image instead!
NOTE:
In order for the sticky splitter to work, your "sticky" and "stickylock" icons, MUST have the word "sticky" somewhere in their name. You will not get any errors, but it will not split sticky threads if you do not do this.
var catClass="titlebg"; // Class of Category Name Cell.
Enter the CSS Class you would like your category name cell to be. (titlebg, catbg or your own. Default is titlebg)
This means you can have a background image or color or just about anything!
var aClass="titlebg"; // Annnouncement Divider Background class.
Enter a class for your Announcement divider background. (catbg,titlebg etc.)
var aHeight=10; // Announcement Divider Height.
The Height in pixels you would like the Announcement divider to be. This separates the Announcements from the Sticky threads in the "Sticky" section.
var qrCustom=1; // Quick Reply Customize? 1=Yes, 0=No.
Enable/disable the Quick Reply Customizations.
These last three variables are only used if qrCustom=1.
var qrMess=""; // Replace "Message:" with this Text.
Replaces "Message:" line with your text here.
Replace with "" to hide the "Message:" line. (default)
var qrWidth=631; // Desired Width (Default is 631)
var qrHeight=227; // Desired Height (Default is 87)
Specify preferred height and width (Pixels) of the Quick Reply text area.
The same code is used for mutiple skins with the exception of the variable section.
Replace this:
var head="URL TO HEAD IMAGE";
var base="URL TO BASE IMAGE";
var stickyImg="URL TO STICKY IMAGE";
var normImg="URL TO NORMAL IMAGE";
With this:
if(pb_skinid=="1"){
var head="URL TO SKIN 1 HEAD IMAGE"; // Head image.
var base="URL TO SKIN 1 BASE IMAGE"; // Base image.
var stickyImg="URL TO SKIN 1 STICKY IMAGE";
var normImg="URL TO SKIN 1 NORMAL IMAGE";
}
else if(pb_skinid=="2"){
var head="URL TO SKIN 2 HEAD IMAGE"; // Head image.
var base="URL TO SKIN 2 BASE IMAGE"; // Base image.
var stickyImg="URL TO SKIN 2 STICKY IMAGE";
var normImg="URL TO SKIN 2 NORMAL IMAGE";
}
Enjoy!!!
<script type="text/javascript">
<!--
/* ProBoard Forum Customize v1.0 by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var resizeForum=[1,778]; // Resize Forum? 1=Yes, 0=No , Forum width.
var outerBorder=[1,"0060BF"]; // Outer Table Borders? 1=Yes, 0=No, Border Color.
var pdivH=25; // Post Divider Height.
var cdivH=25; // Category Divider Height.
var sdivH=25; // Sticky/Thread Divider Height.
var head="URL TO HEAD IMAGE";
var base="URL TO BASE IMAGE";
var stickyImg="URL TO STICKY IMAGE";
var normImg="URL TO NORMAL IMAGE";
var catClass="titlebg"; // Class of Category Name Cell.
var aClass="titlebg"; // Annnouncement Divider Background class.
var aHeight=10; // Announcement Divider Height.
var qrCustom=1; // Quick Reply Customize? 1=Yes, 0=No.
var qrMess=""; // Replace "Message:" with this Text.
var qrWidth=631; // Desired Width (Default is 631)
var qrHeight=227; // Desired Height (Default is 87)
// DO NOT EDIT BELOW
var tb=document.getElementsByTagName("table"); var rTb=0;
var pLoc=location.href; var rLoc=document.title; var splitType=0; var ssT="";
var mM=/password\sprotected|error\shas\soccurred|admin\shome|login|preview|move\sthread|search\sresult/i;
if(rLoc.match(mM)||document.ammForm||document.postForm){splitType=0;
}else if(!pLoc.match(/board=/i)&&pLoc.match(/=home|(\.com\/|(\.cgi)|\?)$|\.cgi\#/i)){splitType=1; ssT=/<b>Forum\sName/i; pdivH=cdivH;
}else if(pLoc.match(/board=/i)&& !pLoc.match(/thread=/i)){splitType=2; ssT=/\[Search\sThis/; pdivH=sdivH;
}else if(pLoc.match(/thread=/i)){splitType=3; ssT=/<b>(Author|Poll)/i;}
stickyImg=cI(stickyImg); normImg=cI(normImg);
function cI(h){var m=(h.match(/^http:\/\//i))?h:head; return m;}
if(splitType){
var sDiv=document.createElement("div"); var nDiv=sDiv.cloneNode(false);
sDiv.style.height=pdivH+"px"; nDiv.align="center"; var tbA="";
var stickySplit=0; var tbN=""; var nT=""; var te=(splitType==3)?1:0;
for(var x=0;x<tb.length;x++){
with(tb[x]){if(cellPadding==4&&width=="100%"&&rows[te].innerHTML.match(ssT)){break;}}
}
if(tb[x]){
tb[x-1].style.backgroundColor="transparent"; tb[x].className="bordercolor";
tbA=tb[x]; var tbP=tbA.parentNode;
var nTop=tb[x].rows[te].cloneNode(true); tr=tbA.rows;
}else{splitType=0;}
if(splitType==1){ x=1;
while(tr[x+1]){
if(tr[x].cells.length==1){ makeTable();
with(nTop.firstChild){className=catClass; innerHTML=tr[x].firstChild.innerHTML;}
aD(nT,nTop,1);
} x++;
while(tr[x]&&tr[x].cells.length==5){nT.appendChild(tr[x]);}
if(tr[x]&&tr[x].innerHTML.match(/markallb/i)){tr[x].firstChild.align="center"; nT.appendChild(tr[x]);}
aD(tbP,tbN,1); if(tr[x+1]){doDiv(tbP);}
} x++; rTb=1;
}else if(splitType==2&& !tbA.innerHTML.match(/no\smessages/i)){
stickySplit=1; var gotSticky=0;
for(x=2;x<tr.length;x++){ makeTable();
if(x==2){
aD(nT,tr[1]);
while(tr[x]&&(tr[x].innerHTML.match(/sticky/i)||(tr[x].cells.length==1))){
var tC=tr[x].cells;
if(tC&&tC.length==1){with(tC[0]){className=aClass; height=aHeight+"px";}}
nT.appendChild(tr[x]); gotSticky++;
} if(gotSticky){aD(tbP,tbN,1); doDiv(tbP);continue;}
}else{x--;
aD(nT,tr[0],1); aD(nT,tr[1],1);
while(tr[x]){nT.appendChild(tr[x]);}
aD(tbP,tbN,1); if(!tr[x]){break;}
}
}
rTb=1; var pDiv=document.createElement("div");
var tbM=tbP.parentNode.parentNode.parentNode;
with(pDiv){align="center"; innerHTML='<img src="'+stickyImg+'" />';}
if(stickyImg&& gotSticky){tbM.parentNode.insertBefore(pDiv,tbM);}
}else if(splitType==3){ var rC=0; var nx=2;
for(x=1;x<tr.length;x++){ makeTable();
if(x==1){
if(tr[x].innerHTML.match(/poll\sq/i)){x=3; nx=4; aD(nT,tr[1],1); aD(nT,tr[2],1);}else{continue;}
}else{
if(x==nx){aD(nT,tr[0],1);aD(nT,tr[nx-1],1);}
aD(nT,tr[x],1);
while(tr[x+1]&&tr[x+1].innerHTML.match(/\[Search\sThis|Admin\sFunctions:/)){nT.appendChild(tr[x+1]); rC=1;}
} aD(tbP,tbN,1); if(rC){break;}else{doDiv(tbP);}
} rTb=1;
} if(rTb){tbP.removeChild(tbA);}
} var m=/<img/i;
for(x=0;x<tb.length;x++){
with(tb[x]){
if(resizeForum[0]&&width=="92%"){width=resizeForum[1]+"px";}
if(outerBorder[0]&&width=="100%"&&cellSpacing=="1"&& !parentNode.nodeName.match(/font/i)){style.border= "1px solid #"+outerBorder[1];}
if(style.display!="none"&&className=="bordercolor"&&width=="100%"&&cellPadding=="0"){
var tDiv=previousSibling;
if(!(tDiv&&tDiv.nodeName.match(/div/i)&&tDiv.innerHTML.match(m) )){makeDiv(head,tb[x]);}
makeDiv(base,nextSibling);
}
}
}
if(qrCustom){
var td=document.getElementsByName("message")[0];
if(td&& !(document.searchForm||document.postForm||pLoc.match(/=emailall/i))){
with(td.style){height=qrHeight, width=qrWidth;}
td.parentNode.insertBefore(document.createElement("br"), td.nextSibling);
var qrP=td.parentNode; var qb=qrP.parentNode.parentNode.parentNode.parentNode.parentNode;
qb.rows[1].align="center"; qb.rows[0].cells[0].align="center";
qrP.parentNode.firstChild.data=qrMess; var nFont= document.createElement("font");
nFont.innerHTML='<input name="nextaction" type="hidden" value="post"><input type="submit" accesskey="p" value="Preview" onclick="qrP.nextaction.value=\'preview\'; return true;" /> <input type="reset" value="Reset" accesskey="r" onClick="reset">';
qrP.insertBefore(nFont,qrP.lastChild); qrP.removeChild(qrP.lastChild);
}
}
function makeDiv(dSrc,nTb){
var nDiv=document.createElement("div");
with(nDiv){align="center"; innerHTML='<img src="'+dSrc+'" />';}
(nTb)? nTb.parentNode.insertBefore(nDiv,nTb): tb[x].parentNode.appendChild(nDiv);
}
function makeTable(){
tbN=tbA.cloneNode(false);
tbN.appendChild(tbA.firstChild.cloneNode(false)); nT=tbN.firstChild;
}
function aD(aN,aS,tf){aN.appendChild(aS.cloneNode(tf));}
function doDiv(sT){
for(var i=0;i<3;i++){
var sD=((i==1)?sDiv:nDiv).cloneNode(false);
var hI=(stickySplit&&normImg)?normImg:head;
if(i!=1){sD.innerHTML='<img src="'+((i)?hI:base)+'" />';}
sT.appendChild(sD);
}
}
//-->
</script>
Put the code in your Global Footer.
Quick Reply Customize code has NO loops. Straight DOM. Fast.
Multiple Skin Capable.
Instructions and code for multiple skins, will be explained later.
Unhosted Code!
No worries of server problems, since you will always have the code!
I may make a hosted version available, but will ALWAYS provide the raw code. This code looks large, but it is optimized as best as I can. Only the code that needs to run, will run. Execution speed should not be an issue.
* You have the option to enable/disable these features.
Preparation for Code Use: Remove or disable all of the following...
Category, Sticky and Post splitter codes.
Head and Base image codes.
Forum Resize code.*
Outer Table border code.*
Quick Reply customization codes.*
* Remove only if you have enabled these options in this code
For best results, place near the top of your Global Footers. You may have to put some of your other codes above or below this one if you have problems. But there should be a "sweet spot" somewhere. Most users shouldn't run into too many code compatiblility issues. This is only an issue if your forum has A LOT of code. I have worked hard to make it play nice. But, of course, I can not control other people's quality of codes! lol
Variable Explanations:
(Edit the Maroon portions.)
var resizeForum=[1,778]; // Resize Forum? 1=Yes, 0=No , Forum width.
var outerBorder=[1,"4646A4"]; // Outer Table Borders? 1=Yes, 0=No, Border Color.
You have two options in each of the above variables.
In the first option, Use 1=Yes, 0=No. This enables/disables these options.
The second, you specify your forum width in pixels and the color for the Outer Table borders.
var pdivH=25; // Post divider height.
var cdivH=25; // Category Divider Height.
var sdivH=25; // Sticky/Thread Divider Height.
Enter the "gap" height in pixels for the above splitter areas.
var head="URL TO HEAD IMAGE";
var base="URL TO BASE IMAGE";
var stickyImg="URL TO STICKY IMAGE";
var normImg="URL TO NORMAL IMAGE";
Do I need to explain these? lol
Enter the FULL URL to the respective image locations for all the above.
If you do not have sticky/normal images yet, don't worry. The code will use your Head image instead!
NOTE:
In order for the sticky splitter to work, your "sticky" and "stickylock" icons, MUST have the word "sticky" somewhere in their name. You will not get any errors, but it will not split sticky threads if you do not do this.
var catClass="titlebg"; // Class of Category Name Cell.
Enter the CSS Class you would like your category name cell to be. (titlebg, catbg or your own. Default is titlebg)
This means you can have a background image or color or just about anything!
var aClass="titlebg"; // Annnouncement Divider Background class.
Enter a class for your Announcement divider background. (catbg,titlebg etc.)
var aHeight=10; // Announcement Divider Height.
The Height in pixels you would like the Announcement divider to be. This separates the Announcements from the Sticky threads in the "Sticky" section.
var qrCustom=1; // Quick Reply Customize? 1=Yes, 0=No.
Enable/disable the Quick Reply Customizations.
These last three variables are only used if qrCustom=1.
var qrMess=""; // Replace "Message:" with this Text.
Replaces "Message:" line with your text here.
Replace with "" to hide the "Message:" line. (default)
var qrWidth=631; // Desired Width (Default is 631)
var qrHeight=227; // Desired Height (Default is 87)
Specify preferred height and width (Pixels) of the Quick Reply text area.
The same code is used for mutiple skins with the exception of the variable section.
Replace this:
var head="URL TO HEAD IMAGE";
var base="URL TO BASE IMAGE";
var stickyImg="URL TO STICKY IMAGE";
var normImg="URL TO NORMAL IMAGE";
With this:
if(pb_skinid=="1"){
var head="URL TO SKIN 1 HEAD IMAGE"; // Head image.
var base="URL TO SKIN 1 BASE IMAGE"; // Base image.
var stickyImg="URL TO SKIN 1 STICKY IMAGE";
var normImg="URL TO SKIN 1 NORMAL IMAGE";
}
else if(pb_skinid=="2"){
var head="URL TO SKIN 2 HEAD IMAGE"; // Head image.
var base="URL TO SKIN 2 BASE IMAGE"; // Base image.
var stickyImg="URL TO SKIN 2 STICKY IMAGE";
var normImg="URL TO SKIN 2 NORMAL IMAGE";
}
Enjoy!!!
<script type="text/javascript">
<!--
/* ProBoard Forum Customize v1.0 by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
var resizeForum=[1,778]; // Resize Forum? 1=Yes, 0=No , Forum width.
var outerBorder=[1,"0060BF"]; // Outer Table Borders? 1=Yes, 0=No, Border Color.
var pdivH=25; // Post Divider Height.
var cdivH=25; // Category Divider Height.
var sdivH=25; // Sticky/Thread Divider Height.
var head="URL TO HEAD IMAGE";
var base="URL TO BASE IMAGE";
var stickyImg="URL TO STICKY IMAGE";
var normImg="URL TO NORMAL IMAGE";
var catClass="titlebg"; // Class of Category Name Cell.
var aClass="titlebg"; // Annnouncement Divider Background class.
var aHeight=10; // Announcement Divider Height.
var qrCustom=1; // Quick Reply Customize? 1=Yes, 0=No.
var qrMess=""; // Replace "Message:" with this Text.
var qrWidth=631; // Desired Width (Default is 631)
var qrHeight=227; // Desired Height (Default is 87)
// DO NOT EDIT BELOW
var tb=document.getElementsByTagName("table"); var rTb=0;
var pLoc=location.href; var rLoc=document.title; var splitType=0; var ssT="";
var mM=/password\sprotected|error\shas\soccurred|admin\shome|login|preview|move\sthread|search\sresult/i;
if(rLoc.match(mM)||document.ammForm||document.postForm){splitType=0;
}else if(!pLoc.match(/board=/i)&&pLoc.match(/=home|(\.com\/|(\.cgi)|\?)$|\.cgi\#/i)){splitType=1; ssT=/<b>Forum\sName/i; pdivH=cdivH;
}else if(pLoc.match(/board=/i)&& !pLoc.match(/thread=/i)){splitType=2; ssT=/\[Search\sThis/; pdivH=sdivH;
}else if(pLoc.match(/thread=/i)){splitType=3; ssT=/<b>(Author|Poll)/i;}
stickyImg=cI(stickyImg); normImg=cI(normImg);
function cI(h){var m=(h.match(/^http:\/\//i))?h:head; return m;}
if(splitType){
var sDiv=document.createElement("div"); var nDiv=sDiv.cloneNode(false);
sDiv.style.height=pdivH+"px"; nDiv.align="center"; var tbA="";
var stickySplit=0; var tbN=""; var nT=""; var te=(splitType==3)?1:0;
for(var x=0;x<tb.length;x++){
with(tb[x]){if(cellPadding==4&&width=="100%"&&rows[te].innerHTML.match(ssT)){break;}}
}
if(tb[x]){
tb[x-1].style.backgroundColor="transparent"; tb[x].className="bordercolor";
tbA=tb[x]; var tbP=tbA.parentNode;
var nTop=tb[x].rows[te].cloneNode(true); tr=tbA.rows;
}else{splitType=0;}
if(splitType==1){ x=1;
while(tr[x+1]){
if(tr[x].cells.length==1){ makeTable();
with(nTop.firstChild){className=catClass; innerHTML=tr[x].firstChild.innerHTML;}
aD(nT,nTop,1);
} x++;
while(tr[x]&&tr[x].cells.length==5){nT.appendChild(tr[x]);}
if(tr[x]&&tr[x].innerHTML.match(/markallb/i)){tr[x].firstChild.align="center"; nT.appendChild(tr[x]);}
aD(tbP,tbN,1); if(tr[x+1]){doDiv(tbP);}
} x++; rTb=1;
}else if(splitType==2&& !tbA.innerHTML.match(/no\smessages/i)){
stickySplit=1; var gotSticky=0;
for(x=2;x<tr.length;x++){ makeTable();
if(x==2){
aD(nT,tr[1]);
while(tr[x]&&(tr[x].innerHTML.match(/sticky/i)||(tr[x].cells.length==1))){
var tC=tr[x].cells;
if(tC&&tC.length==1){with(tC[0]){className=aClass; height=aHeight+"px";}}
nT.appendChild(tr[x]); gotSticky++;
} if(gotSticky){aD(tbP,tbN,1); doDiv(tbP);continue;}
}else{x--;
aD(nT,tr[0],1); aD(nT,tr[1],1);
while(tr[x]){nT.appendChild(tr[x]);}
aD(tbP,tbN,1); if(!tr[x]){break;}
}
}
rTb=1; var pDiv=document.createElement("div");
var tbM=tbP.parentNode.parentNode.parentNode;
with(pDiv){align="center"; innerHTML='<img src="'+stickyImg+'" />';}
if(stickyImg&& gotSticky){tbM.parentNode.insertBefore(pDiv,tbM);}
}else if(splitType==3){ var rC=0; var nx=2;
for(x=1;x<tr.length;x++){ makeTable();
if(x==1){
if(tr[x].innerHTML.match(/poll\sq/i)){x=3; nx=4; aD(nT,tr[1],1); aD(nT,tr[2],1);}else{continue;}
}else{
if(x==nx){aD(nT,tr[0],1);aD(nT,tr[nx-1],1);}
aD(nT,tr[x],1);
while(tr[x+1]&&tr[x+1].innerHTML.match(/\[Search\sThis|Admin\sFunctions:/)){nT.appendChild(tr[x+1]); rC=1;}
} aD(tbP,tbN,1); if(rC){break;}else{doDiv(tbP);}
} rTb=1;
} if(rTb){tbP.removeChild(tbA);}
} var m=/<img/i;
for(x=0;x<tb.length;x++){
with(tb[x]){
if(resizeForum[0]&&width=="92%"){width=resizeForum[1]+"px";}
if(outerBorder[0]&&width=="100%"&&cellSpacing=="1"&& !parentNode.nodeName.match(/font/i)){style.border= "1px solid #"+outerBorder[1];}
if(style.display!="none"&&className=="bordercolor"&&width=="100%"&&cellPadding=="0"){
var tDiv=previousSibling;
if(!(tDiv&&tDiv.nodeName.match(/div/i)&&tDiv.innerHTML.match(m) )){makeDiv(head,tb[x]);}
makeDiv(base,nextSibling);
}
}
}
if(qrCustom){
var td=document.getElementsByName("message")[0];
if(td&& !(document.searchForm||document.postForm||pLoc.match(/=emailall/i))){
with(td.style){height=qrHeight, width=qrWidth;}
td.parentNode.insertBefore(document.createElement("br"), td.nextSibling);
var qrP=td.parentNode; var qb=qrP.parentNode.parentNode.parentNode.parentNode.parentNode;
qb.rows[1].align="center"; qb.rows[0].cells[0].align="center";
qrP.parentNode.firstChild.data=qrMess; var nFont= document.createElement("font");
nFont.innerHTML='<input name="nextaction" type="hidden" value="post"><input type="submit" accesskey="p" value="Preview" onclick="qrP.nextaction.value=\'preview\'; return true;" /> <input type="reset" value="Reset" accesskey="r" onClick="reset">';
qrP.insertBefore(nFont,qrP.lastChild); qrP.removeChild(qrP.lastChild);
}
}
function makeDiv(dSrc,nTb){
var nDiv=document.createElement("div");
with(nDiv){align="center"; innerHTML='<img src="'+dSrc+'" />';}
(nTb)? nTb.parentNode.insertBefore(nDiv,nTb): tb[x].parentNode.appendChild(nDiv);
}
function makeTable(){
tbN=tbA.cloneNode(false);
tbN.appendChild(tbA.firstChild.cloneNode(false)); nT=tbN.firstChild;
}
function aD(aN,aS,tf){aN.appendChild(aS.cloneNode(tf));}
function doDiv(sT){
for(var i=0;i<3;i++){
var sD=((i==1)?sDiv:nDiv).cloneNode(false);
var hI=(stickySplit&&normImg)?normImg:head;
if(i!=1){sD.innerHTML='<img src="'+((i)?hI:base)+'" />';}
sT.appendChild(sD);
}
}
//-->
</script>
Put the code in your Global Footer.