|
|
|
@ -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,13 @@ 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) {
|
|
|
|
|
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) + '…';
|
|
|
|
@ -835,7 +838,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);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -958,7 +961,7 @@ define([
|
|
|
|
|
} else {
|
|
|
|
|
callback();
|
|
|
|
|
}
|
|
|
|
|
common.alert(Messages.movedToTrash);
|
|
|
|
|
common.alert(Messages.movedToTrash, undefined, true);
|
|
|
|
|
return;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
@ -1142,13 +1145,15 @@ define([
|
|
|
|
|
var $displayedName = $('<span>', {'class': config.displayNameCls || 'displayName'});
|
|
|
|
|
var accountName = localStorage[common.userNameKey];
|
|
|
|
|
var account = isLoggedIn();
|
|
|
|
|
var $userName = $('<span>', {'class': 'userDisplayName'});
|
|
|
|
|
var options = [];
|
|
|
|
|
if (config.displayNameCls) {
|
|
|
|
|
var $userAdminContent = $('<p>');
|
|
|
|
|
if (account) {
|
|
|
|
|
var $userAccount = $('<span>', {'class': 'userAccount'}).append(Messages.user_accountName + ': ' + accountName);
|
|
|
|
|
var $userAccount = $('<span>', {'class': 'userAccount'}).append(Messages.user_accountName + ': ' + fixHTML(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 + ': ');
|
|
|
|
@ -1156,8 +1161,6 @@ define([
|
|
|
|
|
}
|
|
|
|
|
//$userName.append($displayedName.clone()); TODO remove ?
|
|
|
|
|
$userAdminContent.append($userName);
|
|
|
|
|
var options = [];
|
|
|
|
|
if (config.displayNameCls) {
|
|
|
|
|
options.push({
|
|
|
|
|
tag: 'p',
|
|
|
|
|
attributes: {'class': 'accountData'},
|
|
|
|
@ -1289,8 +1292,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();
|
|
|
|
|
});
|
|
|
|
@ -1303,9 +1307,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();
|
|
|
|
@ -1326,9 +1331,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) {
|
|
|
|
@ -1348,11 +1355,11 @@ define([
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
common.log = function (msg) {
|
|
|
|
|
Alertify.success(msg);
|
|
|
|
|
Alertify.success(fixHTML(msg));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
common.warn = function (msg) {
|
|
|
|
|
Alertify.error(msg);
|
|
|
|
|
Alertify.error(fixHTML(msg));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|