From 8ffad5ece61c3a95df07a7cbd42e72ca4d28ab81 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 30 Jun 2017 16:10:42 +0200 Subject: [PATCH 1/3] FOUC fixes --- customize.dist/template.js | 47 +++++++++++--------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/customize.dist/template.js b/customize.dist/template.js index 41de264b4..e26ef9c6d 100644 --- a/customize.dist/template.js +++ b/customize.dist/template.js @@ -12,7 +12,6 @@ $(function () { var Messages = Cryptpad.Messages; var $body = $('body'); var isMainApp = function () { - console.error("Checking if is main app"); return /^\/(pad|code|slide|poll|whiteboard|file|media|drive)\/$/.test(location.pathname); }; @@ -119,57 +118,37 @@ $(function () { var pathname = location.pathname; if (isMainApp()) { - console.log("Is main app"); if (typeof(Pages[pathname]) === 'function') { + var $flash = $('body, #iframe-container, #pad-iframe').removeClass('noscroll'); + $flash.css({ + 'display': 'none' + }); + var ready = function () { $flash.css('display', ''); }; + require([ 'less!/customize/src/less/loading.less' ], function () { - //$('body').html(h('body', Pages[pathname]()).innerHTML); - - console.log("TEMPLATED"); - if (/whiteboard/.test(pathname)) { $('body').html(h('body', Pages[pathname]()).innerHTML); - setTimeout(function () { - require(['/whiteboard/main.js'], function () { - $('body').removeClass('noscroll'); - }); - }); + require(['/whiteboard/main.js'], ready); } else if (/poll/.test(pathname)) { $('body').html(h('body', Pages[pathname]()).innerHTML); - setTimeout(function () { - require(['/poll/main.js'], function () { - $('body').removeClass('noscroll'); - console.log("TEMPLATE!"); - }); - }); + require(['/poll/main.js'], ready); } else if (/drive/.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML); - setTimeout(function () { - require(['/drive/main.js'], function () { - console.log("Templating done"); - }); - }); + require(['/drive/main.js'], ready); } else if (/file/.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML); - require([ '/file/main.js' ], function () { - console.log("Templating done"); - }); + require([ '/file/main.js' ], ready); } else if (/pad/.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML); - require([ '/pad/main.js' ], function () { - console.log("Templating done"); - }); + require([ '/pad/main.js' ], ready); } else if (/code/.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML); - require([ '/code/main.js' ], function () { - console.log("Templating done"); - }); + require([ '/code/main.js' ], ready); } else if (/slide/.test(pathname)) { $('body').append(h('body', Pages[pathname]()).innerHTML); - require([ '/slide/main.js' ], function () { - console.log("Templating done"); - }); + require([ '/slide/main.js' ], ready); } }); From 73cfecdf0892fcabf5241df328ccbc9e04d791a9 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 30 Jun 2017 16:12:03 +0200 Subject: [PATCH 2/3] note which node version we use --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 4ed335c9e..2c5b6e895 100644 --- a/readme.md +++ b/readme.md @@ -23,7 +23,7 @@ to others who want to participate. Cryptpad depends on the Nodejs runtime. We recommend installing it via [NVM](https://github.com/creationix/nvm "Node Version Manager") to ensure that you are running an up to date version. -Once you have a recent runtime: +Once you have a recent runtime (we use v6.6.0): ``` git clone From c2e153e8ed92a48458bb4b9dc85072e82d429894 Mon Sep 17 00:00:00 2001 From: ansuz Date: Fri, 30 Jun 2017 16:20:10 +0200 Subject: [PATCH 3/3] more fouc fixes --- customize.dist/template.js | 14 +++++++++++--- www/whiteboard/index.html | 3 +-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/customize.dist/template.js b/customize.dist/template.js index e26ef9c6d..ad00c5170 100644 --- a/customize.dist/template.js +++ b/customize.dist/template.js @@ -119,11 +119,19 @@ $(function () { if (isMainApp()) { if (typeof(Pages[pathname]) === 'function') { - var $flash = $('body, #iframe-container, #pad-iframe').removeClass('noscroll'); + var $flash = $('body, #iframe-container, #pad-iframe, textarea'); $flash.css({ - 'display': 'none' + display: 'none', + opacity: 0, + overflow: 'hidden', }); - var ready = function () { $flash.css('display', ''); }; + var ready = function () { + $flash.css({ + display: '', + opacity: '', + overflow: '', + }); + }; require([ 'less!/customize/src/less/loading.less' diff --git a/www/whiteboard/index.html b/www/whiteboard/index.html index dde6a61f2..a31384187 100644 --- a/www/whiteboard/index.html +++ b/www/whiteboard/index.html @@ -4,7 +4,6 @@ - - +