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

View File

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

View File

@ -273,6 +273,10 @@ Main =
d.title not in ['4chan - Temporarily Offline', '4chan - Error', '504 Gateway Time-out'] d.title not in ['4chan - Temporarily Offline', '4chan - Error', '504 Gateway Time-out']
Main.thisPageIsLegit Main.thisPageIsLegit
ready: (cb) ->
$.ready ->
cb() if Main.isThisPageLegit()
css: """ css: """
<%= grunt.file.read('src/General/css/font-awesome.css').replace(/\s+/g, ' ').replace(/\\/g, '\\\\').trim() %> <%= 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() %> <%= 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. # Let 4chan's JS load the banner if enabled; otherwise, load it ourselves.
if g.BOARD.ID isnt 'f' if g.BOARD.ID isnt 'f'
$.ready -> $.queueTask Banner.load Main.ready -> $.queueTask Banner.load
ready: -> ready: ->
banner = $ ".boardBanner" banner = $ ".boardBanner"

View File

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

View File

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