diff options
author | portix <none@none> | 2012-12-10 22:34:54 +0100 |
---|---|---|
committer | portix <none@none> | 2012-12-10 22:34:54 +0100 |
commit | 21336c9980b9ef298c2c249200b333069c8ceaa3 (patch) | |
tree | 3f8872009fa6ae9a3cc45fdaf1b0a2963b6bb099 /scripts | |
parent | 53a0ecd3cec7e134ce07214cd2ca9aab08efa0dd (diff) | |
download | dwb-21336c9980b9ef298c2c249200b333069c8ceaa3.zip |
Show url of active hint; closing #247
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/base.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/scripts/base.js b/scripts/base.js index 0fd8dfd0..280d6d03 100644 --- a/scripts/base.js +++ b/scripts/base.js @@ -16,6 +16,7 @@ Object.freeze((function () { lastInput : null, lastPosition : 0, newTab : false, + notify : null, hintTypes : [ "a, textarea, select, input:not([type=hidden]), button, frame, iframe, [onclick], [onmousedown]," + "[role=link], [role=option], [role=button], [role=option], img", // HINT_T_ALL //[ "iframe", @@ -278,7 +279,6 @@ Object.freeze((function () { active.overlay.parentNode.removeChild(active.overlay); active.hint.style.font = globals.font; - } globals.active = element; if (!globals.active.overlay) @@ -287,6 +287,16 @@ Object.freeze((function () { if (!globals.markHints) globals.active.hint.parentNode.appendChild(globals.active.overlay); + var e = element.element; + if (e.href || e.src) + globals.notify.innerText = encodeURI(e.href || e.ret); + else if (e.name) + globals.notify.innerText = e.tagName.toLowerCase() + ", name=" + e.name; + else if (e.innerText && e.innerText.trim().length > 0) + globals.notify.innerText = e.tagName.toLowerCase() + ": " + e.innerText.replace("\n\r", "").trim(); + else + globals.notify.innerText = e.tagName.toLowerCase(); + globals.active.overlay.style.background = globals.activeColor; globals.active.hint.style.fontSize = globals.bigFont; }; @@ -448,6 +458,18 @@ Object.freeze((function () { return __evaluate(globals.elements[0].element, type); } + globals.notify = document.createElement("div"); + globals.notify.style.cssText = + "bottom:0px;left:0px;position:fixed;z-index:1000;" + + "text-overflow:ellipsis;white-space:nowrap;overflow:hidden;max-width:100%;" + + "border-right:1px solid #555;" + + "border-top:1px solid #555;" + + "padding-right:2px;" + + "border-radius:0px 5px 0px 0px;letter-spacing:0px;background:" + globals.bgColor + ";" + + "color:" + globals.fgColor + ";font:" + globals.font + ";font-size:" + globals.fontSize + ";"; + globals.notify.id = "dwb_hint_notifier"; + document.body.appendChild(globals.notify); + __getTextHints(globals.elements); globals.activeArr = globals.elements; __setActive(globals.elements[0]); @@ -569,6 +591,8 @@ Object.freeze((function () { globals.lastPosition = 0; globals.lastInput = null; globals.positions = []; + globals.notify.parentNode.removeChild(globals.notify); + globals.notify = null; }; var __evaluate = function (e, type) { |