diff options
| author | Stephen Blott | 2016-03-12 10:14:10 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-28 05:44:11 +0100 |
| commit | 409d1c69acb61ba6ac7ff7981fd8eb0354ba548f (patch) | |
| tree | a30c8883b0dd5418bd313cde8412684f177300a4 | |
| parent | bdf1469075c8e5cca8cd328ca326ac8df145a141 (diff) | |
| download | vimium-409d1c69acb61ba6ac7ff7981fd8eb0354ba548f.tar.bz2 | |
Global link hints; reinstate mode toggling.
| -rw-r--r-- | content_scripts/link_hints.coffee | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 25f57316..764944ee 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -69,11 +69,10 @@ HintCoordinator = @onExit = [] unless frameId == activateModeFrameId @linkHintsMode = new LinkHintsMode hints, availableModes[modeIndex] - postKeyState: (request) -> - @linkHintsMode.postKeyState request - - activateActiveHintMarker: -> - @linkHintsMode.activateLink @linkHintsMode.markerMatcher.activeHintMarker + postKeyState: (request) -> @linkHintsMode.postKeyState request + activateActiveHintMarker: -> @linkHintsMode.activateLink @linkHintsMode.markerMatcher.activeHintMarker + setMode: ({modeIndex}) -> @linkHintsMode.setOpenLinkMode availableModes[modeIndex], true + getLocalHintMarker: (hint) -> if hint.frameId == frameId then @localHints[hint.localIndex] else null exit: -> @onExit.pop()() while 0 < @onExit.length @@ -83,9 +82,6 @@ HintCoordinator = @onExit = [=> @linkHintsMode.deactivateMode()] @exit() - getLocalHintMarker: (hint) -> - if hint.frameId == frameId then @localHints[hint.localIndex] else null - LinkHints = activateMode: (count = 1, mode = OPEN_IN_CURRENT_TAB) -> if 0 < count or mode is OPEN_WITH_QUEUE @@ -144,7 +140,7 @@ class LinkHintsModeBase (event?.type == "keydown" and event.keyCode in [ keyCodes.backspace, keyCodes.deleteKey ]) HintCoordinator.sendMessage "exitFailure" - @setOpenLinkMode mode + @setOpenLinkMode mode, true # Note(philc): Append these markers as top level children instead of as child nodes to the link itself, # because some clickable elements cannot contain children, e.g. submit buttons. @@ -154,8 +150,10 @@ class LinkHintsModeBase @hideMarker marker for marker in hintMarkers when marker.hint.frameId != frameId @postKeyState = @postKeyState.bind this, hintMarkers - setOpenLinkMode: (@mode) -> + setOpenLinkMode: (@mode, doNotPropagate = false) -> @hintMode.setIndicator @mode.indicator if DomUtils.isTopFrame() + unless doNotPropagate + HintCoordinator.sendMessage "setMode", modeIndex: availableModes.indexOf @mode # # Creates a link marker for the given link. |
