From 07f4878d59a7459472e66a2ba0c1c0413232107e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 15 Dec 2019 11:57:26 +0300 Subject: workaround for a race condition between dojo.parse() and tt-rss loading proper day/night css on startup because of firefox async CSS loader --- js/tt-rss.js | 56 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 27 deletions(-) (limited to 'js/tt-rss.js') diff --git a/js/tt-rss.js b/js/tt-rss.js index 8868fa7a5..84e42bf85 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -67,33 +67,35 @@ require(["dojo/_base/kernel", _widescreen_mode: false, hotkey_actions: {}, constructor: function () { - parser.parse(); - - if (!this.checkBrowserFeatures()) - return; - - this.setLoadingProgress(30); - this.initHotkeyActions(); - - const a = document.createElement('audio'); - const hasAudio = !!a.canPlayType; - const hasSandbox = "sandbox" in document.createElement("iframe"); - const hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, '')); - const clientTzOffset = new Date().getTimezoneOffset() * 60; - - const params = { - op: "rpc", method: "sanityCheck", hasAudio: hasAudio, - hasMp3: hasMp3, - clientTzOffset: clientTzOffset, - hasSandbox: hasSandbox - }; - - xhrPost("backend.php", params, (transport) => { - try { - App.backendSanityCallback(transport); - } catch (e) { - App.Error.report(e); - } + this.setupNightModeDetection(() => { + parser.parse(); + + if (!this.checkBrowserFeatures()) + return; + + this.setLoadingProgress(30); + this.initHotkeyActions(); + + const a = document.createElement('audio'); + const hasAudio = !!a.canPlayType; + const hasSandbox = "sandbox" in document.createElement("iframe"); + const hasMp3 = !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, '')); + const clientTzOffset = new Date().getTimezoneOffset() * 60; + + const params = { + op: "rpc", method: "sanityCheck", hasAudio: hasAudio, + hasMp3: hasMp3, + clientTzOffset: clientTzOffset, + hasSandbox: hasSandbox + }; + + xhrPost("backend.php", params, (transport) => { + try { + App.backendSanityCallback(transport); + } catch (e) { + App.Error.report(e); + } + }); }); }, checkBrowserFeatures: function() { -- cgit v1.2.3