|
|
|
@ -8,6 +8,7 @@ class app.views.SearchScope extends app.View
|
|
|
|
|
@events:
|
|
|
|
|
click: 'onClick'
|
|
|
|
|
keydown: 'onKeydown'
|
|
|
|
|
textInput: 'onTextInput'
|
|
|
|
|
|
|
|
|
|
@routes:
|
|
|
|
|
after: 'afterRoute'
|
|
|
|
@ -88,6 +89,11 @@ class app.views.SearchScope extends app.View
|
|
|
|
|
@trigger 'change', null, previousDoc
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
doScopeSearch: (event) =>
|
|
|
|
|
@search @input.value[0...@input.selectionStart]
|
|
|
|
|
$.stopEvent(event) if @doc
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
onClick: (event) =>
|
|
|
|
|
if event.target is @tag
|
|
|
|
|
@reset()
|
|
|
|
@ -99,12 +105,17 @@ class app.views.SearchScope extends app.View
|
|
|
|
|
if @doc and @input.selectionEnd is 0
|
|
|
|
|
@reset()
|
|
|
|
|
$.stopEvent(event)
|
|
|
|
|
else if not @doc and @input.value
|
|
|
|
|
else if not @doc and @input.value and not $.isChromeForAndroid()
|
|
|
|
|
return if event.ctrlKey or event.metaKey or event.altKey or event.shiftKey
|
|
|
|
|
if event.which is 9 or # tab
|
|
|
|
|
(event.which is 32 and app.isMobile()) # space
|
|
|
|
|
@search @input.value[0...@input.selectionStart]
|
|
|
|
|
$.stopEvent(event) if @doc
|
|
|
|
|
@doScopeSearch(event)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
onTextInput: (event) =>
|
|
|
|
|
return unless $.isChromeForAndroid()
|
|
|
|
|
if not @doc and @input.value and event.data == ' '
|
|
|
|
|
@doScopeSearch(event)
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
extractHashValue: ->
|
|
|
|
|