aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/mode_passkeys.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-01-16 12:08:42 +0000
committerStephen Blott2015-01-16 13:42:32 +0000
commitcd49c88eaad6550ba768159347be6c88f1c26d15 (patch)
tree43702a2e9e074ad2e23f9c51d3c5fabf6afa3d76 /content_scripts/mode_passkeys.coffee
parentbbc7257842293fbd58dd2f84a58c86691ceae3e1 (diff)
downloadvimium-cd49c88eaad6550ba768159347be6c88f1c26d15.tar.bz2
Modes; clean up.
Diffstat (limited to 'content_scripts/mode_passkeys.coffee')
-rw-r--r--content_scripts/mode_passkeys.coffee13
1 files changed, 4 insertions, 9 deletions
diff --git a/content_scripts/mode_passkeys.coffee b/content_scripts/mode_passkeys.coffee
index a6cd7d2d..a40fe7a6 100644
--- a/content_scripts/mode_passkeys.coffee
+++ b/content_scripts/mode_passkeys.coffee
@@ -3,25 +3,20 @@ class PassKeysMode extends Mode
constructor: ->
super
name: "passkeys"
- trackState: true
+ trackState: true # Maintain @enabled, @passKeys and @keyQueue.
keydown: (event) => @handleKeyChar KeyboardUtils.getKeyChar event
keypress: (event) => @handleKeyChar String.fromCharCode event.charCode
keyup: (event) => @handleKeyChar String.fromCharCode event.charCode
- @keyQueue = ""
- @push
- registerKeyQueue: ({ keyQueue: keyQueue }) => @alwaysContinueBubbling => @keyQueue = keyQueue
-
- # Decide whether this event should be passed to the underlying page. Keystrokes are *never* considered
- # passKeys if the keyQueue is not empty. So, for example, if 't' is a passKey, then 'gt' and '99t' will
- # neverthless be handled by vimium.
+ # Keystrokes are *never* considered passKeys if the keyQueue is not empty. So, for example, if 't' is a
+ # passKey, then 'gt' and '99t' will neverthless be handled by Vimium.
handleKeyChar: (keyChar) ->
if keyChar and not @keyQueue and 0 <= @passKeys.indexOf keyChar
@stopBubblingAndTrue
else
@continueBubbling
- chooseBadge: (badge) ->
+ updateBadge: (badge) ->
badge.badge ||= "P" if @passKeys and not @keyQueue
root = exports ? window