more css for users stuff

This commit is contained in:
John McLear 2011-03-26 18:45:35 +00:00
parent 5558e23107
commit 3b029b638d
3 changed files with 69 additions and 34 deletions

View file

@ -14,6 +14,42 @@
* limitations under the License.
*/
var colorPickerOpen = false;
function getColorPickerSwatchIndex(jnode) {
return Number(jnode.get(0).className.match(/\bn([0-9]+)\b/)[1])-1;
}
function closeColorPicker(accept) {
if (accept) {
var newColorId = getColorPickerSwatchIndex($("#mycolorpicker .picked"));
if (newColorId >= 0) { // fails on NaN
myUserInfo.colorId = newColorId;
pad.notifyChangeColor(newColorId);
}
}
colorPickerOpen = false;
$("#mycolorpicker").css('display', 'none');
renderMyUserInfo();
}
function showColorPicker() {
if (! colorPickerOpen) {
var palette = pad.getColorPalette();
for(var i=0;i<palette.length;i++) {
$("#mycolorpicker .n"+(i+1)+" .pickerswatch").css(
'background', palette[i]);
}
$("#mycolorpicker").css('display', 'block');
colorPickerOpen = true;
renderMyUserInfo();
}
// this part happens even if color picker is already open
$("#mycolorpicker .pickerswatchouter").removeClass('picked');
$("#mycolorpicker .pickerswatchouter:eq("+(myUserInfo.colorId||0)+")").
addClass('picked');
}
var paduserlist = (function() {
@ -278,7 +314,6 @@ var paduserlist = (function() {
var myUserInfo = {};
var otherUsersInfo = [];
var otherUsersData = [];
var colorPickerOpen = false;
function rowManagerMakeNameEditor(jnode, userId) {
setUpEditable(jnode, function() {
@ -352,38 +387,6 @@ var paduserlist = (function() {
jqueryNode.removeAttr('disabled').addClass('editable');
}
function showColorPicker() {
if (! colorPickerOpen) {
var palette = pad.getColorPalette();
for(var i=0;i<palette.length;i++) {
$("#mycolorpicker .n"+(i+1)+" .pickerswatch").css(
'background', palette[i]);
}
$("#mycolorpicker").css('display', 'block');
colorPickerOpen = true;
renderMyUserInfo();
}
// this part happens even if color picker is already open
$("#mycolorpicker .pickerswatchouter").removeClass('picked');
$("#mycolorpicker .pickerswatchouter:eq("+(myUserInfo.colorId||0)+")").
addClass('picked');
}
function getColorPickerSwatchIndex(jnode) {
return Number(jnode.get(0).className.match(/\bn([0-9]+)\b/)[1])-1;
}
function closeColorPicker(accept) {
if (accept) {
var newColorId = getColorPickerSwatchIndex($("#mycolorpicker .picked"));
if (newColorId >= 0) { // fails on NaN
myUserInfo.colorId = newColorId;
pad.notifyChangeColor(newColorId);
}
}
colorPickerOpen = false;
$("#mycolorpicker").css('display', 'none');
renderMyUserInfo();
}
function updateInviteNotice() {
if (otherUsersInfo.length == 0) {
$("#otheruserstable").hide();