mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 09:48:00 +01:00
replace some match vars with matches for consistency's sake
This commit is contained in:
@@ -39,32 +39,33 @@ function Command(specs, description, action, extraInfo) //{{{
|
||||
// convert command name abbreviation specs of the form
|
||||
// 'shortname[optional-tail]' to short and long versions Eg. 'abc[def]' ->
|
||||
// 'abc', 'abcdef'
|
||||
var parseSpecs = function (specs)
|
||||
function parseSpecs(specs)
|
||||
{
|
||||
var shortNames = [];
|
||||
var longNames = [];
|
||||
var names = [];
|
||||
for (let i = 0; i < specs.length; i++)
|
||||
let shortNames = longNames = names = [];
|
||||
|
||||
for (let [,spec] in Iterator(specs))
|
||||
{
|
||||
var match;
|
||||
if (match = specs[i].match(/(\w+|!)\[(\w+)\]/))
|
||||
let matches = spec.match(/(\w+|!)\[(\w+)\]/);
|
||||
|
||||
if (matches)
|
||||
{
|
||||
shortNames.push(match[1]);
|
||||
longNames.push(match[1] + match[2]);
|
||||
shortNames.push(matches[1]);
|
||||
longNames.push(matches[1] + matches[2]);
|
||||
// order as long1, short1, long2, short2
|
||||
names.push(match[1] + match[2]);
|
||||
names.push(match[1]);
|
||||
names.push(matches[1] + matches[2]);
|
||||
names.push(matches[1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
longNames.push(specs[i]);
|
||||
names.push(specs[i]);
|
||||
longNames.push(spec);
|
||||
names.push(spec);
|
||||
}
|
||||
}
|
||||
|
||||
return { names: names, longNames: longNames, shortNames: shortNames };
|
||||
};
|
||||
|
||||
var expandedSpecs = parseSpecs(specs);
|
||||
let expandedSpecs = parseSpecs(specs);
|
||||
this.specs = specs;
|
||||
this.shortNames = expandedSpecs.shortNames;
|
||||
this.longNames = expandedSpecs.longNames;
|
||||
|
||||
@@ -312,21 +312,22 @@ function Tabs() //{{{
|
||||
if (args)
|
||||
{
|
||||
args = args.toLowerCase();
|
||||
var removed = 0;
|
||||
var match;
|
||||
if (match = args.match(/^(\d+):?/))
|
||||
let removed = 0;
|
||||
let matches = args.match(/^(\d+):?/);
|
||||
|
||||
if (matches)
|
||||
{
|
||||
tabs.remove(tabs.getTab(parseInt(match[1], 10) - 1));
|
||||
tabs.remove(tabs.getTab(parseInt(matches[1], 10) - 1));
|
||||
removed = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
var browsers = getBrowser().browsers;
|
||||
let browsers = getBrowser().browsers;
|
||||
for (let i = browsers.length - 1; i >= 0; i--)
|
||||
{
|
||||
var title = browsers[i].contentTitle.toLowerCase() || "";
|
||||
var uri = browsers[i].currentURI.spec.toLowerCase();
|
||||
var host = browsers[i].currentURI.host.toLowerCase();
|
||||
let title = browsers[i].contentTitle.toLowerCase() || "";
|
||||
let uri = browsers[i].currentURI.spec.toLowerCase();
|
||||
let host = browsers[i].currentURI.host.toLowerCase();
|
||||
|
||||
if (host.indexOf(args) >= 0 || uri == args ||
|
||||
(special && (title.indexOf(args) >= 0 || uri.indexOf(args) >= 0)))
|
||||
@@ -922,10 +923,10 @@ function Tabs() //{{{
|
||||
if (typeof reverse != "boolean")
|
||||
reverse = false;
|
||||
|
||||
var match;
|
||||
if (match = buffer.match(/^(\d+):?/))
|
||||
var matches = buffer.match(/^(\d+):?/);
|
||||
if (matches)
|
||||
{
|
||||
tabs.select(parseInt(match[1], 10) - 1, false); // make it zero-based
|
||||
tabs.select(parseInt(matches[1], 10) - 1, false); // make it zero-based
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user