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