diff options
| author | Jez Ng | 2012-06-20 13:25:02 -0700 | 
|---|---|---|
| committer | Jez Ng | 2012-06-20 13:25:02 -0700 | 
| commit | 34f8f2dc389da77e206b8eef9e2505da3f169810 (patch) | |
| tree | 900ea5a1c5b5ddd1c6274fa8451825294fda589c | |
| parent | 07b0677b5a0f142b2331830bef3191a9a8169b74 (diff) | |
| download | vimium-34f8f2dc389da77e206b8eef9e2505da3f169810.tar.bz2 | |
Move focusInput into the global scope.
This is necessary for the keyboard handler to find it.
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 30 | 
1 files changed, 15 insertions, 15 deletions
| diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 6d7fa0b7..1e4f2ec5 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -292,21 +292,6 @@ extend window,    scrollLeft: -> scrollActivatedElementBy("x", -1 * settings.get("scrollStepSize"))    scrollRight: -> scrollActivatedElementBy("x", parseFloat(settings.get("scrollStepSize"))) -focusInput = (count) -> -  results = DomUtils.evaluateXPath(textInputXPath, XPathResult.ORDERED_NODE_ITERATOR_TYPE) - -  lastInputBox -  i = 0 - -  while (i < count) -    currentInputBox = results.iterateNext() -    break unless currentInputBox -    continue if (DomUtils.getVisibleClientRect(currentInputBox) == null) -    lastInputBox = currentInputBox -    i += 1 - -  lastInputBox.focus() if lastInputBox -  extend window,    reload: -> window.location.reload()    goBack: (count) -> history.go(-count) @@ -347,6 +332,21 @@ extend window,      HUD.showForDuration("Yanked URL", 1000) +  focusInput: (count) -> +    results = DomUtils.evaluateXPath(textInputXPath, XPathResult.ORDERED_NODE_ITERATOR_TYPE) + +    lastInputBox +    i = 0 + +    while (i < count) +      currentInputBox = results.iterateNext() +      break unless currentInputBox +      continue if (DomUtils.getVisibleClientRect(currentInputBox) == null) +      lastInputBox = currentInputBox +      i += 1 + +    lastInputBox.focus() if lastInputBox +  #  # Sends everything except i & ESC to the handler in background_page. i & ESC are special because they control  # insert mode which is local state to the page. The key will be are either a single ascii letter or a | 
