1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-11 13:55:47 +01:00

Add 'passkeys' option.

This commit is contained in:
Kris Maglione
2010-11-04 09:02:12 -04:00
parent d89110813c
commit f1b8e7ee7e
5 changed files with 43 additions and 5 deletions

View File

@@ -645,7 +645,7 @@ const Dactyl = Module("dactyl", {
let res = <res>
<dt>{link(obj.name)}</dt> <dd>{obj.description ? obj.description.replace(/\.$/, "") : ""}</dd>
<item>
<tags>{template.map(obj.names, tag, " ")}</tags>
<tags>{template.map(obj.names.reverse, tag, " ")}</tags>
<spec>{spec((obj.specs || obj.names)[0])}</spec>{
!obj.type ? "" : <>
<type>{obj.type}</type>

View File

@@ -818,6 +818,8 @@ const Events = Module("events", {
modes.pop();
mode = modes.getStack(1);
}
else if (!event.isMacro && !event.noremap && options.get("passkeys").has(events.toString(event)))
stop = true;
// handle Escape-all-keys mode (Ctrl-q)
if (stop) {
@@ -959,7 +961,7 @@ const Events = Module("events", {
// Prevent certain sites from transferring focus to an input box
// before we get a chance to process our key bindings on the
// "keypress" event.
if (!Events.isInputElemFocused() && !modes.passThrough)
if (!Events.isInputElemFocused() && !modes.passThrough && !options.get("passkeys").has(events.toString(event)))
event.stopPropagation();
},
@@ -1094,6 +1096,24 @@ const Events = Module("events", {
{ arg: true, count: true });
},
options: function () {
options.add(["passkeys", "pk"],
"Pass certain keys through directly for the given URLs",
"regexpmap", "", {
has: function (key) {
let url = buffer.URI;
for (let re in values(this.value))
if (re.test(url) && re.result.some(function (k) k === key))
return true;
return false;
},
setter: function (values) {
values.forEach(function (re) {
re.result = events.fromString(re.result).map(events.closure.toString);
re.result.toString = function toString() this.join("");
});
return values;
}
});
options.add(["strictfocus", "sf"],
"Prevent scripts from focusing input elements without user intervention",
"boolean", true);