drop a few more unneeded checks

This commit is contained in:
ccd0 2014-06-01 18:15:23 -07:00
parent 722635d722
commit c6e033f3da

View File

@ -82,19 +82,18 @@ Index =
$.on @searchInput, 'input', @onSearchInput $.on @searchInput, 'input', @onSearchInput
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch $.on $('#index-search-clear', @navLinks), 'click', @clearSearch
@update() if g.VIEW is 'index' @update()
$.asap (-> $('.board', doc) or d.readyState isnt 'loading'), -> $.asap (-> $('.board', doc) or d.readyState isnt 'loading'), ->
if g.VIEW is 'index' board = $ '.board'
board = $ '.board' $.replace board, Index.root
$.replace board, Index.root # Hacks:
# Hacks: # - When removing an element from the document during page load,
# - When removing an element from the document during page load, # its ancestors will still be correctly created inside of it.
# its ancestors will still be correctly created inside of it. # - Creating loadable elements inside of an origin-less document
# - Creating loadable elements inside of an origin-less document # will not download them.
# will not download them. # - Combine the two and you get a download canceller!
# - Combine the two and you get a download canceller! # Does not work on Firefox unfortunately. bugzil.la/939713
# Does not work on Firefox unfortunately. bugzil.la/939713 d.implementation.createDocument(null, null, null).appendChild board
d.implementation.createDocument(null, null, null).appendChild board
$.rm el for el in $$ '.navLinks' $.rm el for el in $$ '.navLinks'
$.id('search-box')?.parentNode.remove() $.id('search-box')?.parentNode.remove()
@ -110,7 +109,7 @@ Index =
$.rmClass doc, 'index-loading' $.rmClass doc, 'index-loading'
scroll: -> scroll: ->
return if Index.req or Conf['Index Mode'] isnt 'infinite' or (window.scrollY <= doc.scrollHeight - (300 + window.innerHeight)) or g.VIEW is 'thread' return if Index.req or Conf['Index Mode'] isnt 'infinite' or (window.scrollY <= doc.scrollHeight - (300 + window.innerHeight))
Index.pageNum = Index.getCurrentPage() unless Index.pageNum? # Avoid having to pushState to keep track of the current page Index.pageNum = Index.getCurrentPage() unless Index.pageNum? # Avoid having to pushState to keep track of the current page
pageNum = Index.pageNum++ pageNum = Index.pageNum++