|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
define([
|
|
|
|
|
'/api/config?cb=' + Math.random().toString(16).slice(2),
|
|
|
|
|
'/api/config',
|
|
|
|
|
'/customize/messages.js?app=' + window.location.pathname.split('/').filter(function (x) { return x; }).join('.'),
|
|
|
|
|
'/customize/fsStore.js',
|
|
|
|
|
'/bower_components/chainpad-crypto/crypto.js?v=0.1.5',
|
|
|
|
@ -163,10 +163,14 @@ define([
|
|
|
|
|
// var isArray = function (o) { return Object.prototype.toString.call(o) === '[object Array]'; };
|
|
|
|
|
var isArray = common.isArray = $.isArray;
|
|
|
|
|
|
|
|
|
|
var fixHTML = common.fixHTML = function (html) {
|
|
|
|
|
return html.replace(/</g, '<');
|
|
|
|
|
var fixHTML = common.fixHTML = function (str) {
|
|
|
|
|
if (!str) { return ''; }
|
|
|
|
|
return str.replace(/[<>&"']/g, function (x) {
|
|
|
|
|
return ({ "<": "<", ">": ">", "&": "&", '"': """, "'": "'" })[x];
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var truncate = common.truncate = function (text, len) {
|
|
|
|
|
if (typeof(text) === 'string' && text.length > len) {
|
|
|
|
|
return text.slice(0, len) + '…';
|
|
|
|
@ -851,7 +855,7 @@ define([
|
|
|
|
|
if (!$('#' + LOADING).is(':visible')) { common.addLoadingScreen(); }
|
|
|
|
|
$('.spinnerContainer').hide();
|
|
|
|
|
if (transparent) { $('#' + LOADING).css('opacity', 0.8); }
|
|
|
|
|
$('#' + LOADING).find('p').html(error || Messages.error);
|
|
|
|
|
$('#' + LOADING).find('p').text(error || Messages.error);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -924,7 +928,7 @@ define([
|
|
|
|
|
switch (type) {
|
|
|
|
|
case 'export':
|
|
|
|
|
button = $('<button>', {
|
|
|
|
|
title: Messages.exportButton + '\n' + Messages.exportButtonTitle,
|
|
|
|
|
title: Messages.exportButtonTitle,
|
|
|
|
|
}).append($('<span>', {'class':'fa fa-download', style: 'font:'+size+' FontAwesome'}));
|
|
|
|
|
if (callback) {
|
|
|
|
|
button.click(callback);
|
|
|
|
@ -932,7 +936,7 @@ define([
|
|
|
|
|
break;
|
|
|
|
|
case 'import':
|
|
|
|
|
button = $('<button>', {
|
|
|
|
|
title: Messages.importButton + '\n' + Messages.importButtonTitle,
|
|
|
|
|
title: Messages.importButtonTitle,
|
|
|
|
|
}).append($('<span>', {'class':'fa fa-upload', style: 'font:'+size+' FontAwesome'}));
|
|
|
|
|
if (callback) {
|
|
|
|
|
button.click(common.importContent('text/plain', function (content, file) {
|
|
|
|
@ -943,7 +947,7 @@ define([
|
|
|
|
|
case 'forget':
|
|
|
|
|
button = $('<button>', {
|
|
|
|
|
id: 'cryptpad-forget',
|
|
|
|
|
title: Messages.forgetButton + '\n' + Messages.forgetButtonTitle,
|
|
|
|
|
title: Messages.forgetButtonTitle,
|
|
|
|
|
'class': "fa fa-trash cryptpad-forget",
|
|
|
|
|
style: 'font:'+size+' FontAwesome'
|
|
|
|
|
});
|
|
|
|
@ -974,7 +978,7 @@ define([
|
|
|
|
|
} else {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
common.alert(Messages.movedToTrash);
|
|
|
|
|
common.alert(Messages.movedToTrash, undefined, true);
|
|
|
|
|
return;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
@ -1032,14 +1036,14 @@ define([
|
|
|
|
|
break;
|
|
|
|
|
case 'present':
|
|
|
|
|
button = $('<button>', {
|
|
|
|
|
title: Messages.presentButton + '\n' + Messages.presentButtonTitle,
|
|
|
|
|
title: Messages.presentButtonTitle,
|
|
|
|
|
'class': "fa fa-play-circle cryptpad-present-button", // class used in slide.js
|
|
|
|
|
style: 'font:'+size+' FontAwesome'
|
|
|
|
|
});
|
|
|
|
|
break;
|
|
|
|
|
case 'source':
|
|
|
|
|
button = $('<button>', {
|
|
|
|
|
title: Messages.sourceButton + '\n' + Messages.sourceButtonTitle,
|
|
|
|
|
title: Messages.sourceButtonTitle,
|
|
|
|
|
'class': "fa fa-stop-circle cryptpad-source-button", // class used in slide.js
|
|
|
|
|
style: 'font:'+size+' FontAwesome'
|
|
|
|
|
});
|
|
|
|
@ -1158,22 +1162,22 @@ define([
|
|
|
|
|
var $displayedName = $('<span>', {'class': config.displayNameCls || 'displayName'});
|
|
|
|
|
var accountName = localStorage[common.userNameKey];
|
|
|
|
|
var account = isLoggedIn();
|
|
|
|
|
var $userAdminContent = $('<p>');
|
|
|
|
|
if (account) {
|
|
|
|
|
var $userAccount = $('<span>', {'class': 'userAccount'}).append(Messages.user_accountName + ': ' + accountName);
|
|
|
|
|
$userAdminContent.append($userAccount);
|
|
|
|
|
$userAdminContent.append($('<br>'));
|
|
|
|
|
}
|
|
|
|
|
var $userName = $('<span>', {'class': 'userDisplayName'});
|
|
|
|
|
if (config.displayName) {
|
|
|
|
|
// Hide "Display name:" in read only mode
|
|
|
|
|
$userName.append(Messages.user_displayName + ': ');
|
|
|
|
|
$userName.append($displayedName.clone());
|
|
|
|
|
}
|
|
|
|
|
//$userName.append($displayedName.clone()); TODO remove ?
|
|
|
|
|
$userAdminContent.append($userName);
|
|
|
|
|
var options = [];
|
|
|
|
|
if (config.displayNameCls) {
|
|
|
|
|
var $userAdminContent = $('<p>');
|
|
|
|
|
if (account) {
|
|
|
|
|
var $userAccount = $('<span>', {'class': 'userAccount'}).append(Messages.user_accountName + ': ' + fixHTML(accountName));
|
|
|
|
|
$userAdminContent.append($userAccount);
|
|
|
|
|
$userAdminContent.append($('<br>'));
|
|
|
|
|
}
|
|
|
|
|
if (config.displayName) {
|
|
|
|
|
// Hide "Display name:" in read only mode
|
|
|
|
|
$userName.append(Messages.user_displayName + ': ');
|
|
|
|
|
$userName.append($displayedName.clone());
|
|
|
|
|
}
|
|
|
|
|
//$userName.append($displayedName.clone()); TODO remove ?
|
|
|
|
|
$userAdminContent.append($userName);
|
|
|
|
|
options.push({
|
|
|
|
|
tag: 'p',
|
|
|
|
|
attributes: {'class': 'accountData'},
|
|
|
|
@ -1305,8 +1309,9 @@ define([
|
|
|
|
|
$(window).off('keyup', handler);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
common.alert = function (msg, cb) {
|
|
|
|
|
common.alert = function (msg, cb, force) {
|
|
|
|
|
cb = cb || function () {};
|
|
|
|
|
if (force !== true) { msg = fixHTML(msg); }
|
|
|
|
|
var keyHandler = listenForKeys(function (e) { // yes
|
|
|
|
|
findOKButton().click();
|
|
|
|
|
});
|
|
|
|
@ -1319,9 +1324,10 @@ define([
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
common.prompt = function (msg, def, cb, opt) {
|
|
|
|
|
common.prompt = function (msg, def, cb, opt, force) {
|
|
|
|
|
opt = opt || {};
|
|
|
|
|
cb = cb || function () {};
|
|
|
|
|
if (force !== true) { msg = fixHTML(msg); }
|
|
|
|
|
|
|
|
|
|
var keyHandler = listenForKeys(function (e) { // yes
|
|
|
|
|
findOKButton().click();
|
|
|
|
@ -1342,9 +1348,11 @@ define([
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
common.confirm = function (msg, cb, opt) {
|
|
|
|
|
common.confirm = function (msg, cb, opt, force) {
|
|
|
|
|
opt = opt || {};
|
|
|
|
|
cb = cb || function () {};
|
|
|
|
|
if (force !== true) { msg = fixHTML(msg); }
|
|
|
|
|
|
|
|
|
|
var keyHandler = listenForKeys(function (e) {
|
|
|
|
|
findOKButton().click();
|
|
|
|
|
}, function (e) {
|
|
|
|
@ -1364,11 +1372,11 @@ define([
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
common.log = function (msg) {
|
|
|
|
|
Alertify.success(msg);
|
|
|
|
|
Alertify.success(fixHTML(msg));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
common.warn = function (msg) {
|
|
|
|
|
Alertify.error(msg);
|
|
|
|
|
Alertify.error(fixHTML(msg));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|