From d154bab227cdcace1f3c4e8ef0536c61dc877d7f Mon Sep 17 00:00:00 2001 From: Mayhem Date: Sat, 22 Jun 2013 22:14:49 +0200 Subject: [PATCH] Simpler d.readyState usage. --- lib/$.coffee | 2 +- src/General/Header.coffee | 2 +- src/General/Main.coffee | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/$.coffee b/lib/$.coffee index 74b76e04c..40b283713 100644 --- a/lib/$.coffee +++ b/lib/$.coffee @@ -13,7 +13,7 @@ $.DAY = 1000 * 60 * 60 * 24 $.id = (id) -> d.getElementById id $.ready = (fc) -> - if d.readyState in ['interactive', 'complete'] + unless d.readyState is 'loading' $.queueTask fc return cb = -> diff --git a/src/General/Header.coffee b/src/General/Header.coffee index c57debf06..abb3468d8 100644 --- a/src/General/Header.coffee +++ b/src/General/Header.coffee @@ -74,7 +74,7 @@ Header = return unless Main.isThisPageLegit() # Wait for #boardNavMobile instead of #boardNavDesktop, # it might be incomplete otherwise. - $.asap (-> $.id('boardNavMobile') or d.readyState in ['interactive', 'complete']), Header.setBoardList + $.asap (-> $.id('boardNavMobile') or d.readyState isnt 'loading'), Header.setBoardList $.prepend d.body, headerEl $.ready -> diff --git a/src/General/Main.coffee b/src/General/Main.coffee index 95333e029..915a6098e 100644 --- a/src/General/Main.coffee +++ b/src/General/Main.coffee @@ -35,7 +35,7 @@ Main = $.on d, '4chanMainInit', Main.initStyle # comes after the stylesheets on the index/thread pages, but before on the catalog. # <link favicon> comes after the stylesheets on the catalog, but before on the index/thread pages. - $.asap (-> d.head and $('title', d.head) and $('link[rel="shortcut icon"]', d.head) or d.readyState in ['interactive', 'complete']), + $.asap (-> d.head and $('title', d.head) and $('link[rel="shortcut icon"]', d.head) or d.readyState isnt 'loading' Main.initStyle initFeatures: (items) ->