From 0f606aaf0d2a2a13f57ebed1b93d54aa1d7b7038 Mon Sep 17 00:00:00 2001 From: Daniel Carl Date: Fri, 12 Jul 2013 23:48:38 +0200 Subject: [PATCH] Show image title or alt in hint label. This allow the user to filter the hints. The hints where already filtered by the image title or alt attributes, but they aren't visible normally so this made less sense. But now the title or alt attributes content is visible in hinting mode. --- src/hints.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/hints.js b/src/hints.js index eddf326..8f6d739 100644 --- a/src/hints.js +++ b/src/hints.js @@ -68,6 +68,15 @@ var VbHint = (function(){ label.style.top = Math.max((rect.top + win.scrollY), win.scrollY) - 3 + "px"; label.innerText = count + 1; + /* if hinted element is an image - show title or alt of the image in hint label */ + /* this allows to see how to filter for the image */ + if (e instanceof HTMLImageElement) { + var text = e.alt || e.title; + if (text) { + label.innerText += ": " + text.substr(0, 20); + } + } + fragment.appendChild(label); /* add the hint class to the hinted element */ -- 2.20.1