|
|
@ -358,7 +358,7 @@ define([
|
|
|
|
$content.css('margin-top', h+'px');
|
|
|
|
$content.css('margin-top', h+'px');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$closeIcon.click(function () {
|
|
|
|
$closeIcon.click(function () {
|
|
|
|
Cryptpad.setAttribute('userlist-drawer', false);
|
|
|
|
//Cryptpad.setAttribute('userlist-drawer', false); TODO iframe
|
|
|
|
hide();
|
|
|
|
hide();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$button.click(function () {
|
|
|
|
$button.click(function () {
|
|
|
@ -368,9 +368,9 @@ define([
|
|
|
|
visible = !visible;
|
|
|
|
visible = !visible;
|
|
|
|
// TODO iframe
|
|
|
|
// TODO iframe
|
|
|
|
//Cryptpad.setAttribute('userlist-drawer', visible);
|
|
|
|
//Cryptpad.setAttribute('userlist-drawer', visible);
|
|
|
|
//Cryptpad.feedback(visible?'USERLIST_SHOW': 'USERLIST_HIDE');
|
|
|
|
Common.feedback(visible?'USERLIST_SHOW': 'USERLIST_HIDE');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
show();
|
|
|
|
// TODO iframe
|
|
|
|
// TODO iframe
|
|
|
|
/*Cryptpad.getAttribute('userlist-drawer', function (err, val) {
|
|
|
|
/*Cryptpad.getAttribute('userlist-drawer', function (err, val) {
|
|
|
|
if (val === false || mobile) { return void hide(); }
|
|
|
|
if (val === false || mobile) { return void hide(); }
|
|
|
@ -773,6 +773,11 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var createUserAdmin = function (toolbar, config) {
|
|
|
|
var createUserAdmin = function (toolbar, config) {
|
|
|
|
|
|
|
|
if (!config.metadataMgr) {
|
|
|
|
|
|
|
|
throw new Error("You must provide a `metadataMgr` to display the user menu");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
var metadataMgr = config.metadataMgr;
|
|
|
|
|
|
|
|
var myData = metadataMgr.getMetadata().users[metadataMgr.getNetfluxId()];
|
|
|
|
var $userAdmin = toolbar.$userAdmin.find('.'+USERADMIN_CLS).show();
|
|
|
|
var $userAdmin = toolbar.$userAdmin.find('.'+USERADMIN_CLS).show();
|
|
|
|
var userMenuCfg = {
|
|
|
|
var userMenuCfg = {
|
|
|
|
$initBlock: $userAdmin
|
|
|
|
$initBlock: $userAdmin
|
|
|
@ -795,22 +800,23 @@ define([
|
|
|
|
$userButton.click(function (e) {
|
|
|
|
$userButton.click(function (e) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
e.stopPropagation();
|
|
|
|
Cryptpad.getLastName(function (err, lastName) {
|
|
|
|
var lastName = myData.displayName;
|
|
|
|
if (err) { return void console.error("Cannot get last name", err); }
|
|
|
|
//Cryptpad.getLastName(function (err, lastName) {
|
|
|
|
|
|
|
|
//if (err) { return void console.error("Cannot get last name", err); }
|
|
|
|
Cryptpad.prompt(Messages.changeNamePrompt, lastName || '', function (newName) {
|
|
|
|
Cryptpad.prompt(Messages.changeNamePrompt, lastName || '', function (newName) {
|
|
|
|
if (newName === null && typeof(lastName) === "string") { return; }
|
|
|
|
if (newName === null && typeof(lastName) === "string") { return; }
|
|
|
|
if (newName === null) { newName = ''; }
|
|
|
|
if (newName === null) { newName = ''; }
|
|
|
|
else { Cryptpad.feedback('NAME_CHANGED'); }
|
|
|
|
else { Common.feedback('NAME_CHANGED'); }
|
|
|
|
Cryptpad.setAttribute('username', newName, function (err) {
|
|
|
|
Common.setDisplayName(newName, function (err) {
|
|
|
|
if (err) {
|
|
|
|
if (err) {
|
|
|
|
console.log("Couldn't set username");
|
|
|
|
console.log("Couldn't set username");
|
|
|
|
console.error(err);
|
|
|
|
console.error(err);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Cryptpad.changeDisplayName(newName, true);
|
|
|
|
//Cryptpad.changeDisplayName(newName, true); Already done?
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
//});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
Cryptpad.onDisplayNameChanged(function () {
|
|
|
|
Cryptpad.onDisplayNameChanged(function () {
|
|
|
|
window.setTimeout(function () {
|
|
|
|
window.setTimeout(function () {
|
|
|
|