Fix race condition

pull/1/head
yflory 4 years ago
parent 32103d13d7
commit ead767658f

@ -1,3 +1,18 @@
(function () {
try {
var req = JSON.parse(decodeURIComponent(window.location.hash.substring(1)));
var theme = req.theme;
var os = req.themeOS;
window.CryptPad_theme = theme || os;
if ((theme || os) === 'dark') {
var s = document.createElement('style');
s.innerHTML = 'body { background: black; }';
document.body.appendChild(s);
}
console.error(theme, os);
} catch (e) { console.error(e); }
})();
require(['/customize/loading.js'], function (Loading) { require(['/customize/loading.js'], function (Loading) {
Loading(); Loading();
}); });

@ -1,13 +1,3 @@
(function () {
try {
if (!window.cryptpadStore) { return; }
var theme = window.cryptpadStore.store['colortheme'];
var os = window.cryptpadStore.store['colortheme_default'];
window.CryptPad_theme = theme || os;
console.error(theme, os);
} catch (e) { console.error(e); }
})();
// This is stage 1, it can be changed but you must bump the version of the project. // This is stage 1, it can be changed but you must bump the version of the project.
// Note: This must only be loaded from inside of a sandbox-iframe. // Note: This must only be loaded from inside of a sandbox-iframe.
define([ define([

@ -11,10 +11,13 @@ define([
common.initIframe = function (waitFor, isRt, pathname) { common.initIframe = function (waitFor, isRt, pathname) {
var requireConfig = RequireConfig(); var requireConfig = RequireConfig();
var lang = Messages._languageUsed; var lang = Messages._languageUsed;
var themeKey = 'CRYPTPAD_STORE|colortheme';
var req = { var req = {
cfg: requireConfig, cfg: requireConfig,
req: [ '/common/loading.js' ], req: [ '/common/loading.js' ],
pfx: window.location.origin, pfx: window.location.origin,
theme: localStorage[themeKey],
themeOS: localStorage[themeKey+'_default'],
lang: lang lang: lang
}; };
window.rc = requireConfig; window.rc = requireConfig;

Loading…
Cancel
Save