Merge pull request #649 from rassie/patch-1

Corrected color picker: `jQuery(...).css('background-color')` returns…
pull/658/merge
John McLear 2012-04-19 08:37:09 -07:00
commit 4a7ab12859
1 changed files with 7 additions and 6 deletions

View File

@ -748,13 +748,14 @@ function closeColorPicker(accept)
var newColor = $("#mycolorpickerpreview").css("background-color"); var newColor = $("#mycolorpickerpreview").css("background-color");
var parts = newColor.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); var parts = newColor.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
// parts now should be ["rgb(0, 70, 255", "0", "70", "255"] // parts now should be ["rgb(0, 70, 255", "0", "70", "255"]
delete (parts[0]); if (parts) {
for (var i = 1; i <= 3; ++i) { delete (parts[0]);
parts[i] = parseInt(parts[i]).toString(16); for (var i = 1; i <= 3; ++i) {
if (parts[i].length == 1) parts[i] = '0' + parts[i]; parts[i] = parseInt(parts[i]).toString(16);
if (parts[i].length == 1) parts[i] = '0' + parts[i];
}
var newColor = "#" +parts.join(''); // "0070ff"
} }
var newColor = "#" +parts.join(''); // "0070ff"
myUserInfo.colorId = newColor; myUserInfo.colorId = newColor;
pad.notifyChangeColor(newColor); pad.notifyChangeColor(newColor);
paduserlist.renderMyUserInfo(); paduserlist.renderMyUserInfo();