Showing the changes to assets/javascripts (3 of 8 files). Show all
Unified · Split
| @@ -179,6 +179,14 @@ · 178 unmodified lines | |||
| 179 | # enabled because it doesn't support caching URLs that use CORS. | 179 | # enabled because it doesn't support caching URLs that use CORS. |
| 180 | @config[if @appCache and @settings.hasDocs() then 'index_path' else 'docs_host'] | 180 | @config[if @appCache and @settings.hasDocs() then 'index_path' else 'docs_host'] |
| 181 | 181 | ||
| 182 | toggleSidebar: -> | ||
| 183 | state = @el.getAttribute('data-sidebar') | ||
| 184 | newState = if state == 'visible' then 'hidden' else 'visible' | ||
| 185 | @el.setAttribute('data-sidebar', newState) | ||
| 186 | @settings.setSidebar(newState) | ||
| 187 | @appCache?.updateInBackground() | ||
| 188 | return | ||
| 189 | |||
| 182 | onBootError: (args...) -> | 190 | onBootError: (args...) -> |
| 183 | @trigger 'bootError' | 191 | @trigger 'bootError' |
| 184 | @hideLoading() | 192 | @hideLoading() |
| @@ -4,6 +4,7 @@ class app.Settings · 3 unmodified lines | |||
| 4 | DARK_KEY = 'dark' | 4 | DARK_KEY = 'dark' |
| 5 | LAYOUT_KEY = 'layout' | 5 | LAYOUT_KEY = 'layout' |
| 6 | SIZE_KEY = 'size' | 6 | SIZE_KEY = 'size' |
| 7 | SIDEBAR_KEY = 'sidebar' | ||
| 7 | 8 | ||
| 8 | @defaults: | 9 | @defaults: |
| 9 | count: 0 | 10 | count: 0 |
| @@ -77,10 +78,17 @@ class app.Settings · 67 unmodified lines | |||
| 77 | catch | 78 | catch |
| 78 | return | 79 | return |
| 79 | 80 | ||
| 81 | setSidebar: (value) -> | ||
| 82 | try | ||
| 83 | Cookies.set SIDEBAR_KEY, value, path: '/', expires: 1e8 | ||
| 84 | catch | ||
| 85 | return | ||
| 86 | |||
| 80 | reset: -> | 87 | reset: -> |
| 81 | try Cookies.expire DOCS_KEY | 88 | try Cookies.expire DOCS_KEY |
| 82 | try Cookies.expire DARK_KEY | 89 | try Cookies.expire DARK_KEY |
| 83 | try Cookies.expire LAYOUT_KEY | 90 | try Cookies.expire LAYOUT_KEY |
| 84 | try Cookies.expire SIZE_KEY | 91 | try Cookies.expire SIZE_KEY |
| 92 | try Cookies.expire SIDEBAR_KEY | ||
| 85 | try @store.del(SETTINGS_KEY) | 93 | try @store.del(SETTINGS_KEY) |
| 86 | return | 94 | return |
| @@ -4,6 +4,7 @@ class app.views.Resizer extends app.View · 3 unmodified lines | |||
| 4 | @events: | 4 | @events: |
| 5 | dragstart: 'onDragStart' | 5 | dragstart: 'onDragStart' |
| 6 | dragend: 'onDragEnd' | 6 | dragend: 'onDragEnd' |
| 7 | dblclick: 'onDbLClick' | ||
| 7 | 8 | ||
| 8 | @isSupported: -> | 9 | @isSupported: -> |
| 9 | 'ondragstart' of document.createElement('div') and !app.isMobile() | 10 | 'ondragstart' of document.createElement('div') and !app.isMobile() |
| @@ -31,6 +32,10 @@ class app.views.Resizer extends app.View · 21 unmodified lines | |||
| 31 | app.appCache?.updateInBackground() | 32 | app.appCache?.updateInBackground() |
| 32 | return | 33 | return |
| 33 | 34 | ||
| 35 | onDbLClick: (event) => | ||
| 36 | app.toggleSidebar() | ||
| 37 | return | ||
| 38 | |||
| 34 | onDragStart: (event) => | 39 | onDragStart: (event) => |
| 35 | @style.removeAttribute('disabled') | 40 | @style.removeAttribute('disabled') |
| 36 | event.dataTransfer.effectAllowed = 'link' | 41 | event.dataTransfer.effectAllowed = 'link' |