mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 21:28:00 +01:00
Generally insignificant aesthetic changes.
This commit is contained in:
@@ -233,15 +233,6 @@ function Commands() //{{{
|
|||||||
|
|
||||||
var exCommands = [];
|
var exCommands = [];
|
||||||
|
|
||||||
function parseBool(arg)
|
|
||||||
{
|
|
||||||
if (arg == "true" || arg == "1" || arg == "on")
|
|
||||||
return true;
|
|
||||||
if (arg == "false" || arg == "0" || arg == "off")
|
|
||||||
return false;
|
|
||||||
return NaN;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QUOTE_STYLE = "vimperator";
|
const QUOTE_STYLE = "vimperator";
|
||||||
|
|
||||||
const quoteMap = {
|
const quoteMap = {
|
||||||
@@ -264,16 +255,24 @@ function Commands() //{{{
|
|||||||
"": quote("", "\\\\ ")
|
"": quote("", "\\\\ ")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function parseBool(arg)
|
||||||
|
{
|
||||||
|
if (/^(true|1|on)$/i.test(arg))
|
||||||
|
return true;
|
||||||
|
if (/^(false|0|off)$/i.test(arg))
|
||||||
|
return false;
|
||||||
|
return NaN;
|
||||||
|
}
|
||||||
const ArgType = new Struct("description", "parse");
|
const ArgType = new Struct("description", "parse");
|
||||||
const argTypes = [
|
const argTypes = [
|
||||||
null,
|
null,
|
||||||
["no arg", function (arg) !arg],
|
ArgType("no arg", function (arg) !arg || null),
|
||||||
["boolean", parseBool],
|
ArgType("boolean", parseBool),
|
||||||
["string", function (val) val],
|
ArgType("string", function (val) val),
|
||||||
["int", parseInt],
|
ArgType("int", parseInt),
|
||||||
["float", parseFloat],
|
ArgType("float", parseFloat),
|
||||||
["list", function (arg) arg && arg.split(/\s*,\s*/)]
|
ArgType("list", function (arg) arg && arg.split(/\s*,\s*/))
|
||||||
].map(function (x) x && ArgType.apply(null, x));
|
];
|
||||||
|
|
||||||
function addCommand(command, isUserCommand, replace)
|
function addCommand(command, isUserCommand, replace)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ function IO() //{{{
|
|||||||
const EXTENSION_NAME = config.name.toLowerCase(); // "vimperator" or "muttator"
|
const EXTENSION_NAME = config.name.toLowerCase(); // "vimperator" or "muttator"
|
||||||
|
|
||||||
const downloadManager = Cc["@mozilla.org/download-manager;1"].createInstance(Ci.nsIDownloadManager);
|
const downloadManager = Cc["@mozilla.org/download-manager;1"].createInstance(Ci.nsIDownloadManager);
|
||||||
const ioService = services.get("io");
|
|
||||||
|
|
||||||
var processDir = services.get("directory").get("CurWorkD", Ci.nsIFile);
|
var processDir = services.get("directory").get("CurWorkD", Ci.nsIFile);
|
||||||
var cwd = processDir;
|
var cwd = processDir;
|
||||||
@@ -901,7 +900,7 @@ lookup:
|
|||||||
liberator.echomsg("sourcing " + filename.quote(), 2);
|
liberator.echomsg("sourcing " + filename.quote(), 2);
|
||||||
|
|
||||||
let str = self.readFile(file);
|
let str = self.readFile(file);
|
||||||
let uri = ioService.newFileURI(file);
|
let uri = services.get("io").newFileURI(file);
|
||||||
|
|
||||||
// handle pure JavaScript files specially
|
// handle pure JavaScript files specially
|
||||||
if (/\.js$/.test(filename))
|
if (/\.js$/.test(filename))
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ const util = { //{{{
|
|||||||
* ['www.google.com/search?q=bla', 'www.osnews.com']
|
* ['www.google.com/search?q=bla', 'www.osnews.com']
|
||||||
*
|
*
|
||||||
* @param {string} str
|
* @param {string} str
|
||||||
* @returns {Array}
|
* @returns {string[]}
|
||||||
*/
|
*/
|
||||||
stringToURLArray: function stringToURLArray(str)
|
stringToURLArray: function stringToURLArray(str)
|
||||||
{
|
{
|
||||||
@@ -623,7 +623,7 @@ const util = { //{{{
|
|||||||
// Try to find a matching file.
|
// Try to find a matching file.
|
||||||
let file = io.getFile(url);
|
let file = io.getFile(url);
|
||||||
if (file.exists() && file.isReadable())
|
if (file.exists() && file.isReadable())
|
||||||
return file.path;
|
return services.get("io").newFileURI(file).spec;
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
|
|
||||||
@@ -638,14 +638,13 @@ const util = { //{{{
|
|||||||
|
|
||||||
// Ok, not a valid proto. If it looks like URL-ish (foo.com/bar),
|
// Ok, not a valid proto. If it looks like URL-ish (foo.com/bar),
|
||||||
// let Gecko figure it out.
|
// let Gecko figure it out.
|
||||||
if (/[.]/.test(url) && !/\s/.test(url) || /^[\w.]+:\d+(?:\/|$)/.test(url))
|
if (/[.]/.test(url) && !/\s/.test(url) || /^[\w-.]+:\d+(?:\/|$)/.test(url))
|
||||||
return url;
|
return url;
|
||||||
|
|
||||||
// TODO: it would be clearer if the appropriate call to
|
// TODO: it would be clearer if the appropriate call to
|
||||||
// getSearchURL was made based on whether or not the first word was
|
// getSearchURL was made based on whether or not the first word was
|
||||||
// indeed an SE alias rather than seeing if getSearchURL can
|
// indeed an SE alias rather than seeing if getSearchURL can
|
||||||
// process the call usefully and trying again if it fails - much
|
// process the call usefully and trying again if it fails
|
||||||
// like the comments below ;-)
|
|
||||||
|
|
||||||
// check for a search engine match in the string, then try to
|
// check for a search engine match in the string, then try to
|
||||||
// search for the whole string in the default engine
|
// search for the whole string in the default engine
|
||||||
|
|||||||
Reference in New Issue
Block a user