summaryrefslogtreecommitdiff
path: root/js/tt-rss.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2019-12-15 11:57:26 +0300
committerAndrew Dolgov <[email protected]>2019-12-15 11:57:26 +0300
commit07f4878d59a7459472e66a2ba0c1c0413232107e (patch)
tree872efda8bd355b8c200a75fea485b859b3b5c143 /js/tt-rss.js
parent0d6add5d7f9475d60330f233a6b62f9bb81d01c0 (diff)
workaround for a race condition between dojo.parse() and tt-rss loading proper day/night css on startup because of firefox async CSS loader
Diffstat (limited to 'js/tt-rss.js')
-rw-r--r--js/tt-rss.js56
1 files changed, 29 insertions, 27 deletions
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() {