1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-03-27 05:13:31 +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

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))