|
|
@ -183,17 +183,23 @@ define([
|
|
|
|
var config = {
|
|
|
|
var config = {
|
|
|
|
userData: userList,
|
|
|
|
userData: userList,
|
|
|
|
changeNameID: 'cryptpad-changeName',
|
|
|
|
changeNameID: 'cryptpad-changeName',
|
|
|
|
exportContentID: 'cryptpad-saveContent',
|
|
|
|
|
|
|
|
importContentID: 'cryptpad-loadContent',
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
toolbar = info.realtime.toolbar = Toolbar.create($bar, info.myID, info.realtime, info.getLag, info.userList, config);
|
|
|
|
toolbar = info.realtime.toolbar = Toolbar.create($bar, info.myID, info.realtime, info.getLag, info.userList, config);
|
|
|
|
createChangeName('cryptpad-changeName', $bar);
|
|
|
|
createChangeName('cryptpad-changeName', $bar);
|
|
|
|
|
|
|
|
|
|
|
|
/* Let the user export their content with a click */
|
|
|
|
var $rightside = $bar.find('.rtwysiwyg-toolbar-rightside');
|
|
|
|
$bar.find('#cryptpad-saveContent').click(exportText);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Let the user import content with a click */
|
|
|
|
/* add an export button */
|
|
|
|
$bar.find('#cryptpad-loadContent')
|
|
|
|
var $export = $('<button>')
|
|
|
|
|
|
|
|
.text('EXPORT')
|
|
|
|
|
|
|
|
.addClass('rightside-button')
|
|
|
|
|
|
|
|
.click(exportText);
|
|
|
|
|
|
|
|
$rightside.append($export);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* add an import button */
|
|
|
|
|
|
|
|
var $import = $('<button>')
|
|
|
|
|
|
|
|
.text('IMPORT')
|
|
|
|
|
|
|
|
.addClass('rightside-button')
|
|
|
|
.click(Cryptpad.importContent('text/plain', function (content, file) {
|
|
|
|
.click(Cryptpad.importContent('text/plain', function (content, file) {
|
|
|
|
var mime = CodeMirror.findModeByMIME(file.type);
|
|
|
|
var mime = CodeMirror.findModeByMIME(file.type);
|
|
|
|
|
|
|
|
|
|
|
@ -211,11 +217,14 @@ define([
|
|
|
|
editor.setValue(content);
|
|
|
|
editor.setValue(content);
|
|
|
|
onLocal();
|
|
|
|
onLocal();
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
|
|
|
|
$rightside.append($import);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* add a rename button */
|
|
|
|
var $setTitle = $('<button>', {
|
|
|
|
var $setTitle = $('<button>', {
|
|
|
|
id: 'name-pad'
|
|
|
|
id: 'name-pad'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.addClass('cryptpad-rename')
|
|
|
|
.addClass('rightside-button')
|
|
|
|
|
|
|
|
.text('RENAME')
|
|
|
|
.click(function () {
|
|
|
|
.click(function () {
|
|
|
|
var title = window.prompt("How would you like this pad to be titled?",
|
|
|
|
var title = window.prompt("How would you like this pad to be titled?",
|
|
|
|
Cryptpad.getPadTitle());
|
|
|
|
Cryptpad.getPadTitle());
|
|
|
@ -228,9 +237,24 @@ define([
|
|
|
|
Cryptpad.setPadTitle(title);
|
|
|
|
Cryptpad.setPadTitle(title);
|
|
|
|
document.title = title;
|
|
|
|
document.title = title;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
$rightside.append($setTitle);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* add a forget button */
|
|
|
|
|
|
|
|
var $forgetPad = $('<button>', {
|
|
|
|
|
|
|
|
id: 'cryptpad-forget',
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.text('FORGET')
|
|
|
|
|
|
|
|
.addClass('cryptpad-forget rightside-button')
|
|
|
|
|
|
|
|
.click(function () {
|
|
|
|
|
|
|
|
var href = window.location.href;
|
|
|
|
|
|
|
|
var question = "Clicking OK will remove the URL for this pad from localStorage, are you sure?";
|
|
|
|
|
|
|
|
|
|
|
|
$bar.find('.rtwysiwyg-toolbar-rightside')
|
|
|
|
if (window.confirm(question)) {
|
|
|
|
.append($setTitle);
|
|
|
|
Cryptpad.forgetPad(href);
|
|
|
|
|
|
|
|
document.title = window.location.hash.slice(1,9);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
$rightside.append($forgetPad);
|
|
|
|
|
|
|
|
|
|
|
|
/* Let the user select different syntax highlighting modes */
|
|
|
|
/* Let the user select different syntax highlighting modes */
|
|
|
|
var syntaxDropdown = '<select title="syntax highlighting" id="language-mode">\n' +
|
|
|
|
var syntaxDropdown = '<select title="syntax highlighting" id="language-mode">\n' +
|
|
|
@ -252,16 +276,14 @@ define([
|
|
|
|
}).join('\n') +
|
|
|
|
}).join('\n') +
|
|
|
|
'</select>';
|
|
|
|
'</select>';
|
|
|
|
|
|
|
|
|
|
|
|
$bar.find('.rtwysiwyg-toolbar-rightside')
|
|
|
|
$rightside.append(syntaxDropdown);
|
|
|
|
.append(syntaxDropdown);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $language = module.$language = $bar.find('#language-mode').on('change', function () {
|
|
|
|
var $language = module.$language = $bar.find('#language-mode').on('change', function () {
|
|
|
|
var mode = $language.val();
|
|
|
|
var mode = $language.val();
|
|
|
|
setMode(mode);
|
|
|
|
setMode(mode);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$bar.find('.rtwysiwyg-toolbar-rightside')
|
|
|
|
$rightside.append(themeDropdown);
|
|
|
|
.append(themeDropdown);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $theme = $bar.find('select#display-theme');
|
|
|
|
var $theme = $bar.find('select#display-theme');
|
|
|
|
|
|
|
|
|
|
|
|