mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-14 12:25:48 +01:00
Make "all" toggle other items in "activate", "eventignore", "newtab", and "sanitizeitems".
This commit is contained in:
@@ -110,7 +110,7 @@ const AutoCommands = Module("autocommands", {
|
||||
* @param {Object} args The args to pass to each autocommand.
|
||||
*/
|
||||
trigger: function (event, args) {
|
||||
if (options.get("eventignore").has("all", event))
|
||||
if (options.get("eventignore").has(event))
|
||||
return;
|
||||
|
||||
let autoCmds = this._store.filter(function (autoCmd) autoCmd.event == event);
|
||||
@@ -269,7 +269,8 @@ const AutoCommands = Module("autocommands", {
|
||||
"List of autocommand event names which should be ignored",
|
||||
"stringlist", "",
|
||||
{
|
||||
completer: function () Iterator(update({ all: "All Events" }, config.autocommands))
|
||||
completer: function () Iterator(update({ all: "All Events" }, config.autocommands)),
|
||||
has: Option.has.toggleAll
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -797,9 +797,9 @@ const Dactyl = Module("dactyl", {
|
||||
: params.where == dactyl.NEW_BACKGROUND_TAB;
|
||||
|
||||
if (params.from && dactyl.has("tabs")) {
|
||||
if (!params.where && options.get("newtab").has("all", params.from))
|
||||
if (!params.where && options.get("newtab").has(params.from))
|
||||
where = dactyl.NEW_TAB;
|
||||
background ^= !options.get("activate").has("all", params.from);
|
||||
background ^= !options.get("activate").has(params.from);
|
||||
}
|
||||
|
||||
if (urls.length == 0)
|
||||
|
||||
@@ -376,6 +376,12 @@ const Option = Class("Option", {
|
||||
*/
|
||||
SCOPE_BOTH: 3,
|
||||
|
||||
has: {
|
||||
toggleAll: function toggleAll() toggleAll.supercall(this, "all")
|
||||
? Array.some(arguments, function (val) this.value.indexOf(val) === -1, this)
|
||||
: toggleAll.superapply(this, arguments),
|
||||
},
|
||||
|
||||
parseRegex: function (value, result, flags) {
|
||||
let [, bang, val] = /^(!?)(.*)/.exec(value);
|
||||
let re = RegExp(Option.dequote(val), flags);
|
||||
|
||||
@@ -784,7 +784,7 @@ const Tabs = Module("tabs", {
|
||||
let tab = tabs.getTab();
|
||||
|
||||
let activate = args.bang ? true : false;
|
||||
if (options.get("activate").has("tabopen", "all"))
|
||||
if (options.get("activate").has("tabopen"))
|
||||
activate = !activate;
|
||||
|
||||
for (let i in util.range(0, Math.max(1, args.count)))
|
||||
@@ -1010,6 +1010,7 @@ const Tabs = Module("tabs", {
|
||||
|
||||
if (config.hasTabbrowser) {
|
||||
let activateGroups = [
|
||||
["all", "Activate everything"],
|
||||
["addons", ":addo[ns] command"],
|
||||
["bookmarks", "Tabs loaded from bookmarks", "loadBookmarksInBackground"],
|
||||
["diverted", "Links with targets set to new tabs", "loadDivertedInBackground"],
|
||||
@@ -1027,6 +1028,7 @@ const Tabs = Module("tabs", {
|
||||
"stringlist", [g[0] for (g in values(activateGroups)) if (!g[2] || !options.getPref("browser.tabs." + g[2]))].join(","),
|
||||
{
|
||||
completer: function (context) activateGroups,
|
||||
has: Option.has.toggleAll,
|
||||
setter: function (newValues) {
|
||||
let valueSet = set(newValues);
|
||||
for (let group in values(activateGroups))
|
||||
@@ -1050,7 +1052,8 @@ const Tabs = Module("tabs", {
|
||||
["help", ":h[elp] command"],
|
||||
["javascript", ":javascript! or :js! command"],
|
||||
["prefs", ":pref[erences]! or :prefs! command"]
|
||||
]
|
||||
],
|
||||
has: Option.has.toggleAll
|
||||
});
|
||||
|
||||
// TODO: Is this really applicable to Melodactyl?
|
||||
|
||||
Reference in New Issue
Block a user