Toggle the pagelist visibility via CSS to avoid a crash when the index update is done before the element exists.
Also only send the If-Modified-Since HTTP header when we have something significant to send.
This commit is contained in:
parent
855b7f0173
commit
7e8fd31733
@ -363,7 +363,8 @@ a[href="javascript:;"] {
|
||||
}
|
||||
|
||||
/* Index */
|
||||
:root.index-loading .board {
|
||||
:root.index-loading .board,
|
||||
:root.index-hide-pagelist .pagelist {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ $.ajax = do ->
|
||||
type or= form and 'post' or 'get'
|
||||
r.open type, url, !sync
|
||||
if whenModified
|
||||
r.setRequestHeader 'If-Modified-Since', lastModified[url] or '0'
|
||||
r.setRequestHeader 'If-Modified-Since', lastModified[url] if url of lastModified
|
||||
$.on r, 'load', -> lastModified[url] = r.getResponseHeader 'Last-Modified'
|
||||
$.extend r, options
|
||||
$.extend r.upload, upCallbacks
|
||||
|
||||
@ -44,6 +44,7 @@ Index =
|
||||
subEntries: [modeEntry, sortEntry]
|
||||
|
||||
$.addClass doc, 'index-loading'
|
||||
Index.togglePagelist()
|
||||
Index.root = $.el 'div', className: 'board'
|
||||
Index.update()
|
||||
$.asap (-> $('.board', doc) or d.readyState isnt 'loading'), ->
|
||||
@ -52,11 +53,15 @@ Index =
|
||||
|
||||
cb:
|
||||
mode: ->
|
||||
Index.togglePagelist()
|
||||
Index.buildIndex()
|
||||
sort: ->
|
||||
Index.sort()
|
||||
Index.buildIndex()
|
||||
|
||||
togglePagelist: ->
|
||||
(if Conf['Index Mode'] is 'paged' then $.rmClass else $.addClass) doc, 'index-hide-pagelist'
|
||||
|
||||
update: ->
|
||||
return unless navigator.onLine
|
||||
Index.req?.abort()
|
||||
@ -170,4 +175,3 @@ Index =
|
||||
$.event 'IndexRefresh'
|
||||
$.rmAll Index.root
|
||||
$.add Index.root, nodes
|
||||
$('.pagelist').hidden = Conf['Index Mode'] isnt 'paged'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user