|
Post by Streamstrider on Oct 13, 2011 2:31:59 GMT -8
I was wondering if there was any way to change the colors displayed on the picker, or better yet, if there was a way to add colors to it? Or should it be a separate code that creates the squares of the chosen colors and just removes the default color dropdown (in which case I suppose I wouldn't be asking about this code)? <script type="text/javascript"> <!-- /*Colour Palette Square Picker - By iAlex - Open Source*/ if(document.postForm && document.postForm.color){ var iColor=document.postForm.color var iParent=iColor.parentNode.parentNode.parentNode; var iColorTr=iParent.cloneNode(true); iColorTr.childNodes[0].firstChild.innerHTML='Add Colors:'; iParent.parentNode.insertBefore(iColorTr, iParent.nextSibling); var iOpt=iColor.options; iOkay='<table><tr>'; for(i=1;i<iOpt.length;i++){ iOkay+='<td width="20" height="20" bgcolor="'+iOpt.item(i).value+'" onmouseover="this.style.cursor=\'pointer\';" onmousedown="javascript: aC(\''+iOpt.item(i).value+'\')"></td><td width="2"></td>'; } iOkay+='</tr></table>'; iColorTr.childNodes[1].innerHTML=iOkay iColor.style.display='none'; } //--> </script>
|
|
|
Post by Wormopolis on Oct 13, 2011 16:43:39 GMT -8
there IS a code that lets you add more colors to the drop down. if you run that code first, THEN this one, see what happens
|
|
|
Post by Streamstrider on Oct 15, 2011 6:39:42 GMT -8
It adds the new colors, but is it possible to make it start a new row of colors after so many are already on the row? Say 18?
|
|
|
Post by Wormopolis on Oct 15, 2011 16:49:31 GMT -8
<script type="text/javascript"> <!-- /*Colour Palette Square Picker - By iAlex - Open Source*/
var squaresPerRow=12;
if(document.postForm && document.postForm.color){ var iColor=document.postForm.color var iParent=iColor.parentNode.parentNode.parentNode; var iColorTr=iParent.cloneNode(true); iColorTr.childNodes[0].firstChild.innerHTML='Add Colors:'; iParent.parentNode.insertBefore(iColorTr, iParent.nextSibling); var iOpt=iColor.options; iOkay='<table><tr>'; var sqc=0; for(i=1;i<iOpt.length;i++){ iOkay+='<td width="20" height="20" bgcolor="'+iOpt.item(i).value+'" onmouseover="this.style.cursor=\'pointer\';" onmousedown="javascript: aC(\''+iOpt.item(i).value+'\')"></td><td width="2"></td>'; if (++sqc == squaresPerRow) { iOkay+='</tr><tr>'; sqc=0; } } iOkay+='</tr></table>'; iColorTr.childNodes[1].innerHTML=iOkay iColor.style.display='none'; } //--> </script>
|
|
|
Post by Streamstrider on Oct 15, 2011 19:57:23 GMT -8
Awesome! Thank you so much Wormo!
|
|