mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-28 19:52:27 +01:00
Closes issue #825.
This commit is contained in:
@@ -83,14 +83,14 @@ var actions = {
|
||||
name: "exte[nable]",
|
||||
description: "Enable an extension",
|
||||
action: function (addon) { addon.userDisabled = false; },
|
||||
filter: function ({ item }) item.userDisabled,
|
||||
filter: function (addon) addon.userDisabled,
|
||||
perm: "enable"
|
||||
},
|
||||
disable: {
|
||||
name: "extd[isable]",
|
||||
description: "Disable an extension",
|
||||
action: function (addon) { addon.userDisabled = true; },
|
||||
filter: function ({ item }) !item.userDisabled,
|
||||
filter: function (addon) !addon.userDisabled,
|
||||
perm: "disable"
|
||||
},
|
||||
options: {
|
||||
@@ -103,7 +103,7 @@ var actions = {
|
||||
else
|
||||
this.dactyl.open(addon.optionsURL, { from: "extoptions" });
|
||||
},
|
||||
filter: function ({ item }) item.isActive && item.optionsURL
|
||||
filter: function (addon) addon.isActive && addon.optionsURL
|
||||
},
|
||||
rehash: {
|
||||
name: "extr[ehash]",
|
||||
@@ -117,8 +117,8 @@ var actions = {
|
||||
});
|
||||
},
|
||||
get filter() {
|
||||
return function ({ item }) !item.userDisabled &&
|
||||
!(item.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE))
|
||||
return function (addon) !addon.userDisabled &&
|
||||
!(addon.operationsRequiringRestart & (AddonManager.OP_NEEDS_RESTART_ENABLE | AddonManager.OP_NEEDS_RESTART_DISABLE))
|
||||
},
|
||||
perm: "disable"
|
||||
},
|
||||
@@ -412,7 +412,7 @@ var Addons = Module("addons", {
|
||||
// TODO: handle extension dependencies
|
||||
values(actions).forEach(function (command) {
|
||||
let perm = command.perm && AddonManager["PERM_CAN_" + command.perm.toUpperCase()];
|
||||
function ok(addon) !perm || addon.permissions & perm;
|
||||
function ok(addon) (!perm || addon.permissions & perm) && (!command.filter || command.filter(addon));
|
||||
|
||||
commands.add(Array.concat(command.name),
|
||||
command.description,
|
||||
@@ -430,6 +430,7 @@ var Addons = Module("addons", {
|
||||
dactyl.assert(list.some(ok), _("error.invalidOperation"));
|
||||
list = list.filter(ok);
|
||||
}
|
||||
dactyl.assert(list.every(ok));
|
||||
if (command.actions)
|
||||
command.actions(list, this.modules);
|
||||
else
|
||||
@@ -441,8 +442,6 @@ var Addons = Module("addons", {
|
||||
completer: function (context, args) {
|
||||
completion.addon(context, args["-types"]);
|
||||
context.filters.push(function ({ item }) ok(item));
|
||||
if (command.filter)
|
||||
context.filters.push(command.filter);
|
||||
},
|
||||
literal: 0,
|
||||
options: [
|
||||
|
||||
@@ -2280,12 +2280,12 @@ var Buffer = Module("Buffer", {
|
||||
|
||||
options.add(["nextpattern"],
|
||||
"Patterns to use when guessing the next page in a document sequence",
|
||||
"regexplist", UTF8(/'\bnext\b',^>$,^(>>|»)$,^(>|»),(>|»)$,'\bmore\b'/.source),
|
||||
"regexplist", UTF8(/'^Next [>»]','^Next »','\bnext\b',^>$,^(>>|»)$,^(>|»),(>|»)$,'\bmore\b'/.source),
|
||||
{ regexpFlags: "i" });
|
||||
|
||||
options.add(["previouspattern"],
|
||||
"Patterns to use when guessing the previous page in a document sequence",
|
||||
"regexplist", UTF8(/'\bprev|previous\b',^<$,^(<<|«)$,^(<|«),(<|«)$/.source),
|
||||
"regexplist", UTF8(/'[<«] Prev$','« Prev$','\bprev(ious)\b',^<$,^(<<|«)$,^(<|«),(<|«)$/.source),
|
||||
{ regexpFlags: "i" });
|
||||
|
||||
options.add(["pageinfo", "pa"],
|
||||
|
||||
Reference in New Issue
Block a user