Fixes #1856.
Unified · Split
| @@ -12,6 +12,7 @@ class app.Settings · 11 unmodified lines | |||
| 12 | 'layout' | 12 | 'layout' |
| 13 | 'size' | 13 | 'size' |
| 14 | 'tips' | 14 | 'tips' |
| 15 | 'noAutofocus' | ||
| 15 | 'autoInstall' | 16 | 'autoInstall' |
| 16 | 'spaceScroll' | 17 | 'spaceScroll' |
| 17 | 'spaceTimeout' | 18 | 'spaceTimeout' |
| @@ -34,6 +34,9 @@ app.templates.settingsPage = (settings) -> """ · 33 unmodified lines | |||
| 34 | <input type="checkbox" form="settings" name="layout" value="_sidebar-hidden"#{if settings['_sidebar-hidden'] then ' checked' else ''}>Automatically hide and show the sidebar | 34 | <input type="checkbox" form="settings" name="layout" value="_sidebar-hidden"#{if settings['_sidebar-hidden'] then ' checked' else ''}>Automatically hide and show the sidebar |
| 35 | <small>Tip: drag the edge of the sidebar to resize it.</small> | 35 | <small>Tip: drag the edge of the sidebar to resize it.</small> |
| 36 | </label> | 36 | </label> |
| 37 | <label class="_settings-label _hide-on-mobile"> | ||
| 38 | <input type="checkbox" form="settings" name="noAutofocus" value="_no-autofocus"#{if settings.noAutofocus then ' checked' else ''}>Disable autofocus of search input | ||
| 39 | </label> | ||
| 37 | <label class="_settings-label"> | 40 | <label class="_settings-label"> |
| 38 | <input type="checkbox" form="settings" name="autoInstall" value="_auto-install"#{if settings.autoInstall then ' checked' else ''}>Automatically download documentation for offline use | 41 | <input type="checkbox" form="settings" name="autoInstall" value="_auto-install"#{if settings.autoInstall then ' checked' else ''}>Automatically download documentation for offline use |
| 39 | <small>Only enable this when bandwidth isn't a concern to you.</small> | 42 | <small>Only enable this when bandwidth isn't a concern to you.</small> |
| @@ -14,6 +14,7 @@ class app.views.SettingsPage extends app.View · 13 unmodified lines | |||
| 14 | settings.theme = app.settings.get('theme') | 14 | settings.theme = app.settings.get('theme') |
| 15 | settings.smoothScroll = !app.settings.get('fastScroll') | 15 | settings.smoothScroll = !app.settings.get('fastScroll') |
| 16 | settings.arrowScroll = app.settings.get('arrowScroll') | 16 | settings.arrowScroll = app.settings.get('arrowScroll') |
| 17 | settings.noAutofocus = app.settings.get('noAutofocus') | ||
| 17 | settings.autoInstall = app.settings.get('autoInstall') | 18 | settings.autoInstall = app.settings.get('autoInstall') |
| 18 | settings.analyticsConsent = app.settings.get('analyticsConsent') | 19 | settings.analyticsConsent = app.settings.get('analyticsConsent') |
| 19 | settings.spaceScroll = app.settings.get('spaceScroll') | 20 | settings.spaceScroll = app.settings.get('spaceScroll') |
| @@ -39,12 +39,16 @@ class app.views.Search extends app.View · 38 unmodified lines | |||
| 39 | return | 39 | return |
| 40 | 40 | ||
| 41 | focus: => | 41 | focus: => |
| 42 | @input.focus() unless document.activeElement is @input | 42 | return if document.activeElement is @input |
| 43 | return if app.settings.get('noAutofocus') | ||
| 44 | @input.focus() | ||
| 43 | return | 45 | return |
| 44 | 46 | ||
| 45 | autoFocus: => | 47 | autoFocus: => |
| 46 | unless app.isMobile() or $.isAndroid() or $.isIOS() | 48 | return if app.isMobile() or $.isAndroid() or $.isIOS() |
| 47 | @input.focus() unless document.activeElement?.tagName is 'INPUT' | 49 | return if document.activeElement?.tagName is 'INPUT' |
| 50 | return if app.settings.get('noAutofocus') | ||
| 51 | @input.focus() | ||
| 48 | return | 52 | return |
| 49 | 53 | ||
| 50 | onWindowFocus: (event) => | 54 | onWindowFocus: (event) => |