mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 14:47:59 +01:00
Fix hint generation after closing a window.
This commit is contained in:
@@ -303,7 +303,6 @@ var Editor = Module("editor", {
|
|||||||
if (tmpfile && tmpfile.exists())
|
if (tmpfile && tmpfile.exists())
|
||||||
tmpfile.remove(false);
|
tmpfile.remove(false);
|
||||||
|
|
||||||
// blink the textbox after returning
|
|
||||||
if (textBox) {
|
if (textBox) {
|
||||||
dactyl.focus(textBox);
|
dactyl.focus(textBox);
|
||||||
for (let group in values(blink.concat(blink, ""))) {
|
for (let group in values(blink.concat(blink, ""))) {
|
||||||
|
|||||||
@@ -1012,42 +1012,6 @@ var Hints = Module("hints", {
|
|||||||
this.hintSession = HintSession(mode, opts);
|
this.hintSession = HintSession(mode, opts);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|
||||||
compileMatcher: function compileMatcher(list) {
|
|
||||||
let xpath = [], css = [];
|
|
||||||
for (let elem in values(list))
|
|
||||||
if (/^xpath:/.test(elem))
|
|
||||||
xpath.push(elem.substr(6));
|
|
||||||
else
|
|
||||||
css.push(elem);
|
|
||||||
|
|
||||||
return update(
|
|
||||||
function matcher(node) {
|
|
||||||
if (matcher.xpath)
|
|
||||||
for (let elem in util.evaluateXPath(matcher.xpath, node))
|
|
||||||
yield elem;
|
|
||||||
|
|
||||||
if (matcher.css)
|
|
||||||
for (let [, elem] in iter(node.querySelectorAll(matcher.css)))
|
|
||||||
yield elem;
|
|
||||||
}, {
|
|
||||||
css: css.join(", "),
|
|
||||||
xpath: xpath.join(" | ")
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
validateMatcher: function validateMatcher(values) {
|
|
||||||
let evaluator = services.XPathEvaluator();
|
|
||||||
let node = util.xmlToDom(<div/>, document);
|
|
||||||
return this.testValues(values, function (value) {
|
|
||||||
if (/^xpath:/.test(value))
|
|
||||||
evaluator.createExpression(value.substr(6), util.evaluateXPath.resolver);
|
|
||||||
else
|
|
||||||
node.querySelector(value);
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
translitTable: Class.memoize(function () {
|
translitTable: Class.memoize(function () {
|
||||||
const table = {};
|
const table = {};
|
||||||
[
|
[
|
||||||
@@ -1218,10 +1182,10 @@ var Hints = Module("hints", {
|
|||||||
res ? res.matcher : default_,
|
res ? res.matcher : default_,
|
||||||
setter: function (vals) {
|
setter: function (vals) {
|
||||||
for (let value in values(vals))
|
for (let value in values(vals))
|
||||||
value.matcher = Hints.compileMatcher(Option.splitList(value.result));
|
value.matcher = util.compileMatcher(Option.splitList(value.result));
|
||||||
return vals;
|
return vals;
|
||||||
},
|
},
|
||||||
validator: Hints.validateMatcher
|
validator: util.validateMatcher
|
||||||
});
|
});
|
||||||
|
|
||||||
options.add(["hinttags", "ht"],
|
options.add(["hinttags", "ht"],
|
||||||
@@ -1231,10 +1195,10 @@ var Hints = Module("hints", {
|
|||||||
"[tabindex],[role=link],[role=button]",
|
"[tabindex],[role=link],[role=button]",
|
||||||
{
|
{
|
||||||
setter: function (values) {
|
setter: function (values) {
|
||||||
this.matcher = Hints.compileMatcher(values);
|
this.matcher = util.compileMatcher(values);
|
||||||
return values;
|
return values;
|
||||||
},
|
},
|
||||||
validator: Hints.validateMatcher
|
validator: util.validateMatcher
|
||||||
});
|
});
|
||||||
|
|
||||||
options.add(["hintkeys", "hk"],
|
options.add(["hintkeys", "hk"],
|
||||||
|
|||||||
@@ -405,6 +405,42 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
return stack.top;
|
return stack.top;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
compileMatcher: function compileMatcher(list) {
|
||||||
|
let xpath = [], css = [];
|
||||||
|
for (let elem in values(list))
|
||||||
|
if (/^xpath:/.test(elem))
|
||||||
|
xpath.push(elem.substr(6));
|
||||||
|
else
|
||||||
|
css.push(elem);
|
||||||
|
|
||||||
|
return update(
|
||||||
|
function matcher(node) {
|
||||||
|
if (matcher.xpath)
|
||||||
|
for (let elem in util.evaluateXPath(matcher.xpath, node))
|
||||||
|
yield elem;
|
||||||
|
|
||||||
|
if (matcher.css)
|
||||||
|
for (let [, elem] in iter(node.querySelectorAll(matcher.css)))
|
||||||
|
yield elem;
|
||||||
|
}, {
|
||||||
|
css: css.join(", "),
|
||||||
|
xpath: xpath.join(" | ")
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
validateMatcher: function validateMatcher(values) {
|
||||||
|
let evaluator = services.XPathEvaluator();
|
||||||
|
let node = util.xmlToDom(<div/>, document);
|
||||||
|
return this.testValues(values, function (value) {
|
||||||
|
if (/^xpath:/.test(value))
|
||||||
|
evaluator.createExpression(value.substr(6), util.evaluateXPath.resolver);
|
||||||
|
else
|
||||||
|
node.querySelector(value);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an object representing a Node's computed CSS style.
|
* Returns an object representing a Node's computed CSS style.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user