Avoid using history.state.search because of problems if history.state is string. #463?

This commit is contained in:
ccd0 2015-08-23 23:13:28 -07:00
parent d2790e910c
commit aac9cd7eac

View File

@ -9,7 +9,7 @@ Index =
name: 'Catalog Features' name: 'Catalog Features'
cb: @catalogNode cb: @catalogNode
@search = history.state?.search or '' @search = history.state?.searched or ''
if history.state?.mode if history.state?.mode
Conf['Index Mode'] = history.state?.mode Conf['Index Mode'] = history.state?.mode
@currentPage = @getCurrentPage() @currentPage = @getCurrentPage()
@ -226,10 +226,10 @@ Index =
popstate: (e) -> popstate: (e) ->
if e?.state if e?.state
{search, mode} = e.state {searched, mode} = e.state
state = {} state = {}
if Index.search isnt search if Index.search isnt searched
state.search = Index.search = search state.search = Index.search = searched
if Conf['Index Mode'] isnt mode if Conf['Index Mode'] isnt mode
state.mode = mode state.mode = mode
Index.saveMode mode Index.saveMode mode
@ -317,9 +317,9 @@ Index =
pathname = if page is 1 then "/#{g.BOARD}/" else "/#{g.BOARD}/#{page}" pathname = if page is 1 then "/#{g.BOARD}/" else "/#{g.BOARD}/#{page}"
hash = '' hash = ''
history[if state.replace then 'replaceState' else 'pushState'] history[if state.replace then 'replaceState' else 'pushState']
mode: Conf['Index Mode'] mode: Conf['Index Mode']
search: Index.search searched: Index.search
oldpage: pageBeforeSearch oldpage: pageBeforeSearch
, '', pathname + hash , '', pathname + hash
state state