X-Git-Url: https://git.donarmstrong.com/?p=dactyl.git;a=blobdiff_plain;f=common%2Fcontent%2Fhints.js;h=d151c2c3d688f439cc802ea732309d23ec896495;hp=a9154e88fcea43a9b57b84d53df8df9d25ea7f9f;hb=3d837eb266a3a01d424192aa4ec1a167366178c5;hpb=d8a3bcebff36df7b128b36e0b57b715479e155a0 diff --git a/common/content/hints.js b/common/content/hints.js index a9154e8..d151c2c 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -337,9 +337,11 @@ var HintSession = Class("HintSession", CommandMode, { if (elem.hasAttributeNS(NS, "hint")) [hint.text, hint.showText] = [elem.getAttributeNS(NS, "hint"), true]; - else if (isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement])) + else if (isinstance(elem, [Ci.nsIDOMHTMLInputElement, + Ci.nsIDOMHTMLSelectElement, + Ci.nsIDOMHTMLTextAreaElement])) [hint.text, hint.showText] = hints.getInputHint(elem, doc); - else if (elem.firstElementChild instanceof HTMLImageElement && /^\s*$/.test(elem.textContent)) + else if (elem.firstElementChild instanceof Ci.nsIDOMHTMLImageElement && /^\s*$/.test(elem.textContent)) [hint.text, hint.showText] = [elem.firstElementChild.alt || elem.firstElementChild.title, true]; else hint.text = elem.textContent.toLowerCase(); @@ -349,7 +351,7 @@ var HintSession = Class("HintSession", CommandMode, { let leftPos = Math.max((rect.left + offsetX), offsetX); let topPos = Math.max((rect.top + offsetY), offsetY); - if (elem instanceof HTMLAreaElement) + if (elem instanceof Ci.nsIDOMHTMLAreaElement) [leftPos, topPos] = this.getAreaOffset(elem, leftPos, topPos); hint.span.setAttribute("style", ["display: none; left:", leftPos, "px; top:", topPos, "px"].join("")); @@ -596,7 +598,7 @@ var HintSession = Class("HintSession", CommandMode, { if (!hint.valid) continue inner; - if (hint.text == "" && hint.elem.firstChild && hint.elem.firstChild instanceof HTMLImageElement) { + if (hint.text == "" && hint.elem.firstChild && hint.elem.firstChild instanceof Ci.nsIDOMHTMLImageElement) { if (!hint.imgSpan) { let rect = hint.elem.firstChild.getBoundingClientRect(); if (!rect) @@ -614,7 +616,7 @@ var HintSession = Class("HintSession", CommandMode, { let str = this.getHintString(hintnum); let text = []; - if (hint.elem instanceof HTMLInputElement) + if (hint.elem instanceof Ci.nsIDOMHTMLInputElement) if (hint.elem.type === "radio") text.push(UTF8(hint.elem.checked ? "⊙" : "○")); else if (hint.elem.type === "checkbox") @@ -781,7 +783,8 @@ var Hints = Module("hints", { this.addMode("i", "Show image", function (elem) dactyl.open(elem.src)); this.addMode("I", "Show image in a new tab", function (elem) dactyl.open(elem.src, dactyl.NEW_TAB)); - function isScrollable(elem) isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]) || + function isScrollable(elem) isinstance(elem, [Ci.nsIDOMHTMLFrameElement, + Ci.nsIDOMHTMLIFrameElement]) || Buffer.isScrollable(elem, 0, true) || Buffer.isScrollable(elem, 0, false); }, @@ -850,7 +853,7 @@ var Hints = Module("hints", { else { for (let [, option] in Iterator(options["hintinputs"])) { if (option == "value") { - if (elem instanceof HTMLSelectElement) { + if (elem instanceof Ci.nsIDOMHTMLSelectElement) { if (elem.selectedIndex >= 0) return [elem.item(elem.selectedIndex).text.toLowerCase(), false]; } @@ -1349,7 +1352,7 @@ var Hints = Module("hints", { { values: { "0": "Follow the first hint as soon as typed text uniquely identifies it. Follow the selected hint on .", - "1": "Follow the selected hint on .", + "1": "Follow the selected hint on ." } }); @@ -1386,4 +1389,4 @@ var Hints = Module("hints", { } }); -// vim: set fdm=marker sw=4 ts=4 et: +// vim: set fdm=marker sw=4 sts=4 ts=8 et: