Fix Flash Of Unstyled Content (fouc)

This commit is contained in:
yflory
2016-12-21 18:33:21 +01:00
parent 046220f239
commit 87abfff66b
14 changed files with 149 additions and 51 deletions

View File

@@ -22,6 +22,11 @@ define([
var secret = Cryptpad.getSecrets();
var readOnly = secret.keys && !secret.keys.editKeyStr;
Cryptpad.addLoadingScreen();
var onConnectError = function (info) {
Cryptpad.errorLoadingScreen(Messages.websocketError);
};
var APP = window.APP = {
Toolbar: Toolbar,
Hyperjson: Hyperjson,
@@ -566,6 +571,7 @@ define([
} else {
publish(true);
}
Cryptpad.removeLoadingScreen();
// Update the toolbar list:
// Add the current user in the metadata if he has edit rights
@@ -662,11 +668,7 @@ define([
var disconnect = function (info) {
//setEditable(false); // TODO
if (info.error) {
Cryptpad.alert(Messages.websocketError);
return;
}
//Cryptpad.alert(Messages.common_connectionLost); // TODO
Cryptpad.alert(Messages.common_connectionLost);
};
var config = {
@@ -715,5 +717,10 @@ define([
}
});
});
Cryptpad.onError(function (info) {
if (info) {
onConnectError();
}
});
});