From 792eef9e547f3c01d8a0012444c6d5adfe1620cc Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 8 Oct 2016 23:27:04 -0700 Subject: [PATCH] Fix 4chan-specific error page detection. --- src/main/Main.coffee | 9 +++++---- src/site/SW.yotsuba.coffee | 7 ++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/Main.coffee b/src/main/Main.coffee index 101333950..a3ee5eece 100644 --- a/src/main/Main.coffee +++ b/src/main/Main.coffee @@ -406,11 +406,12 @@ Main = <%= html(' [report]') %> isThisPageLegit: -> - # 404 error page or similar. + # not 404 error page or similar. unless 'thisPageIsLegit' of Main - Main.thisPageIsLegit = location.hostname is 'boards.4chan.org' and - !$('link[href*="favicon-status.ico"]', d.head) and - d.title not in ['4chan - Temporarily Offline', '4chan - Error', '504 Gateway Time-out'] + Main.thisPageIsLegit = if Site.isThisPageLegit + Site.isThisPageLegit() + else + !/^[45]\d\d\b/.test(document.title) Main.thisPageIsLegit ready: (cb) -> diff --git a/src/site/SW.yotsuba.coffee b/src/site/SW.yotsuba.coffee index c1a6c6ae6..839bc44db 100644 --- a/src/site/SW.yotsuba.coffee +++ b/src/site/SW.yotsuba.coffee @@ -1 +1,6 @@ -SW.yotsuba = {} +SW.yotsuba = + isThisPageLegit: -> + # not 404 error page or similar. + location.hostname is 'boards.4chan.org' and + !$('link[href*="favicon-status.ico"]', d.head) and + d.title not in ['4chan - Temporarily Offline', '4chan - Error', '504 Gateway Time-out']