mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 11: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
|
// convert command name abbreviation specs of the form
|
||||||
// 'shortname[optional-tail]' to short and long versions Eg. 'abc[def]' ->
|
// 'shortname[optional-tail]' to short and long versions Eg. 'abc[def]' ->
|
||||||
// 'abc', 'abcdef'
|
// 'abc', 'abcdef'
|
||||||
var parseSpecs = function (specs)
|
function parseSpecs(specs)
|
||||||
{
|
{
|
||||||
var shortNames = [];
|
let shortNames = longNames = names = [];
|
||||||
var longNames = [];
|
|
||||||
var names = [];
|
for (let [,spec] in Iterator(specs))
|
||||||
for (let i = 0; i < specs.length; i++)
|
|
||||||
{
|
{
|
||||||
var match;
|
let matches = spec.match(/(\w+|!)\[(\w+)\]/);
|
||||||
if (match = specs[i].match(/(\w+|!)\[(\w+)\]/))
|
|
||||||
|
if (matches)
|
||||||
{
|
{
|
||||||
shortNames.push(match[1]);
|
shortNames.push(matches[1]);
|
||||||
longNames.push(match[1] + match[2]);
|
longNames.push(matches[1] + matches[2]);
|
||||||
// order as long1, short1, long2, short2
|
// order as long1, short1, long2, short2
|
||||||
names.push(match[1] + match[2]);
|
names.push(matches[1] + matches[2]);
|
||||||
names.push(match[1]);
|
names.push(matches[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
longNames.push(specs[i]);
|
longNames.push(spec);
|
||||||
names.push(specs[i]);
|
names.push(spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return { names: names, longNames: longNames, shortNames: shortNames };
|
return { names: names, longNames: longNames, shortNames: shortNames };
|
||||||
};
|
};
|
||||||
|
|
||||||
var expandedSpecs = parseSpecs(specs);
|
let expandedSpecs = parseSpecs(specs);
|
||||||
this.specs = specs;
|
this.specs = specs;
|
||||||
this.shortNames = expandedSpecs.shortNames;
|
this.shortNames = expandedSpecs.shortNames;
|
||||||
this.longNames = expandedSpecs.longNames;
|
this.longNames = expandedSpecs.longNames;
|
||||||
|
|||||||
@@ -312,21 +312,22 @@ function Tabs() //{{{
|
|||||||
if (args)
|
if (args)
|
||||||
{
|
{
|
||||||
args = args.toLowerCase();
|
args = args.toLowerCase();
|
||||||
var removed = 0;
|
let removed = 0;
|
||||||
var match;
|
let matches = args.match(/^(\d+):?/);
|
||||||
if (match = 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;
|
removed = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var browsers = getBrowser().browsers;
|
let browsers = getBrowser().browsers;
|
||||||
for (let i = browsers.length - 1; i >= 0; i--)
|
for (let i = browsers.length - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
var title = browsers[i].contentTitle.toLowerCase() || "";
|
let title = browsers[i].contentTitle.toLowerCase() || "";
|
||||||
var uri = browsers[i].currentURI.spec.toLowerCase();
|
let uri = browsers[i].currentURI.spec.toLowerCase();
|
||||||
var host = browsers[i].currentURI.host.toLowerCase();
|
let host = browsers[i].currentURI.host.toLowerCase();
|
||||||
|
|
||||||
if (host.indexOf(args) >= 0 || uri == args ||
|
if (host.indexOf(args) >= 0 || uri == args ||
|
||||||
(special && (title.indexOf(args) >= 0 || uri.indexOf(args) >= 0)))
|
(special && (title.indexOf(args) >= 0 || uri.indexOf(args) >= 0)))
|
||||||
@@ -922,10 +923,10 @@ function Tabs() //{{{
|
|||||||
if (typeof reverse != "boolean")
|
if (typeof reverse != "boolean")
|
||||||
reverse = false;
|
reverse = false;
|
||||||
|
|
||||||
var match;
|
var matches = buffer.match(/^(\d+):?/);
|
||||||
if (match = 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user