diff options
| author | Stephen Blott | 2016-09-26 15:49:36 +0100 |
|---|---|---|
| committer | Stephen Blott | 2016-09-26 15:49:40 +0100 |
| commit | 6a14a480809e78c33034eac94b223b54dd35925a (patch) | |
| tree | 220e0e3534ae2ccba6da99b3f2eced9c0bc00176 | |
| parent | afeb65f5af849f04df8380212dbf50a6bf186bc4 (diff) | |
| download | vimium-6a14a480809e78c33034eac94b223b54dd35925a.tar.bz2 | |
Use title attribute for link text.
Google seems to be using a lot of "title" attributes on buttons. This
makes it possible to type the text in filtered link-hints mode. (And
you can often guess the text; e.g. "close").
We could also show the title text. That is very visually noisy though,
in practice.
| -rw-r--r-- | content_scripts/link_hints.coffee | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 4bfd3ef2..c86eabf1 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -858,8 +858,12 @@ LocalHints = else if hint.reason? linkText = hint.reason showLinkText = true + else if 0 < element.textContent.length + linkText = element.textContent[...256] + else if element.hasAttribute "title" + linkText = element.getAttribute "title" else - linkText = element.textContent[...256] || element.innerHTML[...256] + linkText = element.innerHTML[...256] {linkText: linkText.trim(), showLinkText} |
