|
|
@ -1,5 +1,5 @@
|
|
|
|
define([
|
|
|
|
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/messages.js?app=' + window.location.pathname.split('/').filter(function (x) { return x; }).join('.'),
|
|
|
|
'/customize/fsStore.js',
|
|
|
|
'/customize/fsStore.js',
|
|
|
|
'/bower_components/chainpad-crypto/crypto.js?v=0.1.5',
|
|
|
|
'/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 = function (o) { return Object.prototype.toString.call(o) === '[object Array]'; };
|
|
|
|
var isArray = common.isArray = $.isArray;
|
|
|
|
var isArray = common.isArray = $.isArray;
|
|
|
|
|
|
|
|
|
|
|
|
var fixHTML = common.fixHTML = function (html) {
|
|
|
|
var fixHTML = common.fixHTML = function (str) {
|
|
|
|
return html.replace(/</g, '<');
|
|
|
|
return str.replace(/[<>&"']/g, function (x) {
|
|
|
|
|
|
|
|
return ({ "<": "<", ">": ">", "&": "&", '"': """, "'": "'" })[x];
|
|
|
|
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var truncate = common.truncate = function (text, len) {
|
|
|
|
var truncate = common.truncate = function (text, len) {
|
|
|
|
if (typeof(text) === 'string' && text.length > len) {
|
|
|
|
if (typeof(text) === 'string' && text.length > len) {
|
|
|
|
return text.slice(0, len) + '…';
|
|
|
|
return text.slice(0, len) + '…';
|
|
|
@ -835,7 +838,7 @@ define([
|
|
|
|
if (!$('#' + LOADING).is(':visible')) { common.addLoadingScreen(); }
|
|
|
|
if (!$('#' + LOADING).is(':visible')) { common.addLoadingScreen(); }
|
|
|
|
$('.spinnerContainer').hide();
|
|
|
|
$('.spinnerContainer').hide();
|
|
|
|
if (transparent) { $('#' + LOADING).css('opacity', 0.8); }
|
|
|
|
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 {
|
|
|
|
} else {
|
|
|
|
callback();
|
|
|
|
callback();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
common.alert(Messages.movedToTrash);
|
|
|
|
common.alert(Messages.movedToTrash, undefined, true);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -1142,13 +1145,15 @@ define([
|
|
|
|
var $displayedName = $('<span>', {'class': config.displayNameCls || 'displayName'});
|
|
|
|
var $displayedName = $('<span>', {'class': config.displayNameCls || 'displayName'});
|
|
|
|
var accountName = localStorage[common.userNameKey];
|
|
|
|
var accountName = localStorage[common.userNameKey];
|
|
|
|
var account = isLoggedIn();
|
|
|
|
var account = isLoggedIn();
|
|
|
|
|
|
|
|
var $userName = $('<span>', {'class': 'userDisplayName'});
|
|
|
|
|
|
|
|
var options = [];
|
|
|
|
|
|
|
|
if (config.displayNameCls) {
|
|
|
|
var $userAdminContent = $('<p>');
|
|
|
|
var $userAdminContent = $('<p>');
|
|
|
|
if (account) {
|
|
|
|
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($userAccount);
|
|
|
|
$userAdminContent.append($('<br>'));
|
|
|
|
$userAdminContent.append($('<br>'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var $userName = $('<span>', {'class': 'userDisplayName'});
|
|
|
|
|
|
|
|
if (config.displayName) {
|
|
|
|
if (config.displayName) {
|
|
|
|
// Hide "Display name:" in read only mode
|
|
|
|
// Hide "Display name:" in read only mode
|
|
|
|
$userName.append(Messages.user_displayName + ': ');
|
|
|
|
$userName.append(Messages.user_displayName + ': ');
|
|
|
@ -1156,8 +1161,6 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//$userName.append($displayedName.clone()); TODO remove ?
|
|
|
|
//$userName.append($displayedName.clone()); TODO remove ?
|
|
|
|
$userAdminContent.append($userName);
|
|
|
|
$userAdminContent.append($userName);
|
|
|
|
var options = [];
|
|
|
|
|
|
|
|
if (config.displayNameCls) {
|
|
|
|
|
|
|
|
options.push({
|
|
|
|
options.push({
|
|
|
|
tag: 'p',
|
|
|
|
tag: 'p',
|
|
|
|
attributes: {'class': 'accountData'},
|
|
|
|
attributes: {'class': 'accountData'},
|
|
|
@ -1289,8 +1292,9 @@ define([
|
|
|
|
$(window).off('keyup', handler);
|
|
|
|
$(window).off('keyup', handler);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
common.alert = function (msg, cb) {
|
|
|
|
common.alert = function (msg, cb, force) {
|
|
|
|
cb = cb || function () {};
|
|
|
|
cb = cb || function () {};
|
|
|
|
|
|
|
|
if (force !== true) { msg = fixHTML(msg); }
|
|
|
|
var keyHandler = listenForKeys(function (e) { // yes
|
|
|
|
var keyHandler = listenForKeys(function (e) { // yes
|
|
|
|
findOKButton().click();
|
|
|
|
findOKButton().click();
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -1303,9 +1307,10 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
common.prompt = function (msg, def, cb, opt) {
|
|
|
|
common.prompt = function (msg, def, cb, opt, force) {
|
|
|
|
opt = opt || {};
|
|
|
|
opt = opt || {};
|
|
|
|
cb = cb || function () {};
|
|
|
|
cb = cb || function () {};
|
|
|
|
|
|
|
|
if (force !== true) { msg = fixHTML(msg); }
|
|
|
|
|
|
|
|
|
|
|
|
var keyHandler = listenForKeys(function (e) { // yes
|
|
|
|
var keyHandler = listenForKeys(function (e) { // yes
|
|
|
|
findOKButton().click();
|
|
|
|
findOKButton().click();
|
|
|
@ -1326,9 +1331,11 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
common.confirm = function (msg, cb, opt) {
|
|
|
|
common.confirm = function (msg, cb, opt, force) {
|
|
|
|
opt = opt || {};
|
|
|
|
opt = opt || {};
|
|
|
|
cb = cb || function () {};
|
|
|
|
cb = cb || function () {};
|
|
|
|
|
|
|
|
if (force !== true) { msg = fixHTML(msg); }
|
|
|
|
|
|
|
|
|
|
|
|
var keyHandler = listenForKeys(function (e) {
|
|
|
|
var keyHandler = listenForKeys(function (e) {
|
|
|
|
findOKButton().click();
|
|
|
|
findOKButton().click();
|
|
|
|
}, function (e) {
|
|
|
|
}, function (e) {
|
|
|
@ -1348,11 +1355,11 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
common.log = function (msg) {
|
|
|
|
common.log = function (msg) {
|
|
|
|
Alertify.success(msg);
|
|
|
|
Alertify.success(fixHTML(msg));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
common.warn = function (msg) {
|
|
|
|
common.warn = function (msg) {
|
|
|
|
Alertify.error(msg);
|
|
|
|
Alertify.error(fixHTML(msg));
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|