diff options
| author | Stephen Blott | 2015-04-22 11:45:42 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-04-22 11:45:42 +0100 |
| commit | 3d273b68c34e5aeb9fd76d1979ee4606357a8631 (patch) | |
| tree | 351ca1cb95e1d96a096e9990209a0fa6bb68b497 | |
| parent | f2a89e0bb9ef72ffe893e45c78df3740612ceb27 (diff) | |
| download | vimium-3d273b68c34e5aeb9fd76d1979ee4606357a8631.tar.bz2 | |
Show yanked text in HUD for "yf".
| -rw-r--r-- | content_scripts/link_hints.coffee | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 73af6a06..6bbe1f07 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -32,6 +32,8 @@ LinkHints = if settings.get("filterLinkHints") then filterHints else alphabetHints # lock to ensure only one instance runs at a time isActive: false + # Call this function on exit (if defined). + onExit: null # # To be called after linkHints has been generated from linkHintsBase. @@ -92,8 +94,11 @@ LinkHints = altKey: false else if @mode is COPY_LINK_URL @hintMode.setIndicator "Copy link URL to Clipboard" - @linkActivator = (link) -> + @linkActivator = (link) => chrome.runtime.sendMessage handler: "copyToClipboard", data: link.href + url = link.href + url = url[0..25] + "...." if 28 < url.length + @onExit = -> HUD.showForDuration "Yanked #{url}", 2000 else if @mode is OPEN_INCOGNITO @hintMode.setIndicator "Open link in incognito window" @linkActivator = (link) -> @@ -341,6 +346,8 @@ LinkHints = DomUtils.removeElement LinkHints.hintMarkerContainingDiv LinkHints.hintMarkerContainingDiv = null @hintMode.exit() + @onExit?() + @onExit = null @isActive = false # we invoke the deactivate() function directly instead of using setTimeout(callback, 0) so that |
