diff options
| author | Jez Ng | 2012-10-26 02:00:54 -0400 |
|---|---|---|
| committer | Jez Ng | 2012-10-26 02:00:54 -0400 |
| commit | 12c9084bb9fd7fd269ad49d96eb14419c1b0bf03 (patch) | |
| tree | f05074f244bf1771b21750310841d35ad9bbe4e4 | |
| parent | 647fd97bef55d2371e87f0cd418ddff62f36800e (diff) | |
| download | vimium-12c9084bb9fd7fd269ad49d96eb14419c1b0bf03.tar.bz2 | |
Address feedback.
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index e3386bc4..a656eb70 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -804,7 +804,7 @@ findAndFollowLink = (linkStrings) -> return if (candidateLinks.length == 0) for link in candidateLinks - link.wc = link.innerText.trim().split(/\s+/).length + link.wordCount = link.innerText.trim().split(/\s+/).length # We can use this trick to ensure that Array.sort is stable. We need this property to retain the reverse # in-page order of the links. @@ -815,13 +815,13 @@ findAndFollowLink = (linkStrings) -> candidateLinks = candidateLinks .sort((a, b) -> - if (a.wc == b.wc) then a.originalIndex - b.originalIndex else a.wc - b.wc + if (a.wordCount == b.wordCount) then a.originalIndex - b.originalIndex else a.wordCount - b.wordCount ) - .filter((a) -> a.wc <= candidateLinks[0].wc + 1) + .filter((a) -> a.wordCount <= candidateLinks[0].wordCount + 1) for linkString in linkStrings exactWordRegex = - if /\b/.test linkString[0] or /\b/.test linkString[linkString.length - 1] + if /\b/.test(linkString[0]) or /\b/.test(linkString[linkString.length - 1]) new RegExp "\\b" + linkString + "\\b", "i" else new RegExp linkString, "i" |
