diff options
| author | Stephen Blott | 2016-03-16 06:35:38 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2016-03-28 05:46:36 +0100 | 
| commit | 7532d1c1dda67cb233e488afafbbf29308dc65bf (patch) | |
| tree | 93c177dcbdb1d715b6fb40eae960a5503ad7d3b6 | |
| parent | 742dcfcca95918996a27930bfdd86b19307d8450 (diff) | |
| download | vimium-7532d1c1dda67cb233e488afafbbf29308dc65bf.tar.bz2 | |
Global link hints; make frames selectable.
| -rw-r--r-- | content_scripts/link_hints.coffee | 10 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 4 | 
2 files changed, 11 insertions, 3 deletions
| diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index cb5b0858..3088812b 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -253,6 +253,9 @@ LocalHints =          isClickable ||= not element.disabled        when "label"          isClickable ||= element.control? and (@getVisibleClickable element.control).length == 0 +      when "body" +        isClickable ||= element == document.body and not document.hasFocus() and +          window.innerWidth > 3 and window.innerHeight > 3      # Elements with tabindex are sometimes useful, but usually not. We can treat them as second class      # citizens when it improves UX, so take special note of them. @@ -359,6 +362,9 @@ LocalHints =          element.firstElementChild.nodeName.toLowerCase() == "img"        linkText = element.firstElementChild.alt || element.firstElementChild.title        showLinkText = true if linkText +    else if element == document.body +      linkText = "Frame." +      showLinkText = true      else        linkText = (element.textContent.trim() || element.innerHTML.trim())[...512] @@ -459,7 +465,9 @@ class LinkHintsMode extends LinkHintsModeBase      if clickEl?        HintCoordinator.onExit.push => -        if DomUtils.isSelectable clickEl +        if clickEl == document.body +          Utils.nextTick -> focusThisFrame highlight: true +        else if DomUtils.isSelectable clickEl            window.focus()            DomUtils.simulateSelect clickEl          else diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index bd7da625..93ab440a 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -638,8 +638,8 @@ root.frameId = frameId  root.Frame = Frame  root.windowIsFocused = windowIsFocused  root.bgLog = bgLog -# These are exported for find mode. +# These are exported for find mode and link-hints mode.  extend root, {handleEscapeForFindMode, handleEnterForFindMode, performFind, performBackwardsFind, -  enterFindMode} +  enterFindMode, focusThisFrame}  # These are exported only for the tests.  extend root, {installModes, installListeners} | 
