|
|
@ -1,7 +1,4 @@
|
|
|
|
class app.views.SettingsPage extends app.View
|
|
|
|
class app.views.SettingsPage extends app.View
|
|
|
|
LAYOUTS = ['_max-width', '_sidebar-hidden', '_native-scrollbars']
|
|
|
|
|
|
|
|
SIDEBAR_HIDDEN_LAYOUT = '_sidebar-hidden'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@className: '_static'
|
|
|
|
@className: '_static'
|
|
|
|
|
|
|
|
|
|
|
|
@events:
|
|
|
|
@events:
|
|
|
@ -17,23 +14,18 @@ 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 LAYOUTS
|
|
|
|
settings[layout] = app.settings.hasLayout(layout) for layout in app.settings.LAYOUTS
|
|
|
|
settings
|
|
|
|
settings
|
|
|
|
|
|
|
|
|
|
|
|
getTitle: ->
|
|
|
|
getTitle: ->
|
|
|
|
'Preferences'
|
|
|
|
'Preferences'
|
|
|
|
|
|
|
|
|
|
|
|
toggleDark: (enable) ->
|
|
|
|
toggleDark: (enable) ->
|
|
|
|
html = document.documentElement
|
|
|
|
|
|
|
|
html.classList.toggle('_theme-default')
|
|
|
|
|
|
|
|
html.classList.toggle('_theme-dark')
|
|
|
|
|
|
|
|
app.settings.set('dark', !!enable)
|
|
|
|
app.settings.set('dark', !!enable)
|
|
|
|
app.appCache?.updateInBackground()
|
|
|
|
app.appCache?.updateInBackground()
|
|
|
|
return
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
toggleLayout: (layout, enable) ->
|
|
|
|
toggleLayout: (layout, enable) ->
|
|
|
|
document.body.classList[if enable then 'add' else 'remove'](layout) unless layout is SIDEBAR_HIDDEN_LAYOUT
|
|
|
|
|
|
|
|
document.body.classList[if $.overlayScrollbarsEnabled() then 'add' else 'remove']('_overlay-scrollbars')
|
|
|
|
|
|
|
|
app.settings.setLayout(layout, enable)
|
|
|
|
app.settings.setLayout(layout, enable)
|
|
|
|
app.appCache?.updateInBackground()
|
|
|
|
app.appCache?.updateInBackground()
|
|
|
|
return
|
|
|
|
return
|
|
|
|