Fix some errors from features run on 404 pages.

This commit is contained in:
ccd0 2015-01-03 14:27:59 -08:00
parent 79dedbcb2b
commit 935596722c
6 changed files with 10 additions and 4 deletions

View File

@ -91,7 +91,7 @@ Header =
@setBarPosition Conf['Bottom Header']
@
$.ready =>
Main.ready =>
@footer = footer = $.id 'boardNavDesktopFoot'
if a = $ "a[href*='/#{g.BOARD}/']", footer
a.className = 'current'

View File

@ -82,6 +82,7 @@ Index =
@update()
$.asap (-> $('.board > .thread > .postContainer', doc) or d.readyState isnt 'loading'), ->
return unless Main.isThisPageLegit()
Index.hat = $ '.board > .thread > img:first-child'
if Index.hat and Index.nodes
for threadRoot in Index.nodes
@ -106,6 +107,7 @@ Index =
$.before topNavPos, Index.navLinks
$.asap (-> $('.pagelist', doc) or d.readyState isnt 'loading'), ->
return unless Main.isThisPageLegit()
if pagelist = $('.pagelist')
$.replace pagelist, Index.pagelist
else

View File

@ -273,6 +273,10 @@ Main =
d.title not in ['4chan - Temporarily Offline', '4chan - Error', '504 Gateway Time-out']
Main.thisPageIsLegit
ready: (cb) ->
$.ready ->
cb() if Main.isThisPageLegit()
css: """
<%= grunt.file.read('src/General/css/font-awesome.css').replace(/\s+/g, ' ').replace(/\\/g, '\\\\').trim() %>
<%= grunt.file.read('src/General/css/style.css').replace(/\s+/g, ' ').trim() %>

View File

@ -7,7 +7,7 @@ Banner =
# Let 4chan's JS load the banner if enabled; otherwise, load it ourselves.
if g.BOARD.ID isnt 'f'
$.ready -> $.queueTask Banner.load
Main.ready -> $.queueTask Banner.load
ready: ->
banner = $ ".boardBanner"

View File

@ -36,7 +36,7 @@ Fourchan =
cb: @math
# Disable 4chan's ID highlighting (replaced by IDHighlight) and reported post hiding.
$.ready ->
Main.ready ->
$.globalEval '''
(function() {
window.clickable_ids = false;

View File

@ -27,7 +27,7 @@ ThreadUpdater =
updateLink = $.el 'span',
className: 'brackets-wrap updatelink'
$.extend updateLink, <%= html('<a href="javascript:;">Update</a>') %>
$.ready ->
Main.ready ->
$.add $('.navLinksBot'), [$.tn(' '), updateLink]
$.on updateLink.firstElementChild, 'click', @update