diff options
| author | mrmr1993 | 2015-06-03 04:49:56 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2015-06-10 17:28:35 +0100 | 
| commit | b80f4095b8b8767bb1dfb991fec1e756389f25a2 (patch) | |
| tree | bc24bcb80c4bca541b0474b2054764cd6b21873d /content_scripts/hud.coffee | |
| parent | c5a40d4fd34e007d27849f3e480e2ce26829fa7c (diff) | |
| download | vimium-b80f4095b8b8767bb1dfb991fec1e756389f25a2.tar.bz2 | |
Remove global findMode and pass new FindMode instances direct to the HUD
Diffstat (limited to 'content_scripts/hud.coffee')
| -rw-r--r-- | content_scripts/hud.coffee | 15 | 
1 files changed, 8 insertions, 7 deletions
diff --git a/content_scripts/hud.coffee b/content_scripts/hud.coffee index 3637eede..5e1b955a 100644 --- a/content_scripts/hud.coffee +++ b/content_scripts/hud.coffee @@ -6,6 +6,7 @@ HUD =    tween: null    hudUI: null    _displayElement: null +  findMode: null    # This HUD is styled to precisely mimick the chrome HUD on Mac. Use the "has_popup_and_link_hud.html"    # test harness to tweak these styles to match Chrome's. One limitation of our HUD display is that @@ -26,16 +27,16 @@ HUD =      @hudUI.show {name: "show", text}      @tween.fade 1.0, 150 -  showFindMode: -> +  showFindMode: (@findMode = null) ->      return unless @enabled()      @hudUI.show {name: "showFindMode", text: ""}      @tween.fade 1.0, 150    search: (data) -> -    window.scrollTo findMode.scrollX, findMode.scrollY if findMode.options.returnToViewport +    window.scrollTo @findMode.scrollX, @findMode.scrollY if @findMode.options.returnToViewport      findModeQuery.rawQuery = data.query      updateFindModeQuery() -    findMode.findInPlace() +    @findMode.findInPlace()      # Show the number of matches in the HUD UI.      matchCount = if findModeQuery.parsedQuery.length > 0 then findModeQuery.matchCount else 0 @@ -72,16 +73,16 @@ HUD =      @findModeKeydown data.event    findModeKeydown: (event) -> -    window.scrollTo findMode.scrollX, findMode.scrollY if findMode.options.returnToViewport +    window.scrollTo @findMode.scrollX, @findMode.scrollY if @findMode.options.returnToViewport      if event.keyCode == keyCodes.backspace || event.keyCode == keyCodes.deleteKey -      findMode.exit() +      @findMode.exit()        new PostFindMode if findModeQueryHasResults      else if event.keyCode == keyCodes.enter        handleEnterForFindMode() -      findMode.exit() +      @findMode.exit()        new PostFindMode if findModeQueryHasResults      else if KeyboardUtils.isEscape event -      findMode.exit() +      @findMode.exit()        handleEscapeForFindMode()        new PostFindMode if findModeQueryHasResults  | 
