Remember index mode regardless of how it was chosen.

This commit is contained in:
ccd0 2015-02-01 00:51:47 -08:00
parent a980c9311a
commit b47809d047

View File

@ -230,9 +230,13 @@ Index =
{search, mode} = e.state {search, mode} = e.state
page = Index.getCurrentPage() page = Index.getCurrentPage()
state = {} state = {}
state.search = Index.search = search if Index.search isnt search if Index.search isnt search
state.mode = Conf['Index Mode'] = mode if Conf['Index Mode'] isnt mode state.search = Index.search = search
state.page = Index.currentPage = page if Index.currentPage isnt page if Conf['Index Mode'] isnt mode
state.mode = mode
Index.saveMode mode
if Index.currentPage isnt page
state.page = Index.currentPage = page
if state.search? or state.mode? or state.page? if state.search? or state.mode? or state.page?
Index.pageLoad state Index.pageLoad state
else else
@ -306,7 +310,7 @@ Index =
if state.mode? if state.mode?
{mode} = state {mode} = state
delete state.mode if mode is Conf['Index Mode'] delete state.mode if mode is Conf['Index Mode']
Conf['Index Mode'] = mode Index.saveMode mode
state.page = 1 if mode in ['all pages', 'catalog'] state.page = 1 if mode in ['all pages', 'catalog']
hash = '' hash = ''
if state.page? if state.page?
@ -322,6 +326,13 @@ Index =
, '', pathname + hash , '', pathname + hash
state state
saveMode: (mode) ->
Conf['Index Mode'] = mode
$.set 'Index Mode', mode
unless mode is 'catalog'
Conf['Previous Index Mode'] = mode
$.set 'Previous Index Mode', mode
pageLoad: ({sort, search, mode, scroll}) -> pageLoad: ({sort, search, mode, scroll}) ->
if sort or search? if sort or search?
Index.sort() Index.sort()