rgb(r,g,b) values are now displayed as hex colors, too
This commit is contained in:
parent
35022eaa92
commit
9201c41331
4 changed files with 37 additions and 17 deletions
|
@ -135,9 +135,16 @@ function submit() {
|
|||
var form = "<% request.form %>"; //args[0].split("=")[1];
|
||||
var name = "<% request.name %>"; //args[1].split("=")[1];
|
||||
var ref = self.opener.document;
|
||||
//if (color.indexOf("#") == 0)
|
||||
// color = color.substr(1, color.length-1);
|
||||
ref.getElementById("cp1_"+name).value = color;
|
||||
if (color.indexOf("rgb(") == 0) {
|
||||
var parts = color.substr(4,color.length-2).split(",");
|
||||
var R = parseInt(parts[0]).toString(16);
|
||||
var G = parseInt(parts[1]).toString(16);
|
||||
var B = parseInt(parts[2]).toString(16);
|
||||
if (R.length == 1) R="0"+R;
|
||||
if (G.length == 1) G="0"+G;
|
||||
if (B.length == 1) B="0"+B;
|
||||
}
|
||||
ref.getElementById("cp1_"+name).value = R+G+B;
|
||||
ref.getElementById("cp2_"+name).style.backgroundColor = color;
|
||||
}
|
||||
cancel();
|
||||
|
|
|
@ -28,10 +28,10 @@ function loopskin_macro (param) {
|
|||
* macro creates an html link
|
||||
*/
|
||||
function link_macro(param) {
|
||||
if (param.checkdeny == "true") {
|
||||
if (this.isDenied(session.user))
|
||||
return("");
|
||||
}
|
||||
if (param.checkdeny == "true") {
|
||||
if (this.isDenied(session.user))
|
||||
return("");
|
||||
}
|
||||
var content = param.text ? param.text : param.to;
|
||||
param = this.createLinkParam(param);
|
||||
openMarkupElement("a", param);
|
||||
|
@ -75,8 +75,8 @@ function colorpicker_macro(param) {
|
|||
}
|
||||
if (!param.text)
|
||||
param.text = param.name;
|
||||
if (param.color && param.color.indexOf("#") < 0)
|
||||
param.color = "#" + param.color;
|
||||
if (param.color)
|
||||
param.color = renderColorAsString(param.color);
|
||||
this.renderSkin("cp_element", param);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,16 +51,16 @@ function createNewSite(title,alias,creator) {
|
|||
newSite.bgcolor = "#ffffff";
|
||||
newSite.textfont = "Verdana, Helvetica, Arial, sans-serif";
|
||||
newSite.textsize = "13px";
|
||||
newSite.textcolor = "#000000";
|
||||
newSite.linkcolor = "#ff3300";
|
||||
newSite.alinkcolor = "#ff0000";
|
||||
newSite.vlinkcolor = "#ff3300";
|
||||
newSite.textcolor = "000000";
|
||||
newSite.linkcolor = "ff3300";
|
||||
newSite.alinkcolor = "ff0000";
|
||||
newSite.vlinkcolor = "ff3300";
|
||||
newSite.titlefont = "Verdana, Helvetica, Arial, sans-serif";
|
||||
newSite.titlesize = "15px";
|
||||
newSite.titlecolor = "#cc0000";
|
||||
newSite.titlecolor = "cc0000";
|
||||
newSite.smallfont = "Arial, Helvetica, sans-serif";
|
||||
newSite.smallsize = "12px";
|
||||
newSite.smallcolor = "#999999";
|
||||
newSite.smallcolor = "999999";
|
||||
newSite.days = 3;
|
||||
// retrieve locale-object from root (either specified or default-locale from JVM)
|
||||
var loc = this.getLocale();
|
||||
|
|
|
@ -15,6 +15,19 @@ function openColorPicker(name, text) {
|
|||
var cpWindow = window.open("<% root.url path="colorpicker" %>?name=" + name + "&text=" + text, "cpWindow", "toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,width=350,height=320");
|
||||
}
|
||||
|
||||
function setColorPreview(name, color) {
|
||||
document.getElementById('cp2_' + name).style.backgroundColor = color;
|
||||
function normalizeColor(c) {
|
||||
if (c && c.length == 6) {
|
||||
var nonhex = new RegExp("[^0-9,a-f]");
|
||||
nonhex.ignoreCase = true;
|
||||
var found = c.match(nonhex);
|
||||
if (!found) {
|
||||
// color-string contains just hex-characters, so we prefix it with '#'
|
||||
return("#" + c);
|
||||
}
|
||||
}
|
||||
return(c);
|
||||
}
|
||||
|
||||
function setColorPreview(name, color) {
|
||||
document.getElementById('cp2_' + name).style.backgroundColor = normalizeColor(color);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue