From 576fe06682fcf96a80bcb4988b183fcdf352832d Mon Sep 17 00:00:00 2001 From: Nikolai Prokoschenko Date: Thu, 19 Apr 2012 16:44:19 +0300 Subject: Corrected color picker: `jQuery(...).css('background-color')` returns a hex notation in IE8 and `rgb()` in every other browser. --- src/static/js/pad_userlist.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/static/js/pad_userlist.js b/src/static/js/pad_userlist.js index f7ee8143..c5f128b7 100644 --- a/src/static/js/pad_userlist.js +++ b/src/static/js/pad_userlist.js @@ -748,13 +748,14 @@ function closeColorPicker(accept) var newColor = $("#mycolorpickerpreview").css("background-color"); var parts = newColor.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); // parts now should be ["rgb(0, 70, 255", "0", "70", "255"] - delete (parts[0]); - for (var i = 1; i <= 3; ++i) { - parts[i] = parseInt(parts[i]).toString(16); - if (parts[i].length == 1) parts[i] = '0' + parts[i]; + if (parts) { + delete (parts[0]); + for (var i = 1; i <= 3; ++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; pad.notifyChangeColor(newColor); paduserlist.renderMyUserInfo(); -- cgit v1.2.3