mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-23 17:06:16 -04:00
pad_userlist: Don't rely on global pad
variable
This commit is contained in:
parent
bf6ab3bba8
commit
e99eb6366c
1 changed files with 62 additions and 67 deletions
|
@ -369,18 +369,13 @@ const paduserlist = (() => {
|
|||
});
|
||||
|
||||
// color picker
|
||||
$('#myswatchbox').click(showColorPicker);
|
||||
$('#myswatchbox').click(() => self.showColorPicker());
|
||||
$('#mycolorpicker .pickerswatchouter').click(function () {
|
||||
$('#mycolorpicker .pickerswatchouter').removeClass('picked');
|
||||
$(this).addClass('picked');
|
||||
});
|
||||
$('#mycolorpickersave').click(() => {
|
||||
closeColorPicker(true);
|
||||
});
|
||||
$('#mycolorpickercancel').click(() => {
|
||||
closeColorPicker(false);
|
||||
});
|
||||
//
|
||||
$('#mycolorpickersave').click(() => self.closeColorPicker(true));
|
||||
$('#mycolorpickercancel').click(() => self.closeColorPicker(false));
|
||||
},
|
||||
usersOnline: () => {
|
||||
// Returns an object of users who are currently online on this pad
|
||||
|
@ -541,13 +536,8 @@ const paduserlist = (() => {
|
|||
$('#myswatch').css({'background-color': myUserInfo.colorId});
|
||||
$('li[data-key=showusers] > a').css({'box-shadow': `inset 0 0 30px ${myUserInfo.colorId}`});
|
||||
},
|
||||
};
|
||||
return self;
|
||||
})();
|
||||
|
||||
const getColorPickerSwatchIndex = (jnode) => $('#colorpickerswatches li').index(jnode);
|
||||
|
||||
const closeColorPicker = (accept) => {
|
||||
closeColorPicker: (accept) => {
|
||||
if (accept) {
|
||||
let newColor = $('#mycolorpickerpreview').css('background-color');
|
||||
const parts = newColor.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
||||
|
@ -567,9 +557,9 @@ const closeColorPicker = (accept) => {
|
|||
|
||||
colorPickerOpen = false;
|
||||
$('#mycolorpicker').removeClass('popup-show');
|
||||
};
|
||||
},
|
||||
|
||||
const showColorPicker = () => {
|
||||
showColorPicker: () => {
|
||||
$.farbtastic('#colorpicker').setColor(myUserInfo.colorId);
|
||||
|
||||
if (!colorPickerOpen) {
|
||||
|
@ -602,6 +592,11 @@ const showColorPicker = () => {
|
|||
$('#colorpickerswatches li').removeClass('picked');
|
||||
$($('#colorpickerswatches li')[myUserInfo.colorId]).addClass('picked'); // seems weird
|
||||
}
|
||||
},
|
||||
|
||||
getColorPickerSwatchIndex: (jnode) => $('#colorpickerswatches li').index(jnode),
|
||||
};
|
||||
return self;
|
||||
})();
|
||||
|
||||
exports.paduserlist = paduserlist;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue