|
|
@ -100,11 +100,15 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var exportText = module.exportText = function () {
|
|
|
|
var exportText = module.exportText = function () {
|
|
|
|
var text = editor.getValue();
|
|
|
|
var text = editor.getValue();
|
|
|
|
var filename = window.prompt("What would you like to name your file?");
|
|
|
|
|
|
|
|
if (filename) {
|
|
|
|
Cryptpad.prompt('What would you like to name your file?',
|
|
|
|
var blob = new Blob([text], {type: "text/plain;charset=utf-8"});
|
|
|
|
document.title, function (filename) {
|
|
|
|
saveAs(blob, filename);
|
|
|
|
if (filename === null) { return; }
|
|
|
|
}
|
|
|
|
var blob = new Blob([text], {
|
|
|
|
|
|
|
|
type: 'text/plain;charset=utf-8'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
saveAs(blob, filename);
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var userList = {}; // List of pretty name of all users (mapped with their server ID)
|
|
|
|
var userList = {}; // List of pretty name of all users (mapped with their server ID)
|
|
|
@ -163,19 +167,19 @@ define([
|
|
|
|
var createChangeName = function(id, $container) {
|
|
|
|
var createChangeName = function(id, $container) {
|
|
|
|
var buttonElmt = $container.find('#'+id)[0];
|
|
|
|
var buttonElmt = $container.find('#'+id)[0];
|
|
|
|
buttonElmt.addEventListener("click", function() {
|
|
|
|
buttonElmt.addEventListener("click", function() {
|
|
|
|
var newName = window.prompt("Change your name :");
|
|
|
|
Cryptpad.prompt("Change your name:", '', function (newName) {
|
|
|
|
if (newName && newName.trim()) {
|
|
|
|
if (!(typeof(newName) === 'string' && newName.trim())) { return; }
|
|
|
|
var myUserNameTemp = newName.trim();
|
|
|
|
var myUserNameTemp = newName.trim();
|
|
|
|
if(newName.trim().length > 32) {
|
|
|
|
if(newName.trim().length > 32) {
|
|
|
|
myUserNameTemp = myUserNameTemp.substr(0, 32);
|
|
|
|
myUserNameTemp = myUserNameTemp.substr(0, 32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
myUserName = myUserNameTemp;
|
|
|
|
myUserName = myUserNameTemp;
|
|
|
|
myData[myID] = {
|
|
|
|
myData[myID] = {
|
|
|
|
name: myUserName
|
|
|
|
name: myUserName
|
|
|
|
};
|
|
|
|
};
|
|
|
|
addToUserList(myData);
|
|
|
|
addToUserList(myData);
|
|
|
|
onLocal();
|
|
|
|
onLocal();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -228,16 +232,16 @@ define([
|
|
|
|
.addClass('rightside-button')
|
|
|
|
.addClass('rightside-button')
|
|
|
|
.text('RENAME')
|
|
|
|
.text('RENAME')
|
|
|
|
.click(function () {
|
|
|
|
.click(function () {
|
|
|
|
var title = window.prompt("How would you like this pad to be titled?",
|
|
|
|
Cryptpad.prompt("How would you like this pad to be titled?",
|
|
|
|
Cryptpad.getPadTitle());
|
|
|
|
Cryptpad.getPadTitle(), function (title, ev) {
|
|
|
|
|
|
|
|
if (title === null) { return; }
|
|
|
|
if (title === null) { return; }
|
|
|
|
if (Cryptpad.causesNamingConflict(title)) {
|
|
|
|
if (Cryptpad.causesNamingConflict(title)) {
|
|
|
|
Cryptpad.alert("Another pad already has that title");
|
|
|
|
window.alert("Another pad already has that title");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Cryptpad.setPadTitle(title);
|
|
|
|
Cryptpad.setPadTitle(title);
|
|
|
|
document.title = title;
|
|
|
|
document.title = title;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$rightside.append($setTitle);
|
|
|
|
$rightside.append($setTitle);
|
|
|
|
|
|
|
|
|
|
|
@ -250,11 +254,11 @@ define([
|
|
|
|
.click(function () {
|
|
|
|
.click(function () {
|
|
|
|
var href = window.location.href;
|
|
|
|
var href = window.location.href;
|
|
|
|
var question = "Clicking OK will remove the URL for this pad from localStorage, are you sure?";
|
|
|
|
var question = "Clicking OK will remove the URL for this pad from localStorage, are you sure?";
|
|
|
|
|
|
|
|
Cryptpad.confirm(question, function (yes) {
|
|
|
|
if (window.confirm(question)) {
|
|
|
|
if (!yes) { return; }
|
|
|
|
Cryptpad.forgetPad(href);
|
|
|
|
Cryptpad.forgetPad(href);
|
|
|
|
document.title = window.location.hash.slice(1,9);
|
|
|
|
document.title = window.location.hash.slice(1,9);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$rightside.append($forgetPad);
|
|
|
|
$rightside.append($forgetPad);
|
|
|
|
|
|
|
|
|
|
|
@ -302,6 +306,8 @@ define([
|
|
|
|
window.location.hash = info.channel + secret.key;
|
|
|
|
window.location.hash = info.channel + secret.key;
|
|
|
|
var title = document.title = Cryptpad.getPadTitle();
|
|
|
|
var title = document.title = Cryptpad.getPadTitle();
|
|
|
|
Cryptpad.rememberPad(title);
|
|
|
|
Cryptpad.rememberPad(title);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cryptpad.styleAlerts();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var updateUserList = function(shjson) {
|
|
|
|
var updateUserList = function(shjson) {
|
|
|
|