diff options
| author | Stephen Blott | 2016-03-28 07:06:08 +0100 | 
|---|---|---|
| committer | Stephen Blott | 2016-03-28 07:06:10 +0100 | 
| commit | 7997d7f21e096fde96dd7e06c872e33df78bba9c (patch) | |
| tree | 5e07dcdb80548be50c68263a6c361d912230e385 | |
| parent | 9c1ea0ce9f4b31e288c0808dd28796bb36df1aaf (diff) | |
| download | vimium-7997d7f21e096fde96dd7e06c872e33df78bba9c.tar.bz2 | |
Better names for variables.
These variable names are misleading.  The things being manipulated are
actually hint descriptors.
So this renames the variables accordingly.
| -rw-r--r-- | content_scripts/link_hints.coffee | 21 | 
1 files changed, 11 insertions, 10 deletions
| diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index efe6f045..a1a3516c 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -112,19 +112,20 @@ class LinkHintsMode    # A count of the number of Tab presses since the last non-Tab keyboard event.    tabCount: 0 -  constructor: (elements, mode = OPEN_IN_CURRENT_TAB) -> +  constructor: (hintDescriptors, mode = OPEN_IN_CURRENT_TAB) ->      # we need documentElement to be ready in order to append links      return unless document.documentElement -    # 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.hasHref) if mode in [ COPY_LINK_URL, OPEN_INCOGNITO ] +    if mode in [COPY_LINK_URL, OPEN_INCOGNITO] +      # For these modes, we filter out those descriptors which don't have an HREF (since there's nothing we +      # can do with them). +      hintDescriptors = (desc for desc in hintDescriptors when desc.hasHref) -    if elements.length == 0 +    if hintDescriptors.length == 0        HUD.showForDuration "No links to select.", 2000        return -    hintMarkers = (@createMarkerFor(el) for el in elements) +    hintMarkers = (@createMarkerFor desc for desc in hintDescriptors)      @markerMatcher = new (if Settings.get "filterLinkHints" then FilterHints else AlphabetHints)      @markerMatcher.fillInMarkers hintMarkers @@ -163,15 +164,15 @@ class LinkHintsMode    createMarkerFor: do ->      # This count is used to rank equal-scoring hints when sorting, thereby making JavaScript's sort stable.      stableSortCount = 0 -    (link) -> +    (desc) ->        marker = DomUtils.createElement "div"        marker.className = "vimiumReset internalVimiumHintMarker vimiumHintMarker"        marker.stableSortCount = ++stableSortCount -      # Extract other relevant fields from the hint descriptor. TODO(smblott) "link" here is misleading. +      # Extract other relevant fields from the hint descriptor.        extend marker, -        {hintDescriptor: link, linkText: link.linkText, showLinkText: link.showLinkText, rect: link.rect} +        {hintDescriptor: desc, linkText: desc.linkText, showLinkText: desc.showLinkText, rect: desc.rect} -      clientRect = link.rect +      clientRect = desc.rect        marker.style.left = clientRect.left + window.scrollX + "px"        marker.style.top = clientRect.top  + window.scrollY  + "px" | 
