aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2016-03-13 08:10:23 +0000
committerStephen Blott2016-03-28 05:45:38 +0100
commitb7f0487d32dd50b73cf7729bbb4a900db9b786c8 (patch)
tree29fe9d8078bd31454f2346403220ac24272b2b46 /content_scripts
parent6271ce2ba4e73c7506f638113660a5fb1e66e999 (diff)
downloadvimium-b7f0487d32dd50b73cf7729bbb4a900db9b786c8.tar.bz2
Global link hints; revert b7535a604954b5873d825eb66bfecd08f1f2c99b.
Here's why: - b7535a604954b5873d825eb66bfecd08f1f2c99b is complicated and complex (O(n^2)). - With experience, it is not obviously better than what was there before, and in some cases it's worse. - b7535a604954b5873d825eb66bfecd08f1f2c99b selects way too much text in some cases; e.g. on Google Inbox, it selects text lengths in the tens of thousands of characters. That cannot be useful. - With global hints, this extra cost (resulting from passing large objects between frames) is significant and noticable. - The simpler approach of accounting for text length when scoring filtered hints (tweaked here: 5cbc5ad702a01a81b98f8c82edb3b6d227c2c7b5) works better in practice.
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/link_hints.coffee5
1 files changed, 2 insertions, 3 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index 32d67ab9..fae255c6 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -321,7 +321,6 @@ LocalHints =
hint.hasHref = hint.element.href? for hint in localHints
if Settings.get "filterLinkHints"
- DomUtils.textContent.reset()
@generateLabelMap()
extend hint, @generateLinkText hint.element for hint in localHints
@@ -354,14 +353,14 @@ LocalHints =
linkText = element.value
if not linkText and 'placeholder' of element
linkText = element.placeholder
- # check if there is an image embedded in the <a> tag
+ # Check if there is an image embedded in the <a> tag.
else if (nodeName == "a" && !element.textContent.trim() &&
element.firstElementChild &&
element.firstElementChild.nodeName.toLowerCase() == "img")
linkText = element.firstElementChild.alt || element.firstElementChild.title
showLinkText = true if (linkText)
else
- linkText = DomUtils.textContent.get element
+ linkText = (element.textContent.trim() || element.innerHTML.trim())[...512]
{linkText, showLinkText}