Post by Schubaltz on Jul 1, 2007 13:58:20 GMT -5
Description: Allows users to set background colors to their posts.
Source: Open
Cross-browser: Yes
Global Header
<script type="text/javascript">
<!--
// Select Background Color in Posts
if(document.postForm && document.postForm.color) {
var $s, i = document.createElement("select"), e = document.postForm;
if(e.message.value.match(/\[bgcolor=([^\]]+)\]/)) {
$s = RegExp.$1;
e.message.value = e.message.value.replace(/\[bgcolor=[^\]]+\]/, "");
}
i.options[0] = new Option("Background Color");
for(var x = 1; x < e.color.options.length; x ++) {
i.options[x] = new Option(e.color.options[x].value);
if($s && $s == e.color.options[x].value)
i.selectedIndex = x;
}
i.onchange = new Function("$s = this.options[this.selectedIndex].value");
e.color.parentNode.appendChild(document.createTextNode(" "));
e.color.parentNode.appendChild(i);
e.onsubmit = function() {
if($s != "Background Color")
this.message.value += "[bgcolor=" + $s + "]";
}
}
if(location.href.match(/action=((pm|calendar)view|display)/))
for(var l = document.links, k = 4; k < l.length; k ++) if(l[k].className == "nav") {
for(var i = l[k].parentNode.getElementsByTagName("table")[1].rows, x = 1; x < i.length; x ++) {
if(i[x].cells[0].className.match(/windowbg2?/) && i[x].cells[1].innerHTML.match(/\[bgcolor=([^\]]+)\]/)) {
i[x].cells[1].style.backgroundColor = RegExp.$1;
i[x].cells[1].firstChild.rows[2].cells[0].style.backgroundColor = "transparent";
i[x].cells[1].innerHTML = i[x].cells[1].innerHTML.replace(/\[bgcolor=[^\]]+\]/, "");
}
}
break;
}
//-->
</script>
Source: Open
Cross-browser: Yes
Global Header
<script type="text/javascript">
<!--
// Select Background Color in Posts
if(document.postForm && document.postForm.color) {
var $s, i = document.createElement("select"), e = document.postForm;
if(e.message.value.match(/\[bgcolor=([^\]]+)\]/)) {
$s = RegExp.$1;
e.message.value = e.message.value.replace(/\[bgcolor=[^\]]+\]/, "");
}
i.options[0] = new Option("Background Color");
for(var x = 1; x < e.color.options.length; x ++) {
i.options[x] = new Option(e.color.options[x].value);
if($s && $s == e.color.options[x].value)
i.selectedIndex = x;
}
i.onchange = new Function("$s = this.options[this.selectedIndex].value");
e.color.parentNode.appendChild(document.createTextNode(" "));
e.color.parentNode.appendChild(i);
e.onsubmit = function() {
if($s != "Background Color")
this.message.value += "[bgcolor=" + $s + "]";
}
}
if(location.href.match(/action=((pm|calendar)view|display)/))
for(var l = document.links, k = 4; k < l.length; k ++) if(l[k].className == "nav") {
for(var i = l[k].parentNode.getElementsByTagName("table")[1].rows, x = 1; x < i.length; x ++) {
if(i[x].cells[0].className.match(/windowbg2?/) && i[x].cells[1].innerHTML.match(/\[bgcolor=([^\]]+)\]/)) {
i[x].cells[1].style.backgroundColor = RegExp.$1;
i[x].cells[1].firstChild.rows[2].cells[0].style.backgroundColor = "transparent";
i[x].cells[1].innerHTML = i[x].cells[1].innerHTML.replace(/\[bgcolor=[^\]]+\]/, "");
}
}
break;
}
//-->
</script>