aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/link_hints.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-06-01 14:56:08 +0100
committerStephen Blott2015-06-01 14:56:08 +0100
commit35c52143d82c8b2bc3e07832e8f6cdb089453baf (patch)
tree9e38267f3cc8e0d82331a52373ad8f212f0ce3e0 /content_scripts/link_hints.coffee
parentf44ca0ff0b7f17a280e30348fdb68daa606b1b9f (diff)
parent34f0f90debf0050ece9bd847993f281c1e64be59 (diff)
downloadvimium-35c52143d82c8b2bc3e07832e8f6cdb089453baf.tar.bz2
Merge branch 'unified-settings-implementation'
Diffstat (limited to 'content_scripts/link_hints.coffee')
-rw-r--r--content_scripts/link_hints.coffee17
1 files changed, 6 insertions, 11 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index 3cebac4c..2bcc7508 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -26,20 +26,15 @@ LinkHints =
linkActivator: undefined
# While in delayMode, all keypresses have no effect.
delayMode: false
- # Handle the link hinting marker generation and matching. Must be initialized after settings have been
+ # Handle the link hinting marker generation and matching. Must be initialized after Settings have been
# loaded, so that we can retrieve the option setting.
getMarkerMatcher: ->
- if settings.get("filterLinkHints") then filterHints else alphabetHints
+ 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.
- #
- init: ->
-
# 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)
@@ -60,7 +55,7 @@ LinkHints =
# For these modes, we filter out those elements which don't have an HREF (since there's nothing we can do
# with them).
elements = (el for el in elements when el.element.href?) if mode in [ COPY_LINK_URL, OPEN_INCOGNITO ]
- if settings.get "filterLinkHints"
+ if Settings.get "filterLinkHints"
# When using text filtering, we sort the elements such that we visit descendants before their ancestors.
# This allows us to exclude the text used for matching descendants from that used for matching their
# ancestors.
@@ -389,7 +384,7 @@ alphabetHints =
# may be of different lengths.
#
hintStrings: (linkCount) ->
- linkHintCharacters = settings.get("linkHintCharacters")
+ linkHintCharacters = Settings.get("linkHintCharacters")
# Determine how many digits the link hints will require in the worst case. Usually we do not need
# all of these digits for every link single hint, so we can show shorter hints for a few of the links.
digitsNeeded = Math.ceil(@logXOfBase(linkCount, linkHintCharacters.length))
@@ -460,7 +455,7 @@ filterHints =
@labelMap[forElement] = labelText
generateHintString: (linkHintNumber) ->
- (numberToHintString linkHintNumber + 1, settings.get "linkHintNumbers").toUpperCase()
+ (numberToHintString linkHintNumber + 1, Settings.get "linkHintNumbers").toUpperCase()
generateLinkText: (element) ->
linkText = ""
@@ -519,7 +514,7 @@ filterHints =
if (!@hintKeystrokeQueue.pop() && !@linkTextKeystrokeQueue.pop())
return { linksMatched: [] }
else if (keyChar)
- if (settings.get("linkHintNumbers").indexOf(keyChar) >= 0)
+ if (Settings.get("linkHintNumbers").indexOf(keyChar) >= 0)
@hintKeystrokeQueue.push(keyChar)
else
# since we might renumber the hints, the current hintKeyStrokeQueue