1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 18:17:58 +01:00

Miscellaneous semicolon, whitespace, and formatting fixes.

This commit is contained in:
Doug Kearns
2010-12-30 21:54:28 +11:00
parent 3c414d9ac9
commit 8e785245c1
22 changed files with 70 additions and 69 deletions

11
common/bootstrap.js vendored
View File

@@ -54,14 +54,14 @@ function startup(data, reason) {
dump("dactyl: bootstrap: init" + " " + data.id + "\n");
addon = data;
AddonManager.getAddonByID(addon.id, function (a) { addon = a });
AddonManager.getAddonByID(addon.id, function (a) { addon = a; });
if (basePath.isDirectory())
getURI = function getURI(path) {
let file = basePath.clone().QueryInterface(Ci.nsILocalFile);
file.appendRelativePath(path);
return (Services.io || services.io).newFileURI(file);
}
};
else
getURI = function getURI(path)
Services.io.newURI("jar:" + Services.io.newFileURI(basePath).spec + "!/" + path, null, null);
@@ -100,7 +100,7 @@ FactoryProxy.prototype = {
},
createInstance: function (iids) {
return let (factory = this.module.NSGetFactory(this.classID))
factory.createInstance.apply(factory, arguments)
factory.createInstance.apply(factory, arguments);
}
}
@@ -196,6 +196,7 @@ function reasonToString(reason) {
return name;
}
function install(data, reason) { dump("dactyl: bootstrap: install " + reasonToString(reason) + "\n") }
function uninstall(data, reason) { dump("dactyl: bootstrap: uninstall " + reasonToString(reason) + "\n") }
function install(data, reason) { dump("dactyl: bootstrap: install " + reasonToString(reason) + "\n"); }
function uninstall(data, reason) { dump("dactyl: bootstrap: uninstall " + reasonToString(reason) + "\n"); }
// vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -145,7 +145,7 @@ var Buffer = Module("buffer", {
dactyl.commands["buffer.viewSource"] = function (event) {
let elem = event.originalTarget;
buffer.viewSource([elem.getAttribute("href"), Number(elem.getAttribute("line"))])
buffer.viewSource([elem.getAttribute("href"), Number(elem.getAttribute("line"))]);
};
this.cleanupProgressListener = util.overlayObject(window.XULBrowserWindow,
@@ -1006,9 +1006,9 @@ var Buffer = Module("buffer", {
this.callback = callable(callback) ? callback :
function (file) {
editor.editFileExternally({ file: file.path, line: callback },
function () { file.remove(false) });
function () { file.remove(false); });
return true;
}
};
let url = isString(doc) ? util.newURI(doc) : doc.documentURIObject;
@@ -1478,9 +1478,9 @@ var Buffer = Module("buffer", {
util.map(array.iterValues(browsers), function ([i, browser]) {
let indicator = " ";
if (i == tabs.index())
indicator = "%"
indicator = "%";
else if (i == tabs.index(tabs.alternate))
indicator = "#";
indicator = "#";
let tab = tabs.getTab(i);
let url = browser.contentDocument.location.href;
@@ -1750,7 +1750,7 @@ var Buffer = Module("buffer", {
// page info
mappings.add(myModes, ["<C-g>"],
"Print the current file name",
function () { buffer.showPageInfo(false); })
function () { buffer.showPageInfo(false); });
mappings.add(myModes, ["g<C-g>"],
"Print file information",

View File

@@ -81,7 +81,7 @@ var CommandWidgets = Class("CommandWidgets", {
onclick="dactyl.modules.commandline.onMultilineOutputEvent(event)"/>
</vbox>
</toolbar>
</e4x>.elements(),
</e4x>.elements()
});
this.elements = {};
@@ -126,7 +126,7 @@ var CommandWidgets = Class("CommandWidgets", {
if (!elem.collapsed)
dactyl.focus(elem);
},
onVisibility: function (elem, visible) { visible && dactyl.focus(elem)}
onVisibility: function (elem, visible) { visible && dactyl.focus(elem); }
});
this.addElement({
name: "prompt",
@@ -1607,7 +1607,7 @@ var CommandLine = Module("commandline", {
XML.ignoreWhitespace = false;
commandline.commandOutput(
template.map(commandline._messageHistory.messages, function (message)
<div highlight={message.highlight + " Message"}>{message.message}</div>));;
<div highlight={message.highlight + " Message"}>{message.message}</div>));
}
},
{ argCount: "0" });

View File

@@ -346,7 +346,7 @@ var Command = Class("Command", {
break;
case "-javascript":
if (callable(params))
action = dactyl.userEval("(function action() { with (action.makeParams.apply(this, arguments)) {" + args.literalArg + "} })")
action = dactyl.userEval("(function action() { with (action.makeParams.apply(this, arguments)) {" + args.literalArg + "} })");
else
action = dactyl.userFunc.apply(dactyl, params.concat(args.literalArg).array);
process = function (param) isObject(param) && param.valueOf ? param.valueOf() : param;

View File

@@ -895,12 +895,11 @@ var Completion = Module("completion", {
context.fork("about", 6, this, function (context) {
context.generate = function () {
const PREFIX = "@mozilla.org/network/protocol/about;1?what=";
return [[k.substr(PREFIX.length), ""] for (k in Cc) if (k.indexOf(PREFIX) == 0)]
}
return [[k.substr(PREFIX.length), ""] for (k in Cc) if (k.indexOf(PREFIX) == 0)];
};
});
}
// Will, and should, throw an error if !(c in opts)
Array.forEach(complete, function (c) {
let completer = completion.urlCompleters[c];

View File

@@ -119,7 +119,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
}
let version = util.addon.version;
if ("@DATE" !== "@" + "DATE@")
version += " (created: @DATE@)"
version += " (created: @DATE@)";
return version;
}),
@@ -188,7 +188,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
.map(function (k) {
seen[k] = (seen[k] || 0) + 1;
return k;
}).uniq()
}).uniq();
},
options: params.options || []
});
@@ -430,7 +430,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
services.focus.focusedWindow = elem;
else
services.focus.setFocus(elem, flags);
} catch (e) {
}
catch (e) {
util.dump(elem);
util.reportError(e);
}
@@ -645,13 +646,13 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
this.helpInitialized = true;
}
},
stringifyXML: function (xml) {
XML.prettyPrinting = false;
XML.ignoreWhitespace = false;
return UTF8(xml.toXMLString());
},
exportHelp: JavaScript.setCompleter(function (path) {
const FILE = io.File(path);
const PATH = FILE.leafName.replace(/\..*/, "") + "/";
@@ -714,7 +715,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
value = value.replace(/(#|$)/, ".xhtml$1");
}
if (name == "src" && value.indexOf(":") > 0) {
chromeFiles[value] = value.replace(/.*\//, "");;
chromeFiles[value] = value.replace(/.*\//, "");
value = value.replace(/.*\//, "");
}
data.push(" ");

View File

@@ -581,7 +581,7 @@ var Editor = Module("editor", {
mappings.add([modes.INSERT],
["<C-t>"], "Edit text field in Vi mode",
function () {
dactyl.assert(!editor.isTextEdit)
dactyl.assert(!editor.isTextEdit);
modes.push(modes.TEXT_EDIT);
});
@@ -774,7 +774,7 @@ var Editor = Module("editor", {
has: function (key) set.has(util.compileMacro(this.value).seen, key),
validator: function (value) {
this.format({}, value);
return Object.keys(util.compileMacro(value).seen).every(function (k) ["column", "file", "line"].indexOf(k) >= 0)
return Object.keys(util.compileMacro(value).seen).every(function (k) ["column", "file", "line"].indexOf(k) >= 0);
}
});

View File

@@ -401,7 +401,7 @@ var Events = Module("events", {
// This causes a crash on Gecko<2.0, it seems.
(target.ownerDocument || target.document || target).defaultView
.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
.dispatchDOMEventViaPresShell(target, event, true)
.dispatchDOMEventViaPresShell(target, event, true);
else
target.dispatchEvent(event);
}
@@ -771,7 +771,8 @@ var Events = Module("events", {
else
elem.blur();
}
} catch (e) {
}
catch (e) {
util.dump(win, String(elem.ownerDocument), String(elem.ownerDocument && elem.ownerDocument.defaultView));
util.reportError(e);
}
@@ -948,7 +949,7 @@ var Events = Module("events", {
event.dactylString = "<BS>";
return mode.params.onEvent(event) === false;
}
};
}
if (!input.process(event))
@@ -1157,7 +1158,7 @@ var Events = Module("events", {
if (modes.replaying && !this.waitForPageLoad())
return true;
return !execute(map, null, this.count, null, command) || !map.route
return !execute(map, null, this.count, null, command) || !map.route;
}
}
else if (mappings.getCandidates(this.main, command).length > 0 && !event.skipmap) {

View File

@@ -544,7 +544,7 @@ var RangeFind = Class("RangeFind", {
let start = RangeFind.sameDocument(this.lastRange, this.range.range) && this.range.intersects(this.lastRange) ?
RangeFind.endpoint(this.lastRange, !(again ^ this.backward)) :
RangeFind.endpoint(this.range.range, !this.backward);;
RangeFind.endpoint(this.range.range, !this.backward);
if (this.backward && !again)
start = RangeFind.endpoint(this.startRange, false);

View File

@@ -1073,7 +1073,7 @@ var Hints = Module("hints", {
mappings.add(modes.HINTS, ["<Return>"],
"Follow the selected hint",
function () { update(true) });
function () { update(true); });
function tab(previous) {
hints.clearTimeout();
@@ -1097,11 +1097,11 @@ var Hints = Module("hints", {
mappings.add(modes.HINTS, ["<Tab>"],
"Focus the next matching hint",
function () { tab.call(hints, false) });
function () { tab.call(hints, false); });
mappings.add(modes.HINTS, ["<S-Tab>"],
"Focus the previous matching hint",
function () { tab.call(hints, true) });
function () { tab.call(hints, true); });
mappings.add(modes.HINTS, ["<BS>", "<C-h>"],
"Delete the previous character",

View File

@@ -232,7 +232,7 @@ var History = Module("history", {
].map(function (order) [
["+" + order.replace(" ", ""), "Sort by " + order + " ascending"],
["-" + order.replace(" ", ""), "Sort by " + order + " descending"],
]))
]));
}
}
],

View File

@@ -178,7 +178,7 @@ var Mappings = Module("mappings", {
modes = modes.slice();
return (map for ([i, map] in Iterator(stack[modes.shift()].sort(function (m1, m2) String.localeCompare(m1.name, m2.name))))
if (map.rhs && modes.every(function (mode) stack[mode].
some(function (m) m.rhs && m.rhs === map.rhs && m.name === map.name))))
some(function (m) m.rhs && m.rhs === map.rhs && m.name === map.name))));
},
iterate: function (mode) {
@@ -475,8 +475,8 @@ var Mappings = Module("mappings", {
names: ["-modes", "-mode", "-m"],
type: CommandOption.LIST,
description: "Remove all mappings from the given modes",
default: mapmodes || ["n", "v"],
}),
default: mapmodes || ["n", "v"]
})
]
});
@@ -502,8 +502,8 @@ var Mappings = Module("mappings", {
names: ["-modes", "-mode", "-m"],
type: CommandOption.LIST,
description: "Remove mapping from the given modes",
default: mapmodes || ["n", "v"],
}),
default: mapmodes || ["n", "v"]
})
]
});
}

View File

@@ -82,7 +82,7 @@ var Option = Class("Option", {
get isDefault() this.stringValue === this.stringDefaultValue,
/** @property {value} The option's global value. @see #scope */
get globalValue() { try { return options.store.get(this.name, {}).value } catch (e) { util.reportError(e); throw e; } },
get globalValue() { try { return options.store.get(this.name, {}).value; } catch (e) { util.reportError(e); throw e; } },
set globalValue(val) { options.store.set(this.name, { value: val, time: Date.now() }); },
/**
@@ -499,7 +499,7 @@ var Option = Class("Option", {
number: function (operator, values, scope, invert) {
if (invert)
values = values[(values.indexOf(String(this.value)) + 1) % values.length]
values = values[(values.indexOf(String(this.value)) + 1) % values.length];
let value = parseInt(values);
dactyl.assert(Number(values) % 1 == 0,
@@ -572,7 +572,7 @@ var Option = Class("Option", {
string: function (operator, values, scope, invert) {
if (invert)
return values[(values.indexOf(this.value) + 1) % values.length]
return values[(values.indexOf(this.value) + 1) % values.length];
switch (operator) {
case "+":
return this.value + values;
@@ -735,7 +735,7 @@ var Options = Module("options", {
isDefault: opt.isDefault,
default: opt.stringDefaultValue,
pre: "\u00a0\u00a0", // Unicode nonbreaking space.
value: <></>,
value: <></>
};
if (filter && !filter(opt))

View File

@@ -65,7 +65,7 @@ if (!XPCNativeWrapper.unwrap)
if (hasOwnProperty.call(obj, "wrappedJSObject"))
return obj.wrappedJSObject;
return obj;
}
};
if (!Object.create)
Object.create = function (proto, props) {
let obj = { __proto__: proto };
@@ -527,7 +527,7 @@ var isinstance_types = {
string: String,
function: Function,
number: Number
}
};
function isinstance(targ, src) {
src = Array.concat(src);
for (var i = 0; i < src.length; i++) {
@@ -870,7 +870,7 @@ Class.prototype = {
return;
util.trapErrors(callback, self);
}
return services.Timer(notify, timeout || 0, services.Timer.TYPE_ONE_SHOT);;
return services.Timer(notify, timeout || 0, services.Timer.TYPE_ONE_SHOT);
}
};
memoize(Class.prototype, "closure", function () {

View File

@@ -507,4 +507,4 @@ endModule();
} catch(e){ if (isString(e)) e = Error(e); dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack); }
// vim: set fdm=marker sw=4 ts=4 et:
// vim: set fdm=marker sw=4 sts=4 et ft=javascript:

View File

@@ -405,4 +405,4 @@ var Highlights = Module("Highlight", {
endModule();
// vim:se fdm=marker sw=4 ts=4 et ft=javascript:
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:

View File

@@ -263,4 +263,4 @@ var Overlay = Module("Overlay", {
}
});
// vim: set fdm=marker sw=4 ts=4 et:
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:

View File

@@ -32,7 +32,6 @@ Range.prototype.__defineGetter__("isSession", function () this.max == null && th
Range.prototype.__defineGetter__("native", function ()
this.isEternity ? null : [range.min || 0, range.max == null ? Number.MAX_VALUE : range.max]);
var Item = Class("Item", {
init: function (name) {
this.name = name;
@@ -311,7 +310,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
unset: 0,
allow: 1,
deny: 2,
session: 8,
session: 8
},
UNPERMS: Class.memoize(function () array.toObject([[v, k] for ([k, v] in Iterator(this.PERMS))])),
COMMANDS: {
@@ -322,12 +321,12 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
list: "List all cookies for domain",
clear: "Clear all cookies for domain",
"clear-persistent": "Clear all persistent cookies for domain",
"clear-session": "Clear all session cookies for domain",
"clear-session": "Clear all session cookies for domain"
},
argPrefMap: {
offlineapps: "offlineApps",
sitesettings: "siteSettings",
sitesettings: "siteSettings"
},
argToPref: function (arg) Sanitizer.argPrefMap[arg] || arg,
prefToArg: function (pref) pref.replace(/.*\./, "").toLowerCase(),
@@ -500,7 +499,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
for (let c in Sanitizer.iterCookies(host))
count[c.isSession + 0]++;
return <>{Sanitizer.COMMANDS[getPerms(host)]} (session: {count[1]} persistent: {count[0]})</>;
}
};
break;
case 1:
context.completions = Sanitizer.COMMANDS;
@@ -533,7 +532,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
getter: function () services.privateBrowsing.privateBrowsingEnabled,
setter: function (value) {
if (services.privateBrowsing.privateBrowsingEnabled != value)
services.privateBrowsing.privateBrowsingEnabled = value
services.privateBrowsing.privateBrowsingEnabled = value;
},
persist: false
});
@@ -584,7 +583,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
["10m", "Last ten minutes"],
["1h", "Past hour"],
["1d", "Past day"],
["1w", "Past week"],
["1w", "Past week"]
]
},
validator: function (value) /^(a(ll)?|s(ession)|\d+[mhdw])$/.test(value)

View File

@@ -51,7 +51,7 @@ var StoreBase = Class("StoreBase", {
this.reload();
},
changed: function () { this.timer.tell() },
changed: function () { this.timer.tell(); },
reload: function reload() {
this._object = this._load() || this._constructor();

View File

@@ -36,7 +36,7 @@ update(Sheet.prototype, {
function (filter) <span highlight={uris.some(Styles.matchFilter(filter)) ? "Filter" : ""}>{filter}</span>,
<>,</>),
remove: function () { this.hive.remove(this) },
remove: function () { this.hive.remove(this); },
get uri() cssUri(this.fullCSS),
@@ -491,7 +491,7 @@ var Styles = Module("Styles", {
context.generate = function () styles.user.sites;
context.keys.text = util.identity;
context.keys.description = function (site) this.sheets.length + " sheet" + (this.sheets.length == 1 ? "" : "s") + ": " +
array.compact(this.sheets.map(function (s) s.name)).join(", ")
array.compact(this.sheets.map(function (s) s.name)).join(", ");
context.keys.sheets = function (site) styles.user.sheets.filter(function (s) s.sites.indexOf(site) >= 0);
context.keys.active = function (site) uris.some(Styles.matchFilter(site));
@@ -532,7 +532,7 @@ var Styles = Module("Styles", {
var lastMatch = match;
if (lastMatch != null && !lastMatch.value && !lastMatch.postSpace) {
context.advance(lastMatch.index + lastMatch.preSpace.length)
context.advance(lastMatch.index + lastMatch.preSpace.length);
context.completions = names;
}
};
@@ -552,4 +552,4 @@ endModule();
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
// vim:se fdm=marker sw=4 ts=4 et ft=javascript:
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:

View File

@@ -83,7 +83,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
return prop.apply(dactyl, args);
return prop;
}
}
};
}, {
__noSuchMethod__: function () this().__noSuchMethod__.apply(null, arguments)
}),
@@ -966,7 +966,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
window.removeEventListener("DOMContentLoaded", listener.wrapper, true);
util._loadOverlays(window);
}
}), true)
}), true);
}
},
@@ -1053,7 +1053,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
return function unwrap() {
for each (let k in Object.getOwnPropertyNames(original))
Object.defineProperty(object, k, Object.getOwnPropertyDescriptor(original, k));
}
};
},
overlayWindow: function (url, fn) {
@@ -1234,7 +1234,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
catch (e) {
try {
this.dump(String(error));
this.dump(util.stackLines(error.stack).join("\n"))
this.dump(util.stackLines(error.stack).join("\n"));
}
catch (e) { dump(e + "\n"); }
}
@@ -1392,7 +1392,8 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
(function next() {
try {
util.timeout(next, gen.next());
} catch(e if e instanceof StopIteration) {};
}
catch (e if e instanceof StopIteration) {};
})();
},
@@ -1491,7 +1492,6 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
Array: array
});
/**
* Math utility methods.
* @singleton

View File

@@ -758,11 +758,11 @@ const Player = Module("player", {
mappings.add([modes.PLAYER],
["n"], "Find the next track",
function () { player.searchViewAgain(false);});
function () { player.searchViewAgain(false); });
mappings.add([modes.PLAYER],
["N"], "Find the previous track",
function () { player.searchViewAgain(true);});
function () { player.searchViewAgain(true); });
for (let i in util.range(0, 6)) {
let (rating = i) {