Post by ialex on Sept 6, 2007 3:18:49 GMT -8
This code will allow each user to change the background color of their posts.
The code will add this image with the other UBBC buttons when posting:
You may continue using it, or change it via the URL at the top.
It will allow users to use [bgcolor=COLOR] tags in their posts to change the background color of each post.
Cross Browser.
Global Footer.
Proboards.
<script type="text/javascript">
<!--
/*Custom Post Background Color UBBC - By iAlex - Open Source*/
var iCustomImage = "http://img410.imageshack.us/img410/7852/ibgcolorhuhubbclawldn4.png"; //UBBC Image
if(document.postForm){
var iSayWhat=document.postForm.color.parentNode.parentNode;
var iLinkyMe=document.createElement('a');
iLinkyMe.href='javascript: add("[bgcolor=COLOR]")';
var iClickMe=document.createElement('img');
iClickMe.src=iCustomImage;
iClickMe.border='0';
iLinkyMe.appendChild(iClickMe);
iSayWhat.appendChild(iLinkyMe);
if(location.href.match(/quote/)){
document.postForm.message.value = document.postForm.message.value.replace(/\[bgcolor=(.+?)\]/gi, '');
}
if(document.postForm.subject && document.postForm.subject.value.match(/Re:/)){
var iTd=document.getElementsByTagName('td');
for(i=0;i<iTd.length;i++){
if(iTd.item(i).width=="100%" && iTd.item(i).className.match(/windowbg2/) && iTd.item(i).innerHTML.match(/\[bgcolor=(.+?)\]/i)){
iTd.item(i).style.backgroundColor=RegExp.$1;
iTd.item(i).innerHTML=iTd.item(i).innerHTML.replace(/\[bgcolor=(.+?)\]/ig, '');
}
}
}
}
if(location.href.match(/action=(display|recent|calendarview|search2|pmview|userrecent)/) || location.href.match(/index.cgi$/) && document.title.match(/Preview/) && document.postForm){
var iTd=document.getElementsByTagName('td');
for(i=0;i<iTd.length;i++){
if(iTd.item(i).width=="80%" && iTd.item(i).className.match(/windowbg(2)?/) && iTd.item(i).align=="left" && iTd.item(i).vAlign=="top" && iTd.item(i).innerHTML.match(/\[bgcolor=(.+?)\]/i)){
var iColourMeUp=RegExp.$1;
var iInsertVariableHere=iTd.item(i).parentNode.getElementsByTagName('td');
for(a=1;a<iInsertVariableHere.length;a++){
iInsertVariableHere.item(a).style.backgroundColor=iColourMeUp;
}
iTd.item(i).innerHTML=iTd.item(i).innerHTML.replace(/\[bgcolor=(.+?)\]/gi, '');
}
}
}
//-->
</script>
The code will add this image with the other UBBC buttons when posting:
You may continue using it, or change it via the URL at the top.
It will allow users to use [bgcolor=COLOR] tags in their posts to change the background color of each post.
Cross Browser.
Global Footer.
Proboards.
<script type="text/javascript">
<!--
/*Custom Post Background Color UBBC - By iAlex - Open Source*/
var iCustomImage = "http://img410.imageshack.us/img410/7852/ibgcolorhuhubbclawldn4.png"; //UBBC Image
if(document.postForm){
var iSayWhat=document.postForm.color.parentNode.parentNode;
var iLinkyMe=document.createElement('a');
iLinkyMe.href='javascript: add("[bgcolor=COLOR]")';
var iClickMe=document.createElement('img');
iClickMe.src=iCustomImage;
iClickMe.border='0';
iLinkyMe.appendChild(iClickMe);
iSayWhat.appendChild(iLinkyMe);
if(location.href.match(/quote/)){
document.postForm.message.value = document.postForm.message.value.replace(/\[bgcolor=(.+?)\]/gi, '');
}
if(document.postForm.subject && document.postForm.subject.value.match(/Re:/)){
var iTd=document.getElementsByTagName('td');
for(i=0;i<iTd.length;i++){
if(iTd.item(i).width=="100%" && iTd.item(i).className.match(/windowbg2/) && iTd.item(i).innerHTML.match(/\[bgcolor=(.+?)\]/i)){
iTd.item(i).style.backgroundColor=RegExp.$1;
iTd.item(i).innerHTML=iTd.item(i).innerHTML.replace(/\[bgcolor=(.+?)\]/ig, '');
}
}
}
}
if(location.href.match(/action=(display|recent|calendarview|search2|pmview|userrecent)/) || location.href.match(/index.cgi$/) && document.title.match(/Preview/) && document.postForm){
var iTd=document.getElementsByTagName('td');
for(i=0;i<iTd.length;i++){
if(iTd.item(i).width=="80%" && iTd.item(i).className.match(/windowbg(2)?/) && iTd.item(i).align=="left" && iTd.item(i).vAlign=="top" && iTd.item(i).innerHTML.match(/\[bgcolor=(.+?)\]/i)){
var iColourMeUp=RegExp.$1;
var iInsertVariableHere=iTd.item(i).parentNode.getElementsByTagName('td');
for(a=1;a<iInsertVariableHere.length;a++){
iInsertVariableHere.item(a).style.backgroundColor=iColourMeUp;
}
iTd.item(i).innerHTML=iTd.item(i).innerHTML.replace(/\[bgcolor=(.+?)\]/gi, '');
}
}
}
//-->
</script>