Unified · Split
| @@ -31,7 +31,7 @@ class app.views.Search extends app.View · 30 unmodified lines | |||
| 31 | 31 | ||
| 32 | app.on 'ready', @onReady | 32 | app.on 'ready', @onReady |
| 33 | $.on window, 'hashchange', @searchUrl | 33 | $.on window, 'hashchange', @searchUrl |
| 34 | $.on window, 'focus', @autoFocus | 34 | $.on window, 'focus', @onWindowFocus |
| 35 | return | 35 | return |
| 36 | 36 | ||
| 37 | focus: => | 37 | focus: => |
| @@ -43,6 +43,9 @@ class app.views.Search extends app.View · 5 unmodified lines | |||
| 43 | @input.focus() unless document.activeElement?.tagName is 'INPUT' | 43 | @input.focus() unless document.activeElement?.tagName is 'INPUT' |
| 44 | return | 44 | return |
| 45 | 45 | ||
| 46 | onWindowFocus: (event) => | ||
| 47 | @autoFocus() if event.target is window | ||
| 48 | |||
| 46 | getScopeDoc: -> | 49 | getScopeDoc: -> |
| 47 | @scope.getScope() if @scope.isActive() | 50 | @scope.getScope() if @scope.isActive() |
| 48 | 51 | ||
| @@ -135,7 +138,7 @@ class app.views.Search extends app.View · 86 unmodified lines | |||
| 135 | return if app.shortcuts.eventInProgress?.name is 'escape' | 138 | return if app.shortcuts.eventInProgress?.name is 'escape' |
| 136 | @reset(true) if not context.init and app.router.isIndex() | 139 | @reset(true) if not context.init and app.router.isIndex() |
| 137 | @delay @searchUrl if context.hash | 140 | @delay @searchUrl if context.hash |
| 138 | @delay @autoFocus | 141 | $.requestAnimationFrame @autoFocus |
| 139 | return | 142 | return |
| 140 | 143 | ||
| 141 | extractHashValue: -> | 144 | extractHashValue: -> |