|
|
@ -4,7 +4,6 @@ class app.Settings
|
|
|
|
DARK_KEY = 'dark'
|
|
|
|
DARK_KEY = 'dark'
|
|
|
|
LAYOUT_KEY = 'layout'
|
|
|
|
LAYOUT_KEY = 'layout'
|
|
|
|
SIZE_KEY = 'size'
|
|
|
|
SIZE_KEY = 'size'
|
|
|
|
SIDEBAR_KEY = 'sidebar'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@defaults:
|
|
|
|
@defaults:
|
|
|
|
count: 0
|
|
|
|
count: 0
|
|
|
@ -63,10 +62,18 @@ class app.Settings
|
|
|
|
catch
|
|
|
|
catch
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
setLayout: (value) ->
|
|
|
|
setLayout: (name, enable) ->
|
|
|
|
try
|
|
|
|
try
|
|
|
|
if value
|
|
|
|
layout = (Cookies.get(LAYOUT_KEY) || '').split(' ')
|
|
|
|
Cookies.set LAYOUT_KEY, value, path: '/', expires: 1e8
|
|
|
|
$.arrayDelete(layout, '')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if enable
|
|
|
|
|
|
|
|
layout.push(name) if layout.indexOf(name) is -1
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
$.arrayDelete(layout, name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if layout.length > 0
|
|
|
|
|
|
|
|
Cookies.set LAYOUT_KEY, layout.join(' '), path: '/', expires: 1e8
|
|
|
|
else
|
|
|
|
else
|
|
|
|
Cookies.expire LAYOUT_KEY
|
|
|
|
Cookies.expire LAYOUT_KEY
|
|
|
|
catch
|
|
|
|
catch
|
|
|
@ -78,17 +85,10 @@ class app.Settings
|
|
|
|
catch
|
|
|
|
catch
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
setSidebar: (value) ->
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
Cookies.set SIDEBAR_KEY, value, path: '/', expires: 1e8
|
|
|
|
|
|
|
|
catch
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reset: ->
|
|
|
|
reset: ->
|
|
|
|
try Cookies.expire DOCS_KEY
|
|
|
|
try Cookies.expire DOCS_KEY
|
|
|
|
try Cookies.expire DARK_KEY
|
|
|
|
try Cookies.expire DARK_KEY
|
|
|
|
try Cookies.expire LAYOUT_KEY
|
|
|
|
try Cookies.expire LAYOUT_KEY
|
|
|
|
try Cookies.expire SIZE_KEY
|
|
|
|
try Cookies.expire SIZE_KEY
|
|
|
|
try Cookies.expire SIDEBAR_KEY
|
|
|
|
|
|
|
|
try @store.del(SETTINGS_KEY)
|
|
|
|
try @store.del(SETTINGS_KEY)
|
|
|
|
return
|
|
|
|
return
|
|
|
|