diff options
| author | Stephen Blott | 2015-06-09 14:47:39 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-06-09 14:47:39 +0100 |
| commit | 98a3f4c96e8b189ca142f7cccbc1ef995c158b9d (patch) | |
| tree | 46a249e083cb7a2861bbeb82f54862fbb975965f /content_scripts | |
| parent | a7712e6ed48c89417846c0f516754551cf2d5d53 (diff) | |
| download | vimium-98a3f4c96e8b189ca142f7cccbc1ef995c158b9d.tar.bz2 | |
Make LinkHints a class (LinkHintsMode).
Functionality wise, this is a no-op. However, since we now create a new
LinkHintsMode object on every "f", we don't need to be so careful about
resetting the state on exit.
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/link_hints.coffee | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 31cdcfdf..81a5912e 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -19,6 +19,16 @@ OPEN_INCOGNITO = name: "incognito" DOWNLOAD_LINK_URL = name: "download" LinkHints = + activateMode: (mode = OPEN_IN_CURRENT_TAB) -> new LinkHintsMode mode + + activateModeToOpenInNewTab: -> @activateMode OPEN_IN_NEW_BG_TAB + activateModeToOpenInNewForegroundTab: -> @activateMode OPEN_IN_NEW_FG_TAB + activateModeToCopyLinkUrl: -> @activateMode COPY_LINK_URL + activateModeWithQueue: -> @activateMode OPEN_WITH_QUEUE + activateModeToOpenIncognito: -> @activateMode OPEN_INCOGNITO + activateModeToDownloadLink: -> @activateMode DOWNLOAD_LINK_URL + +class LinkHintsMode hintMarkerContainingDiv: null # One of the enums listed at the top of this file. mode: undefined @@ -35,15 +45,7 @@ LinkHints = # A count of the number of Tab presses since the last non-Tab keyboard event. tabCount: 0 - # We need this as a top-level function because our command system doesn't yet support arguments. - activateModeToOpenInNewTab: -> @activateMode(OPEN_IN_NEW_BG_TAB) - activateModeToOpenInNewForegroundTab: -> @activateMode(OPEN_IN_NEW_FG_TAB) - activateModeToCopyLinkUrl: -> @activateMode(COPY_LINK_URL) - activateModeWithQueue: -> @activateMode(OPEN_WITH_QUEUE) - activateModeToOpenIncognito: -> @activateMode(OPEN_INCOGNITO) - activateModeToDownloadLink: -> @activateMode(DOWNLOAD_LINK_URL) - - activateMode: (mode = OPEN_IN_CURRENT_TAB) -> + constructor: (mode = OPEN_IN_CURRENT_TAB) -> # we need documentElement to be ready in order to append links return unless document.documentElement |
