add missing script

pull/1/head
ansuz 8 years ago
parent 2351d8a23e
commit 992bc4f449

@ -10,6 +10,7 @@
<script src="codemirror-5.16.0/mode/javascript/javascript.js"></script> <script src="codemirror-5.16.0/mode/javascript/javascript.js"></script>
<script src="codemirror-5.16.0/mode/loadmode.js"></script> <script src="codemirror-5.16.0/mode/loadmode.js"></script>
<script src="codemirror-5.16.0/mode/meta.js"></script> <script src="codemirror-5.16.0/mode/meta.js"></script>
<script src="codemirror-5.16.0/addon/mode/overlay.js"></script>
<script src="codemirror-5.16.0/addon/edit/closebrackets.js"></script> <script src="codemirror-5.16.0/addon/edit/closebrackets.js"></script>
<script src="codemirror-5.16.0/addon/edit/matchbrackets.js"></script> <script src="codemirror-5.16.0/addon/edit/matchbrackets.js"></script>
<script src="codemirror-5.16.0/addon/edit/trailingspace.js"></script> <script src="codemirror-5.16.0/addon/edit/trailingspace.js"></script>

@ -445,7 +445,6 @@ define([
var lastName = getLastName(); var lastName = getLastName();
if (typeof(lastName) === 'string' && lastName.length) { if (typeof(lastName) === 'string' && lastName.length) {
console.log("Setting previous name to %s", lastName);
setName(lastName); setName(lastName);
} }
}; };

@ -234,21 +234,32 @@ define([
myID = info.myID || null; myID = info.myID || null;
}; };
var getLastName = function () {
return Cryptpad.getPadAttribute('username') || '';
};
var setName = module.setName = function (newName) {
if (!(typeof(newName) === 'string' && newName.trim())) { return; }
var myUserNameTemp = newName.trim();
if(myUserNameTemp.length > 32) {
myUserNameTemp = myUserNameTemp.substr(0, 32);
}
myUserName = myUserNameTemp;
myData[myID] = {
name: myUserName
};
addToUserList(myData);
editor.fire('change');
Cryptpad.setPadAttribute('username', newName);
};
var createChangeName = function(id, $container) { var createChangeName = function(id, $container) {
var buttonElmt = $container.find('#'+id)[0]; var buttonElmt = $container.find('#'+id)[0];
var lastName = getLastName();
buttonElmt.addEventListener("click", function() { buttonElmt.addEventListener("click", function() {
Cryptpad.prompt(Messages.changeNamePrompt, '', function (newName) { Cryptpad.prompt(Messages.changeNamePrompt, lastName, function (newName) {
if (!(typeof(newName) === 'string' && newName.trim())) { return; } setName(newName);
var myUserNameTemp = newName.trim();
if(myUserNameTemp.length > 32) {
myUserNameTemp = myUserNameTemp.substr(0, 32);
}
myUserName = myUserNameTemp;
myData[myID] = {
name: myUserName
};
addToUserList(myData);
editor.fire('change');
}); });
}); });
}; };
@ -524,6 +535,10 @@ define([
console.log("Unlocking editor"); console.log("Unlocking editor");
setEditable(true); setEditable(true);
initializing = false; initializing = false;
var lastName = getLastName();
if (typeof(lastName) === 'string' && lastName.length) {
setName(lastName);
}
}; };
var onAbort = realtimeOptions.onAbort = function (info) { var onAbort = realtimeOptions.onAbort = function (info) {

Loading…
Cancel
Save