Welcome Guest [Log In] [Register]
This board has been archived and is no longer accepting new questions. If you have a support question for your ZetaBoard, please visit us at the new support board. Registration is free and easy.


Visit the NEW ZetaBoards Support forum!

Username:   Password:
Add Reply
Add Colors; allows you to add more colors
Topic Started: Feb 6 2008, 07:57 PM (4,940 Views)
Arrogant
Member Avatar
Vote Choco and Nicola!
[ *  *  * ]
basically, this allows you to add more colors to the color dropdown list, as well as color the text of each option accordingly.

to add more colors, just do the following:
var colors = ["color 1"]; -> var colors = ["color 1", "color 2"]; -> var colors = ["color 1", "color 2", "color 3"];

this goes in your Board Template section, in either the Below the Board or Above the Copyright sections:
Code:
 
<script type="text/javascript"> <!--
var colors = ["color 1", "color 2", "color 3"];
if(document.posting && document.posting.fcolor) $("select[@name=fcolor]").each(function() {
for(var j = 0, f = this.options.length; j < colors.length; j++) this.options[f + j] = new Option(colors[j], colors[j]);
for(var i = 1; i < this.options.length; i ++) this.options[i].style.color = this.options[i].value;
});
// --> </script>


Edited by Arrogant, Feb 6 2008, 08:06 PM.
Offline Profile Quote Post Goto Top
 
Victrixs
Member Avatar
Website Developer
[ *  *  * ]
what drop down lists, also doesn't seem to do anything.
Offline Profile Quote Post Goto Top
 
Arrogant
Member Avatar
Vote Choco and Nicola!
[ *  *  * ]
when you made that post, did you even bother to look at the buttons above the textarea you typed in? >.>

if you look, you'll see a dropdown that says "Color" - click it and be amazed.

this script, when added properly to a board, adds additional colors to that (^^) list - it also changes the color of the option to fit it's value.

to add more colors, replace "color 1", color 2", and "color 3" with your own unique additions - even add some more if you want to.
Edited by Arrogant, Feb 6 2008, 08:28 PM.
Offline Profile Quote Post Goto Top
 
Darkman
Member Avatar
Member
[ *  * ]
Nice code. I'll be using this from now on. Thank you. :)
Offline Profile Quote Post Goto Top
 
lirts
Member Avatar
Member
[ *  *  * ]
this code isn't working for me...
Offline Profile Quote Post Goto Top
 
Arrogant
Member Avatar
Vote Choco and Nicola!
[ *  *  * ]
forum link and browser you're using? :x
Offline Profile Quote Post Goto Top
 
skiingiggy
Member Avatar
Member
[ *  * ]
Could you be more specific as to what to change Color 1 to? Might make it easier to make out.
Offline Profile Quote Post Goto Top
 
Viral
Member Avatar
i'm stanley nao
[ *  *  *  *  * ]
Change it to a color that you want to add to the drop down. Whether it be paleblue or navy (yes, all colors will work).
Offline Profile Quote Post Goto Top
 
lanie
Member Avatar
Member
[ * ]
do you use hex # or the actual colour name
Offline Profile Quote Post Goto Top
 
Arrogant
Member Avatar
Vote Choco and Nicola!
[ *  *  * ]
actually, you can use either. of course, if you use #111111, it will show up as #111111 in the dropdown - as well as in the UBBC that's placed in the textarea.

here's a different version that lets you have a different text than the value.

Code:
 
<script type="text/javascript"> <!--
var colors = [["Displayed in Dropdown", "Displayed in UBBC"], ["Ditto", "Ditto 2"]];
if(document.posting && document.posting.fcolor) $("select[@name=fcolor]").each(function() {
for(var j = 0, f = this.options.length; j < colors.length; j++) this.options[f + j] = new Option(colors[j][0], colors[j][1]);
for(var i = 1; i < this.options.length; i ++) this.options[i].style.color = this.options[i].value;
});
// --> </script>


so, if i had it like this: ["Red", "#123456"];
the dropdown list would say Red, but the tag would be [ color=#123456 ] - get it?
Edited by Arrogant, Feb 9 2008, 09:51 PM.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
Go to Next Page
« Previous Topic · User Created Codes · Next Topic »
Add Reply