use alertify UI in /code/

pull/1/head
ansuz 9 years ago
parent deae7ac78f
commit e32c0aaac8

@ -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) {
if (filename === null) { return; }
var blob = new Blob([text], {
type: 'text/plain;charset=utf-8'
});
saveAs(blob, filename); 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,8 +167,8 @@ 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);
@ -175,7 +179,7 @@ define([
}; };
addToUserList(myData); addToUserList(myData);
onLocal(); onLocal();
} });
}); });
}; };
@ -228,17 +232,17 @@ 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)) {
window.alert("Another pad already has that title"); Cryptpad.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);
/* add a forget button */ /* add a forget button */
@ -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) {

Loading…
Cancel
Save