Post by ⓦ৹₪deⓡ on Jan 2, 2006 4:10:34 GMT -8
This code will replace the colors pulldown menu on a post/pm page with an advanced color picker with over 32,000 colors. Do NOT PM me for support or requests, that's what the coding boards are for. Edit where indicated. Enjoy.
~Wonder
Global Footer
~Wonder
Global Footer
<script>
//Replace Color Pulldown with Advanced Color Picker v1.0 [CB]
//Copyright 01-02-2006 ~Wonder
//May be reposted anywhere as long as this header remains in tact
//Put in Global Footer
//Enter the URL for the color UBBC icon
colorIcon="http://img376.imageshack.us/img376/9562/coloricon8nx.gif";
//Do not change this image unless you are replacing it with the exact same image
hexWheelUrl="http://img229.imageshack.us/img229/7030/colorchart3sn.png";
toChange="";
function jesusLovesYouNoMatterWhat()
{
cp=window.open('', 'colorPopUp', config='height=200,width=195, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no');
cp.focus();
cp.document.write("<scr"+"ipt>hexColors=[[255,0,0],[255,255,0],[0,255,0],[0,255,255],[0,0,255],[255,0,255],[255,0,0]];function getHex(x,y){if(x<180){for(i=1;i<7;i++){if(x<i*30)break;}x=(x-((i-1)*30))/30;temp=new Array(3);for(j=0;j<3;j++){temp[j]=Math.round((1-x)*hexColors[i-1][j]+(x)*hexColors[i][j]);}}else{temp=[127,127,127];}temp=[[255,255,255],temp,[0,0,0]];c=new Array(3);i=(y<90)?1:2;y=(y-((i-1)*90))/90;for(j=0;j<3;j++){x=Math.round((1-y)*temp[i-1][j]+(y)*temp[i][j]).toString(16);c[j]=(x.length<2?\"0\":\"\")+x;}c=c.join(\"\").toUpperCase();x=document.getElementById(\"col\");x.style.backgroundColor=c; x=x.getElementsByTagName(\"font\");x[0].innerHTML=c;x[1].innerHTML=c;}function getXY(e){ posx = 0; posy = 0; if (!e) var e = window.event; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX; posy = e.clientY; } posx=(posx>195)?195:posx;posy=(posy>180)?180:posy;getHex(posx,posy);} function returnColor(){opener.changeColor2(document.getElementById('col').getElementsByTagName('font')[0].innerHTML);window.close();}</scr"+"ipt><title>Click To Select</title><body onmousemove=\"getXY(event)\" topmargin=0 leftmargin=0 bottommargin=0 rightmargin=0> <div id=\"pos\" style=\"width:195; height:180; margin:0; padding:0;\"><img src=\""+hexWheelUrl+"\" onclick=\"javascript:returnColor()\" alt=\"Click To Select\"></div><div id=\"col\" style=\"width:195; height:20; margin:0; padding:0;\"><center><b><font color=\"FFFFFF\">FFFFFF</font> <font color=\"000000\">FFFFFF</font></b></center></div></body>");
}
function changeColor2(temp)
{
add("[color="+temp+"]","[/color]");
}
if(document.postForm)
{
document.postForm.color.style.display="none";
a=document.createElement("a");
a.href="javascript:jesusLovesYouNoMatterWhat()";
a.innerHTML="<img src=\""+colorIcon+"\" border=0 alt=\"Font Color\">";
document.postForm.color.parentNode.insertBefore(a,document.postForm.color.previousSibling);
}
</script>