aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-03-04 10:26:56 +0000
committerStephen Blott2016-03-04 10:26:56 +0000
commit0dc6ecae624d5067f0b00332c2f41c556fa8bd03 (patch)
tree878cd20723935d9c948f54f6c50dcd1e09057838
parent67807bf8a80433fdaa8524d12be31031121b8e7a (diff)
parent58e332fe942d01c8f4633b3415c460f678b2c75b (diff)
downloadvimium-0dc6ecae624d5067f0b00332c2f41c556fa8bd03.tar.bz2
Merge pull request #2031 from smblott-github/clickable-command-names
Make command names in the help diablog clickable.
-rw-r--r--pages/help_dialog.coffee10
1 files changed, 10 insertions, 0 deletions
diff --git a/pages/help_dialog.coffee b/pages/help_dialog.coffee
index 1b9420c3..0da4977b 100644
--- a/pages/help_dialog.coffee
+++ b/pages/help_dialog.coffee
@@ -38,6 +38,16 @@ HelpDialog =
@showAdvancedCommands(@getShowAdvancedCommands())
+ # When command names are shown, clicking on them copies their text to the clipboard (and they can be
+ # clicked with link hints).
+ for element in @dialogElement.getElementsByClassName "commandName"
+ do (element) ->
+ element.setAttribute "role", "link"
+ element.addEventListener "click", ->
+ commandName = element.textContent.replace("(","").replace ")", ""
+ chrome.runtime.sendMessage handler: "copyToClipboard", data: commandName
+ HUD.showForDuration("Yanked #{commandName}.", 2000)
+
hide: -> UIComponentServer.postMessage "hide"
toggle: (html) ->