diff --git a/common/content/buffer.js b/common/content/buffer.js index ace57af8..c5ffc058 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -498,10 +498,6 @@ var Buffer = Module("buffer", { * @param {bool} follow Whether to follow the matching link. * @param {string} path The CSS to use for the search. @optional */ - followDocumentRelationship: deprecated("buffer.findLink", - function followDocumentRelationship(rel) { - this.findLink(rel, options[rel + "pattern"], 0, true); - }), findLink: function findLink(rel, regexps, count, follow, path) { let selector = path || options.get("hinttags").stringDefaultValue; @@ -520,15 +516,16 @@ var Buffer = Module("buffer", { for (let elem in iter(elems)) yield elem; - let res = frame.document.querySelectorAll(selector); - for (let regexp in values(regexps)) { - for (let i in util.range(res.length, 0, -1)) { - let elem = res[i]; - if (regexp.test(elem.textContent) === regexp.result || regexp.test(elem.title) === regexp.result || - Array.some(elem.childNodes, function (child) regexp.test(child.alt) === regexp.result)) - yield elem; - } - } + function a(regexp, elem) regexp.test(elem.textContent) === regexp.result || + Array.some(elem.childNodes, function (child) regexp.test(child.alt) === regexp.result); + function b(regexp, elem) regexp.test(elem.title); + + let res = Array.filter(frame.document.querySelectorAll(selector), Hints.isVisible); + for (let test in values([a, b])) + for (let regexp in values(regexps)) + for (let i in util.range(res.length, 0, -1)) + if (test(regexp, res[i])) + yield res[i]; } for (let frame in values(this.allFrames(null, true))) @@ -542,6 +539,10 @@ var Buffer = Module("buffer", { if (follow) dactyl.beep(); }, + followDocumentRelationship: deprecated("buffer.findLink", + function followDocumentRelationship(rel) { + this.findLink(rel, options[rel + "pattern"], 0, true); + }), /** * Fakes a click on a link. diff --git a/common/content/hints.js b/common/content/hints.js index a30ef295..a7d2b611 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -1077,6 +1077,18 @@ var Hints = Module("hints", { this.hintSession = HintSession(mode, opts); } }, { + isVisible: function isVisible(elem) { + let rect = elem.getBoundingClientRect(); + if (!rect.width || !rect.height) + if (!Array.some(elem.childNodes, function (elem) elem instanceof Element && util.computedStyle(elem).float != "none" && isVisible(elem))) + return false; + + let computedStyle = util.computedStyle(elem, null); + if (computedStyle.visibility != "visible" || computedStyle.display == "none") + return false; + return true; + }, + translitTable: Class.memoize(function () { const table = {}; [ diff --git a/pentadactyl/TODO b/pentadactyl/TODO index 809af63a..4a4abe47 100644 --- a/pentadactyl/TODO +++ b/pentadactyl/TODO @@ -16,7 +16,6 @@ FEATURES: locations in the history list). 9 clean up error message codes and document 9 option groups, including buffer-local and site-specific -9 proper motion maps 8 wherever possible: get rid of dialogs and ask console-like dialog questions or write error prompts directly on the webpage or with :echo() 8 add search capability to MOW