Welcome To Graphics N Codes & Stuff
« [CB] Additional colour picker. Jim »

Welcome Guest. Please Login or Register.
Dec 6, 2009, 5:40pm



Welcome Graphics Artists With Coders To Graphics N Codes & Stuff!

Graphics N Codes & Stuff


Graphics N Codes & Stuff Daily With Monthly Events!

Florida
Summer


ShoutMix chat widget

Monthly With Weekly Awards Winners Here

Graphics N Codes & Stuff RuneScape Writer Scribbles: A Writing Forum ¢¾Elizabeth's Life¢¾ The Userbar Depot Free To Advertise Members 4 U Silent Designs V2 Studio Zero Charmed Skins The Dog Pound DoooDLE Graphics Support Sentral - Support, Coding, Graphics, Assistance with your Board and Advertising. Crib Forums ProIndex - Index of many ProBoards! Free To Advertise Ominous Designs Writhed Resources /></a>
<a href= Graphic Lovers Community Pure Entertainment MB

©skin,side banners and banner by anny @ atomicc&Slighly Insane

Please when you make a new post and with every post, you have to reply to other members posts before posting to every new post you make!


Welcome To Graphics N Codes & Stuff :: Advertising, And Coders Heaven Forums :: Members Advertising, And Codes Heaven Forums :: Proboards Codes Forum :: [CB] Additional colour picker. Jim
   [Search This Thread][Send Topic To Friend] [Print]
 AuthorTopic: [CB] Additional colour picker. Jim (Read 8 times)
graphicswoman
Graphics N Codes Administrator
************
[The Administrator or the website is not your entertaintment, Administrator does not do graphics or codes, but Advertisers, Graphics Artists and Coders are not posting graphics or codes or writings, if not posting graphics or codes or writing you will be banned!]
member is offline

[avatar]

My cat, poetry writings, traveling, animal with envirmental groups%%VERY SEXY summer style%%


[homepage]

Joined: Feb 2008
Gender: Female
Posts: 535
Location: Marion County, FL
Karma: 0
 [CB] Additional colour picker. Jim
« Thread Started on Oct 27, 2009, 10:29pm »

Description: This adds a box to the right of your UBBC tags, replacing the drop-down colour selector in favor of a box with 6x6 previews of all the colours you choose to have.

Preview: http://i35.tinypic.com/a0cah.jpg

Code:

Global Footers:
<style type="text/css">
<!--

font div {
float: right;
}
font table tr td div {
float: none;
}

-->
</style>
<script type = "text/javascript">
<!--

//Colour picker
//Create by James [a_leon]

var boxWidth = 88;
var boxBorderColor = "#000000";

var HexArr = [
"FF4545","F0387A","FB6C3A","FEBC5E",
"BEFD51","54EC40","47FEB7","4BBBFA",
"6282FA","C763F5","F958EF","F85858",
"EF6395","FB835A","FBC374","CDFA7F",
"8FF082","75FDC8","78C9F7","7C96FA",
"D485F8","FA8BF3","F57474","EF8AAE",
"FB9A78","FDCD89","D8FB9B","ACEEA3",
"A3F5D5","92D2F6","93A9FA","DAA3F3",
"F6A1F1","FC9B9B","EFADC5","FCAB8E",
"FFDAA5","E1F9B7","BCF0B6","C0FCE4",
"A1D2EE","ACBBF2","D3AEE5","EDB9EA"
];

if (document.all && !navigator.userAgent.match(/Opera/i)) {
boxWidth += 4;
}

function createElem(elem, isNew, AttObj) {
if (isNew) {
elem = document.createElement(elem);
}
if (AttObj) {
for(key in AttObj) {
if (key == "style") {
for(a in AttObj[key]) {
elem.style[a] = AttObj[key][a];
}
} else {
for(a in AttObj[key]) {
elem.setAttribute(a, AttObj[key][a]);
}
}
}
}
if (isNew) {
return elem;
}
}

function addEvent(obj, type, fn) {
if (obj.addEventListener) {
obj.addEventListener(type, fn, false);
}
else if(obj.attachEvent) {
obj["e" + type + fn] = fn;
obj[type + fn] = function() {
obj["e" + type + fn](window.event);
}
obj.attachEvent("on" + type, obj[type + fn]);
}
}

var colSel = document.getElementsByTagName("select");
for (var s = 0; s < colSel.length; s ++) {
if (colSel.item(s).name == "color") {
var BBCell = colSel.item(s).parentNode;

var cDiv = createElem("div", 1, {
style: {
styleFloat: "right",
width: boxWidth + "px",
padding: "1px",
border: "1px solid " + boxBorderColor
}
});

for (var h = 0; h < HexArr.length; h ++) {
var boxDiv = createElem("div", 1, {
style: {
styleFloat: "left",
width: "6px",
height: "6px",
margin: "1px",
backgroundColor: "#" + HexArr[h]
},
set: {
id: HexArr[h]
}
});
boxDiv.appendChild(document.createTextNode(" "));

addEvent(boxDiv, "mouseover", function() {
this.style.cursor = "pointer";
});
addEvent(boxDiv, "mouseout", function() {
this.style.cursor = "auto";
});
addEvent(boxDiv, "click", function() {
add("[color=", "[/color]", this.id);
});

cDiv.appendChild(boxDiv);
}
BBCell.removeChild(colSel.item(s));
BBCell.insertBefore(cDiv, BBCell.firstChild);
}
}

//-->
</script>


--------------------------------------------------------------------------------


Created this for SSDv6, but they decided not to use it in v7. Works in IE, Fx, Opera, Chrome and Safari. I realize that some of the functions are a bit overkill for this code, but they were originally designed to be with an entire forum of coding, I just decided to leave them in instead.
« Last Edit: Oct 27, 2009, 10:31pm by graphicswoman »Link to Post - Back to Top  IP: Logged

[image] [image] [image]
   [Search This Thread][Send Topic To Friend] [Print]


Please when you make a new post and with every post, you have to reply to other members posts before posting to every new post you make!
Google
Webgraphicswoman.proboards.com
Click Here To Make This Board Ad-Free


This Board Hosted For FREE By ProBoards
Get Your Own Free Message Boards & Free Forums!