Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

pull/1/head
ansuz 7 years ago
commit 0e8a26e8eb

@ -116,7 +116,7 @@ define([
$('button.login').click(function () { $('button.login').click(function () {
// setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up // setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up
window.setTimeout(function () { window.setTimeout(function () {
Cryptpad.addLoadingScreen(Messages.login_hashing); Cryptpad.addLoadingScreen({loadingText: Messages.login_hashing});
// We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password // We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password
window.setTimeout(function () { window.setTimeout(function () {
loginReady(function () { loginReady(function () {

@ -193,7 +193,11 @@ define([
var rdm = Math.floor(Math.random() * keys.length); var rdm = Math.floor(Math.random() * keys.length);
return Messages.tips[keys[rdm]]; return Messages.tips[keys[rdm]];
}; };
UI.addLoadingScreen = function (loadingText, hideTips) { UI.addLoadingScreen = function (config) {
config = config || {};
var loadingText = config.loadingText;
var hideTips = config.hideTips;
var hideLogo = config.hideLogo;
var $loading, $container; var $loading, $container;
if ($('#' + LOADING).length) { if ($('#' + LOADING).length) {
$loading = $('#' + LOADING).show(); $loading = $('#' + LOADING).show();
@ -204,7 +208,9 @@ define([
} else { } else {
$loading = $('<div>', {id: LOADING}); $loading = $('<div>', {id: LOADING});
$container = $('<div>', {'class': 'loadingContainer'}); $container = $('<div>', {'class': 'loadingContainer'});
$container.append('<img class="cryptofist" src="/customize/cryptofist_small.png" />'); if (!hideLogo) {
$container.append('<img class="cryptofist" src="/customize/cryptofist_small.png" />');
}
var $spinner = $('<div>', {'class': 'spinnerContainer'}); var $spinner = $('<div>', {'class': 'spinnerContainer'});
UI.spinner($spinner).show(); UI.spinner($spinner).show();
var $text = $('<p>').text(loadingText || Messages.loading); var $text = $('<p>').text(loadingText || Messages.loading);
@ -236,7 +242,7 @@ define([
// jquery.fadeout can get stuck // jquery.fadeout can get stuck
}; };
UI.errorLoadingScreen = function (error, transparent) { UI.errorLoadingScreen = function (error, transparent) {
if (!$('#' + LOADING).is(':visible')) { UI.addLoadingScreen(undefined, true); } if (!$('#' + LOADING).is(':visible')) { UI.addLoadingScreen({hideTips: true}); }
$('.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').html(error || Messages.error);

@ -603,7 +603,7 @@ define([
e.preventDefault(); e.preventDefault();
var parsed = parsePadUrl(t.href); var parsed = parsePadUrl(t.href);
if(!parsed) { throw new Error("Cannot get template hash"); } if(!parsed) { throw new Error("Cannot get template hash"); }
common.addLoadingScreen(null, true); common.addLoadingScreen({hideTips: true});
Crypt.get(parsed.hash, function (err, val) { Crypt.get(parsed.hash, function (err, val) {
if (err) { throw new Error(err); } if (err) { throw new Error(err); }
var p = parsePadUrl(window.location.href); var p = parsePadUrl(window.location.href);

@ -274,7 +274,7 @@ define([
} }
}); });
Cryptpad.logout(); Cryptpad.logout();
Cryptpad.addLoadingScreen(undefined, true); Cryptpad.addLoadingScreen({hideTips: true});
Cryptpad.errorLoadingScreen(Cryptpad.Messages.onLogout, true); Cryptpad.errorLoadingScreen(Cryptpad.Messages.onLogout, true);
if (exp.info) { if (exp.info) {
exp.info.network.disconnect(); exp.info.network.disconnect();

@ -280,7 +280,7 @@ define([
var fileDialogCfg = { var fileDialogCfg = {
onSelect: function (data) { onSelect: function (data) {
if (data.type === type && first) { if (data.type === type && first) {
Cryptpad.addLoadingScreen(null, true); Cryptpad.addLoadingScreen({hideTips: true});
var sframeChan = common.getSframeChannel(); var sframeChan = common.getSframeChannel();
sframeChan.query('Q_TEMPLATE_USE', data.href, function () { sframeChan.query('Q_TEMPLATE_USE', data.href, function () {
first = false; first = false;

@ -272,6 +272,7 @@ define([
FP.$iframe.show(); FP.$iframe.show();
FP.picker.refresh(types); FP.picker.refresh(types);
} }
FP.$iframe.focus();
}; };
sframeChan.on('EV_FILE_PICKER_OPEN', function (data) { sframeChan.on('EV_FILE_PICKER_OPEN', function (data) {
initFilePicker(data); initFilePicker(data);

@ -17,6 +17,9 @@
body #loading .loadingContainer { body #loading .loadingContainer {
margin-top: 35vh; margin-top: 35vh;
} }
body #loading .cryptofist {
display: none;
}
</style> </style>
</head> </head>
<body class="cp-app-filepicker" style="background: transparent;"> <body class="cp-app-filepicker" style="background: transparent;">

@ -161,7 +161,7 @@ define([
nThen(function (waitFor) { nThen(function (waitFor) {
$(waitFor(function () { $(waitFor(function () {
Cryptpad.addLoadingScreen(null, true); Cryptpad.addLoadingScreen({hideTips: true, hideLogo: true});
})); }));
SFCommon.create(waitFor(function (c) { APP.common = common = c; })); SFCommon.create(waitFor(function (c) { APP.common = common = c; }));
}).nThen(function (/*waitFor*/) { }).nThen(function (/*waitFor*/) {

@ -72,7 +72,7 @@ define([
// setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up // setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up
window.setTimeout(function () { window.setTimeout(function () {
Cryptpad.addLoadingScreen(Messages.login_hashing); Cryptpad.addLoadingScreen({loadingText: Messages.login_hashing});
// We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password // We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password
window.setTimeout(function () { window.setTimeout(function () {
loginReady(function () { loginReady(function () {

@ -128,7 +128,7 @@ define([
registering = true; registering = true;
// setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up // setTimeout 100ms to remove the keyboard on mobile devices before the loading screen pops up
window.setTimeout(function () { window.setTimeout(function () {
Cryptpad.addLoadingScreen(Messages.login_hashing); Cryptpad.addLoadingScreen({loadingText: Messages.login_hashing});
// We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password // We need a setTimeout(cb, 0) otherwise the loading screen is only displayed after hashing the password
window.setTimeout(function () { window.setTimeout(function () {
Login.loginOrRegister(uname, passwd, true, function (err, result) { Login.loginOrRegister(uname, passwd, true, function (err, result) {

Loading…
Cancel
Save