mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 00:07:59 +01:00
Run style bot.
--HG-- extra : rebase_source : 3661ea16c48258e44239734cdad6bc18abc70b5f
This commit is contained in:
9
HACKING
9
HACKING
@@ -87,7 +87,7 @@ In general: Just look at the existing source code!
|
||||
https://developer.mozilla.org/en/New_in_JavaScript_1.7#Block_scope_with_let
|
||||
|
||||
* Reuse common local variable names E.g. "elem" is generally used for element,
|
||||
"win" for windows, "func" for functions, "ret" for return values etc.
|
||||
"win" for windows, "func" for functions, "res" for return values etc.
|
||||
|
||||
* Prefer // over /* */ comments (exceptions for big comments are usually OK)
|
||||
Right: if (HACK) // TODO: remove hack
|
||||
@@ -138,12 +138,7 @@ In general: Just look at the existing source code!
|
||||
Functional tests are implemented using the Mozmill automated testing framework
|
||||
-- https://developer.mozilla.org/en/Mozmill_Tests.
|
||||
|
||||
A fresh profile is created for the duration of the test run, however, passing
|
||||
arguments to the host application won't be supported until Mozmill 1.5.2, the
|
||||
next release, so any user RC and plugin files should be temporarily disabled.
|
||||
This can be done by adding the following to the head of the RC file:
|
||||
set loadplugins=
|
||||
finish
|
||||
A fresh profile is created for the duration of the test run.
|
||||
|
||||
The host application binary tested can be overridden via the HOSTAPP_PATH
|
||||
makefile variable. E.g.,
|
||||
|
||||
1
common/bootstrap.js
vendored
1
common/bootstrap.js
vendored
@@ -41,7 +41,6 @@ if (!JSMLoader && "@mozilla.org/fuel/application;1" in Components.classes)
|
||||
.getService(Components.interfaces.extIApplication)
|
||||
.storage.get("dactyl.JSMLoader", null);
|
||||
|
||||
|
||||
function reportError(e) {
|
||||
dump("\ndactyl: bootstrap: " + e + "\n" + (e.stack || Error().stack) + "\n");
|
||||
Cu.reportError(e);
|
||||
|
||||
@@ -403,7 +403,7 @@ var Bookmarks = Module("bookmarks", {
|
||||
completer: function title(context, args) {
|
||||
let frames = buffer.allFrames();
|
||||
if (!args.bang)
|
||||
return [
|
||||
return [
|
||||
[win.document.title, frames.length == 1 ? "Current Location" : "Frame: " + win.location.href]
|
||||
for ([, win] in Iterator(frames))];
|
||||
context.keys.text = "title";
|
||||
@@ -521,7 +521,7 @@ var Bookmarks = Module("bookmarks", {
|
||||
let context = CompletionContext(args.join(" "));
|
||||
context.fork("bookmark", 0, completion, "bookmark",
|
||||
args["-tags"], { keyword: args["-keyword"], title: args["-title"] });
|
||||
var deletedCount = bookmarks.remove(context.allItems.items.map(function (item) item.item.id));
|
||||
deletedCount = bookmarks.remove(context.allItems.items.map(function (item) item.item.id));
|
||||
}
|
||||
|
||||
dactyl.echomsg({ message: _("bookmark.deleted", deletedCount) });
|
||||
|
||||
@@ -742,7 +742,7 @@ var Buffer = Module("buffer", {
|
||||
* Shifts the focus to another frame within the buffer. Each buffer
|
||||
* contains at least one frame.
|
||||
*
|
||||
* @param {number} count The number of frames to skip through. A negative
|
||||
* @param {number} count The number of frames to skip through. A negative
|
||||
* count skips backwards.
|
||||
*/
|
||||
shiftFrameFocus: function shiftFrameFocus(count) {
|
||||
@@ -1006,14 +1006,14 @@ var Buffer = Module("buffer", {
|
||||
* Adjusts the page zoom of the current buffer relative to the
|
||||
* current zoom level.
|
||||
*
|
||||
* @param {number} steps The integral number of natural fractions by
|
||||
* which to adjust the current page zoom. If positive, the zoom
|
||||
* level is increased, if negative it is decreased.
|
||||
* @param {number} steps The integral number of natural fractions by which
|
||||
* to adjust the current page zoom. If positive, the zoom level is
|
||||
* increased, if negative it is decreased.
|
||||
* @param {boolean} fullZoom If true, zoom all content of the page,
|
||||
* including raster images. If false, zoom only text. If omitted,
|
||||
* use the current zoom function. @optional
|
||||
* @throws {FailedAssertion} if the buffer's zoom level is already
|
||||
* at its extreme in the given direction.
|
||||
* including raster images. If false, zoom only text. If omitted, use
|
||||
* the current zoom function. @optional
|
||||
* @throws {FailedAssertion} if the buffer's zoom level is already at its
|
||||
* extreme in the given direction.
|
||||
*/
|
||||
bumpZoomLevel: function bumpZoomLevel(steps, fullZoom) {
|
||||
if (fullZoom === undefined)
|
||||
|
||||
@@ -175,7 +175,7 @@ var CommandWidgets = Class("CommandWidgets", {
|
||||
if (obj.value != null)
|
||||
return [obj.value[0],
|
||||
obj.get ? obj.get.call(this, elem) : elem.value]
|
||||
.concat(obj.value.slice(2))
|
||||
.concat(obj.value.slice(2));
|
||||
return null;
|
||||
},
|
||||
|
||||
|
||||
@@ -732,7 +732,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
if (!list)
|
||||
res += list = <ul/>;
|
||||
let li = <li/>;
|
||||
li.* += rec(match.content.replace(RegExp("^" + match.space, "gm"), ""), level + 1, li)
|
||||
li.* += rec(match.content.replace(RegExp("^" + match.space, "gm"), ""), level + 1, li);
|
||||
list.* += li;
|
||||
}
|
||||
else if (match.par) {
|
||||
@@ -853,51 +853,51 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
.split(" "));
|
||||
function fix(node) {
|
||||
switch(node.nodeType) {
|
||||
case Node.ELEMENT_NODE:
|
||||
if (isinstance(node, [HTMLBaseElement]))
|
||||
return;
|
||||
case Node.ELEMENT_NODE:
|
||||
if (isinstance(node, [HTMLBaseElement]))
|
||||
return;
|
||||
|
||||
data.push("<"); data.push(node.localName);
|
||||
if (node instanceof HTMLHtmlElement)
|
||||
data.push(" xmlns=" + XHTML.uri.quote());
|
||||
data.push("<"); data.push(node.localName);
|
||||
if (node instanceof HTMLHtmlElement)
|
||||
data.push(" xmlns=" + XHTML.uri.quote());
|
||||
|
||||
for (let { name, value } in array.iterValues(node.attributes)) {
|
||||
if (name == "dactyl:highlight") {
|
||||
set.add(styles, value);
|
||||
name = "class";
|
||||
value = "hl-" + value;
|
||||
}
|
||||
if (name == "href") {
|
||||
value = node.href || value;
|
||||
if (value.indexOf("dactyl://help-tag/") == 0) {
|
||||
let uri = services.io.newChannel(value, null, null).originalURI;
|
||||
value = uri.spec == value ? "javascript:;" : uri.path.substr(1);
|
||||
}
|
||||
if (!/^#|[\/](#|$)|^[a-z]+:/.test(value))
|
||||
value = value.replace(/(#|$)/, ".xhtml$1");
|
||||
}
|
||||
if (name == "src" && value.indexOf(":") > 0) {
|
||||
chromeFiles[value] = value.replace(/.*\//, "");
|
||||
value = value.replace(/.*\//, "");
|
||||
}
|
||||
data.push(" ");
|
||||
data.push(name);
|
||||
data.push('="');
|
||||
data.push(<>{value}</>.toXMLString().replace(/"/g, """));
|
||||
data.push('"');
|
||||
for (let { name, value } in array.iterValues(node.attributes)) {
|
||||
if (name == "dactyl:highlight") {
|
||||
set.add(styles, value);
|
||||
name = "class";
|
||||
value = "hl-" + value;
|
||||
}
|
||||
if (node.localName in empty)
|
||||
data.push(" />");
|
||||
else {
|
||||
data.push(">");
|
||||
if (node instanceof HTMLHeadElement)
|
||||
data.push(<link rel="stylesheet" type="text/css" href="help.css"/>.toXMLString());
|
||||
Array.map(node.childNodes, fix);
|
||||
data.push("</"); data.push(node.localName); data.push(">");
|
||||
if (name == "href") {
|
||||
value = node.href || value;
|
||||
if (value.indexOf("dactyl://help-tag/") == 0) {
|
||||
let uri = services.io.newChannel(value, null, null).originalURI;
|
||||
value = uri.spec == value ? "javascript:;" : uri.path.substr(1);
|
||||
}
|
||||
if (!/^#|[\/](#|$)|^[a-z]+:/.test(value))
|
||||
value = value.replace(/(#|$)/, ".xhtml$1");
|
||||
}
|
||||
break;
|
||||
case Node.TEXT_NODE:
|
||||
data.push(<>{node.textContent}</>.toXMLString());
|
||||
if (name == "src" && value.indexOf(":") > 0) {
|
||||
chromeFiles[value] = value.replace(/.*\//, "");
|
||||
value = value.replace(/.*\//, "");
|
||||
}
|
||||
data.push(" ");
|
||||
data.push(name);
|
||||
data.push('="');
|
||||
data.push(<>{value}</>.toXMLString().replace(/"/g, """));
|
||||
data.push('"');
|
||||
}
|
||||
if (node.localName in empty)
|
||||
data.push(" />");
|
||||
else {
|
||||
data.push(">");
|
||||
if (node instanceof HTMLHeadElement)
|
||||
data.push(<link rel="stylesheet" type="text/css" href="help.css"/>.toXMLString());
|
||||
Array.map(node.childNodes, fix);
|
||||
data.push("</"); data.push(node.localName); data.push(">");
|
||||
}
|
||||
break;
|
||||
case Node.TEXT_NODE:
|
||||
data.push(<>{node.textContent}</>.toXMLString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1811,7 +1811,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
bang: true,
|
||||
keepQuotes: true,
|
||||
serialGroup: 10,
|
||||
serialize: function () [
|
||||
serialize: function () [
|
||||
{
|
||||
command: this.name,
|
||||
literalArg: options["loadplugins"].join(" ")
|
||||
|
||||
@@ -230,11 +230,11 @@ var Editor = Module("editor", {
|
||||
* Edits the given file in the external editor as specified by the
|
||||
* 'editor' option.
|
||||
*
|
||||
* @param {object|File|string} args An object specifying the file,
|
||||
* line, and column to edit. If a non-object is specified, it is
|
||||
* treated as the file parameter of the object.
|
||||
* @param {object|File|string} args An object specifying the file, line,
|
||||
* and column to edit. If a non-object is specified, it is treated as
|
||||
* the file parameter of the object.
|
||||
* @param {boolean} blocking If true, this function does not return
|
||||
* until the editor exits.
|
||||
* until the editor exits.
|
||||
*/
|
||||
editFileExternally: function (args, blocking) {
|
||||
if (!isObject(args) || args instanceof File)
|
||||
|
||||
@@ -837,7 +837,7 @@ var Hints = Module("hints", {
|
||||
* returns true if each set of characters typed can be found, in any
|
||||
* order, in the link.
|
||||
*
|
||||
* @param {string} hintString The string typed by the user.
|
||||
* @param {string} hintString The string typed by the user.
|
||||
* @returns {function(String):boolean} A function that takes the text
|
||||
* of a hint and returns true if all the (space-delimited) sets of
|
||||
* characters typed by the user can be found in it.
|
||||
|
||||
@@ -26,13 +26,13 @@ var StatusLine = Module("statusline", {
|
||||
util.overlayWindow(window, { append: <><statusbar id="status-bar" ordinal="0"/></> });
|
||||
|
||||
highlight.loadCSS(util.compileMacro(<![CDATA[
|
||||
!AddonBar;#addon-bar {
|
||||
!AddonBar;#addon-bar {
|
||||
padding-left: 0 !important;
|
||||
min-height: 18px !important;
|
||||
-moz-appearance: none !important;
|
||||
<padding>
|
||||
}
|
||||
!AddonButton;#addon-bar xul|toolbarbutton {
|
||||
!AddonButton;#addon-bar xul|toolbarbutton {
|
||||
-moz-appearance: none !important;
|
||||
padding: 0 !important;
|
||||
border-width: 0px !important;
|
||||
@@ -149,7 +149,7 @@ var StatusLine = Module("statusline", {
|
||||
this.timeout(function () {
|
||||
this.status = message || buffer.uri;
|
||||
});
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -300,7 +300,7 @@ var StatusLine = Module("statusline", {
|
||||
*/
|
||||
progress: Modes.boundProperty({
|
||||
get: function progress() this._progress,
|
||||
set: function progress(progress) {
|
||||
set: function progress(progress) {
|
||||
this._progress = progress || "";
|
||||
|
||||
if (typeof progress == "string")
|
||||
|
||||
@@ -1398,7 +1398,7 @@ var Commands = Module("commands", {
|
||||
util.assert(args["-group"].modifiable,
|
||||
_("group.cantChangeBuiltin", _("command.commands")));
|
||||
|
||||
let completer = args["-complete"];
|
||||
let completer = args["-complete"];
|
||||
let completerFunc = null; // default to no completion for user commands
|
||||
|
||||
if (completer) {
|
||||
|
||||
@@ -1056,7 +1056,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
}</span>;
|
||||
|
||||
let tag = "<" + [namespaced(elem)].concat(
|
||||
[namespaced(a) + "=" + template.highlight(a.value, true)
|
||||
[namespaced(a) + "=" + template.highlight(a.value, true)
|
||||
for ([i, a] in array.iterItems(elem.attributes))]).join(" ");
|
||||
return tag + (!hasChildren ? "/>" : ">...</" + namespaced(elem) + ">");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user