diff options
| author | Stephen Blott | 2015-01-02 15:59:58 +0000 |
|---|---|---|
| committer | Stephen Blott | 2015-01-02 17:17:34 +0000 |
| commit | 2d8c478e8086abf80b206d0fd8abc488a035b5cd (patch) | |
| tree | 6587ee3d4f11aef54b5a2c5ccb0989307f865eeb /content_scripts/mode.coffee | |
| parent | b7d5e25e353010505db7754e97d4387c8aa6b8fc (diff) | |
| download | vimium-2d8c478e8086abf80b206d0fd8abc488a035b5cd.tar.bz2 | |
Modes; incorporate find mode.
Diffstat (limited to 'content_scripts/mode.coffee')
| -rw-r--r-- | content_scripts/mode.coffee | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee index 7ca818b4..a2a8b8b0 100644 --- a/content_scripts/mode.coffee +++ b/content_scripts/mode.coffee @@ -9,11 +9,11 @@ class Mode @propagate = true # Default values. - name: "" # The name of this mode. - badge: "" # A badge to display on the popup when this mode is active. - keydown: "suppress" # A function, or "suppress" or "pass"; the latter are replaced with suitable functions. - keypress: "suppress" # A function, or "suppress" or "pass"; the latter are replaced with suitable functions. - keyup: "suppress" # A function, or "suppress" or "pass"; the latter are replaced with suitable functions. + name: "" # The name of this mode. + badge: "" # A badge to display on the popup when this mode is active. + keydown: "pass" # A function, or "suppress" or "pass"; the latter are replaced with suitable handlers. + keypress: "pass" # A function, or "suppress" or "pass"; the latter are replaced with suitable handlers. + keyup: "pass" # A function, or "suppress" or "pass"; the latter are replaced with suitable handlers. constructor: (options) -> extend @, options @@ -73,5 +73,11 @@ class Mode @sendBadge: (badge) -> chrome.runtime.sendMessage({ handler: "setBadge", badge: badge }) + # Install a mode, call a function, and exit the mode again. + @runIn: (mode, func) -> + mode = new mode() + func() + mode.exit() + root = exports ? window root.Mode = Mode |
