Showing the changes to assets/javascripts (2 of 2 files). Show all
Unified · Split
| @@ -352,6 +352,10 @@ isIE = null · 351 unmodified lines | |||
| 352 | $.isIE = -> | 352 | $.isIE = -> |
| 353 | isIE ?= navigator.userAgent?.indexOf('MSIE') >= 0 || navigator.userAgent?.indexOf('rv:11.0') >= 0 | 353 | isIE ?= navigator.userAgent?.indexOf('MSIE') >= 0 || navigator.userAgent?.indexOf('rv:11.0') >= 0 |
| 354 | 354 | ||
| 355 | isChromeForAndroid = null | ||
| 356 | $.isChromeForAndroid = -> | ||
| 357 | isChromeForAndroid ?= navigator.userAgent?.indexOf('Android') >= 0 && /Chrome\/([.0-9])+ Mobile/.test(navigator.userAgent) | ||
| 358 | |||
| 355 | isAndroid = null | 359 | isAndroid = null |
| 356 | $.isAndroid = -> | 360 | $.isAndroid = -> |
| 357 | isAndroid ?= navigator.userAgent?.indexOf('Android') >= 0 | 361 | isAndroid ?= navigator.userAgent?.indexOf('Android') >= 0 |
| @@ -88,23 +88,27 @@ class app.views.SearchScope extends app.View · 87 unmodified lines | |||
| 88 | @trigger 'change', null, previousDoc | 88 | @trigger 'change', null, previousDoc |
| 89 | return | 89 | return |
| 90 | 90 | ||
| 91 | doScopeSearch: (event) => | ||
| 92 | @search @input.value[0...@input.selectionStart] | ||
| 93 | $.stopEvent(event) if @doc | ||
| 94 | return | ||
| 95 | |||
| 91 | onKeydown: (event) => | 96 | onKeydown: (event) => |
| 92 | if event.which is 8 # backspace | 97 | if event.which is 8 # backspace |
| 93 | if @doc and not @input.value | 98 | if @doc and not @input.value |
| 94 | $.stopEvent(event) | 99 | $.stopEvent(event) |
| 95 | @reset() | 100 | @reset() |
| 96 | else if not @doc and @input.value | 101 | else if not @doc and @input.value and not $.isChromeForAndroid() |
| 97 | return if event.ctrlKey or event.metaKey or event.altKey or event.shiftKey | 102 | return if event.ctrlKey or event.metaKey or event.altKey or event.shiftKey |
| 98 | if event.which is 9 or # tab | 103 | if event.which is 9 or # tab |
| 99 | (event.which is 32 and app.isMobile()) # space | 104 | (event.which is 32 and app.isMobile()) # space |
| 100 | @search @input.value[0...@input.selectionStart] | 105 | @doScopeSearch(event) |
| 101 | $.stopEvent(event) if @doc | ||
| 102 | return | 106 | return |
| 103 | 107 | ||
| 104 | onTextInput: (event) => | 108 | onTextInput: (event) => |
| 105 | if event.data == ' ' and app.isMobile() | 109 | return unless $.isChromeForAndroid() |
| 106 | @search @input.value[0...@input.selectionStart] | 110 | if not @doc and @input.value and event.data == ' ' |
| 107 | $.stopEvent(event) if @doc | 111 | @doScopeSearch(event) |
| 108 | return | 112 | return |
| 109 | 113 | ||
| 110 | extractHashValue: -> | 114 | extractHashValue: -> |