Simplify layouts array

pull/1011/head
Jasper van Merle 6 years ago
parent 0c42db5749
commit d63487d973

@ -19,7 +19,7 @@ class app.Settings
'news' 'news'
] ]
LAYOUTS = ['_max-width', '_sidebar-hidden', '_native-scrollbars'] LAYOUTS: ['_max-width', '_sidebar-hidden', '_native-scrollbars']
SIDEBAR_HIDDEN_LAYOUT = '_sidebar-hidden' SIDEBAR_HIDDEN_LAYOUT = '_sidebar-hidden'
@defaults: @defaults:
@ -87,9 +87,6 @@ class app.Settings
layout = (@store.get('layout') || '').split(' ') layout = (@store.get('layout') || '').split(' ')
layout.indexOf(name) isnt -1 layout.indexOf(name) isnt -1
getAllLayouts: ->
return LAYOUTS
setSize: (value) -> setSize: (value) ->
@set 'size', value @set 'size', value
return return
@ -116,7 +113,7 @@ class app.Settings
initLayout: -> initLayout: ->
@toggleDark(@get('dark')) @toggleDark(@get('dark'))
@toggleLayout(layout, @hasLayout(layout)) for layout in LAYOUTS @toggleLayout(layout, @hasLayout(layout)) for layout in @LAYOUTS
toggleDark: (enable) -> toggleDark: (enable) ->
classList = document.documentElement.classList classList = document.documentElement.classList

@ -14,7 +14,7 @@ class app.views.SettingsPage extends app.View
settings.dark = app.settings.get('dark') settings.dark = app.settings.get('dark')
settings.smoothScroll = !app.settings.get('fastScroll') settings.smoothScroll = !app.settings.get('fastScroll')
settings.arrowScroll = app.settings.get('arrowScroll') settings.arrowScroll = app.settings.get('arrowScroll')
settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.getAllLayouts() settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.LAYOUTS
settings settings
getTitle: -> getTitle: ->

Loading…
Cancel
Save