1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 10:57:59 +01:00

Formatting fixes.

This commit is contained in:
Doug Kearns
2009-11-14 21:57:32 +11:00
parent 607e65bf6f
commit 6cc43ad29a
11 changed files with 48 additions and 49 deletions

0
common/content/autocommands.js Executable file → Normal file
View File

View File

@@ -30,8 +30,8 @@ function allkeys(obj) {
let __iterator__ = obj.__iterator__;
try {
if ('__iterator__' in obj) {
yield '__iterator__';
if ("__iterator__" in obj) {
yield "__iterator__";
delete obj.__iterator__;
}
for (let k in obj)
@@ -55,9 +55,9 @@ function keys(obj) {
catch (e) {}
}
if ('__iterator__' in obj) {
if ("__iterator__" in obj) {
var iter = obj.__iterator__;
yield '__iterator__';
yield "__iterator__";
// This is dangerous, but necessary.
delete obj.__iterator__;
}
@@ -87,21 +87,21 @@ function dict(ary) {
}
function set(ary) {
var obj = {}
var obj = {};
if (ary)
for (var i = 0; i < ary.length; i++)
obj[ary[i]] = true;
return obj;
}
set.add = function (set, key) { set[key] = true }
set.remove = function (set, key) { delete set[key] }
set.add = function (set, key) { set[key] = true; }
set.remove = function (set, key) { delete set[key]; }
function iter(obj) {
if (obj instanceof Ci.nsISimpleEnumerator)
return (function () {
while (obj.hasMoreElements())
yield obj.getNext();
})()
})();
if (isinstance(obj, [Ci.nsIStringEnumerator, Ci.nsIUTF8StringEnumerator]))
return (function () {
while (obj.hasMore())
@@ -111,7 +111,7 @@ function iter(obj) {
return (function () {
try {
while (true)
yield obj.nextNode()
yield obj.nextNode();
}
catch (e) {}
})();
@@ -120,7 +120,7 @@ function iter(obj) {
if (obj instanceof NamedNodeMap)
return (function () {
for (let i = 0; i < obj.length; i++)
yield [obj.name, obj]
yield [obj.name, obj];
})();
return Iterator(obj);
}
@@ -240,7 +240,7 @@ function curry(fn, length, self, acc) {
return fn.apply(self || this, args);
return curry(fn, length, self || this, args);
}
};
}
/**
@@ -274,10 +274,10 @@ function update(target) {
if (target.__proto__ && callable(v)) {
v.superapply = function (self, args) {
return target.__proto__[k].apply(self, args);
}
};
v.supercall = function (self) {
return v.superapply(self, Array.slice(arguments, 1));
}
};
}
}
if (get)
@@ -354,7 +354,7 @@ function Class() {
}
};
var res = self.init.apply(self, arguments);
return res !== undefined ? res : self
return res !== undefined ? res : self;
}
var args = Array.slice(arguments);
@@ -370,7 +370,7 @@ function Class() {
if (!("init" in superclass.prototype)) {
var superc = superclass;
superclass = function Shim() {}
superclass = function Shim() {};
extend(superclass, superc, {
init: superc
});
@@ -464,7 +464,7 @@ const Struct = Class("Struct", {
Struct.prototype.__defineSetter__(i, function (val) {
let value = val;
this.__defineGetter__(i, function () value);
this.__defineSetter__(i, function (val) { value = val });
this.__defineSetter__(i, function (val) { value = val; });
});
};
return this.constructor = Struct;

View File

@@ -91,7 +91,7 @@ const Bookmarks = Module("bookmarks", {
id = bookmarksService.getFolderIdForItem(id);
} while (id != bookmarksService.placesRoot && id != root);
return root;
}
};
this.isBookmark = function (id) rootFolders.indexOf(self.findRoot(id)) >= 0;
@@ -103,7 +103,7 @@ const Bookmarks = Module("bookmarks", {
id = bookmarksService.getFolderIdForItem(id);
} while (id != bookmarksService.placesRoot && id != root);
return rootFolders.indexOf(root) >= 0;
}
};
// since we don't use a threaded bookmark loading (by set preload)
// anymore, is this loading synchronization still needed? --mst

View File

@@ -1653,7 +1653,7 @@ const ItemList = Class("ItemList", {
// FIXME: Belongs elsewhere.
commandline.updateOutputHeight(false);
this.setTimeout(function () { this._container.height -= commandline.getSpaceNeeded() }, 0);
this.setTimeout(function () { this._container.height -= commandline.getSpaceNeeded(); }, 0);
},
_getCompletion: function (index) this._completionElements.snapshotItem(index - this._startIndex),

View File

@@ -153,7 +153,7 @@ const Command = Class("Command", {
return;
args.count = count;
args.bang = bang;
liberator.trapErrors(self.action, self, args, modifiers)
liberator.trapErrors(self.action, self, args, modifiers);
}
if (this.hereDoc) {
@@ -373,7 +373,7 @@ const Commands = Module("commands", {
for (let [opt, val] in Iterator(args.options || {})) {
let chr = /^-.$/.test(opt) ? " " : "=";
if (val != null)
opt += chr + quote(val)
opt += chr + quote(val);
res.push(opt);
}
for (let [, arg] in Iterator(args.arguments || []))

View File

@@ -777,17 +777,17 @@ const RangeFind = Class("RangeFind", {
get backward() this.finder.findBackwards,
iter: function (word) {
let saved = ["range", "lastRange", "lastString"].map(this.closure(function (s) [s, this[s]]))
let saved = ["range", "lastRange", "lastString"].map(this.closure(function (s) [s, this[s]]));
try {
this.range = this.ranges[0];
this.lastRange = null;
this.lastString = word
this.lastString = word;
var res;
while ((res = this.search(null, this.reverse, true)))
yield res;
}
finally {
saved.forEach(function ([k, v]) this[k] = v, this)
saved.forEach(function ([k, v]) this[k] = v, this);
}
},
@@ -804,7 +804,7 @@ const RangeFind = Class("RangeFind", {
if (!private_)
this.range.deselect();
if (word == "")
this.range.descroll()
this.range.descroll();
this.lastRange = this.startRange;
this.range = this.ranges.first;
}
@@ -936,7 +936,7 @@ const RangeFind = Class("RangeFind", {
cancel: function () {
this.purgeListeners();
this.range.deselect();
this.range.descroll()
this.range.descroll();
}
}, {
Range: Class("RangeFind.Range", {

View File

@@ -977,7 +977,7 @@ const Hints = Module("hints", {
[0xff41, 0xff5a, "a"],
].map(function (a) {
if (typeof a[2] == "string")
a[3] = function (chr) String.fromCharCode(this[2].charCodeAt(0) + chr - this[0])
a[3] = function (chr) String.fromCharCode(this[2].charCodeAt(0) + chr - this[0]);
else
a[3] = function (chr) this[2][(chr - this[0]) % this[2].length];
return a;
@@ -991,7 +991,7 @@ const Hints = Module("hints", {
m = Math.floor(n / 2);
var t = table[i + m];
if (c >= t[0] && c <= t[1])
return t[3](c)
return t[3](c);
if (c < t[0] || m == 0)
n = m;
else {
@@ -1022,7 +1022,6 @@ const Hints = Module("hints", {
return -1;
}
})(),
Mode: new Struct("prompt", "action", "tags")
}, {
mappings: function () {
@@ -1113,7 +1112,7 @@ const Hints = Module("hints", {
["wordstartswith", "The typed characters are split on whitespace. The resulting groups must all match the beginings of words, in order."],
["firstletters", "Behaves like wordstartswith, but all groups much match a sequence of words."],
["custom", "Delegate to a custom function: liberator.plugins.customHintMatcher(hintString)"],
["transliterated", "When true, special latin characters are translated to their ascii equivalent (e.g., \u00e9 -> e)"],
["transliterated", "When true, special latin characters are translated to their ascii equivalent (e.g., \u00e9 -> e)"]
]
});

View File

@@ -40,7 +40,7 @@ function Runnable(self, func, args) {
return {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIRunnable]),
run: function () { func.apply(self, args); }
}
};
}
const FailedAssertion = Class("FailedAssertion", Error, {
@@ -929,7 +929,7 @@ const Liberator = Module("liberator", {
liberator.dump(obj);
liberator.dump("");
}
catch (e) { window.dump(e) }
catch (e) { window.dump(e); }
},
/**
@@ -1561,7 +1561,7 @@ const Liberator = Module("liberator", {
},
literal: 0
});
}
};
tbcmd(["toolbars[how]", "tbs[how]"], "Show the named toolbar",
function (toolbar) toolbar.collapsed = false,

View File

@@ -55,7 +55,7 @@ const ModuleBase = Class("ModuleBase", {
function Module(name, prototype, classProperties, moduleInit) {
var base = ModuleBase;
if (callable(prototype))
base = Array.splice(arguments, 1, 1)[0]
base = Array.splice(arguments, 1, 1)[0];
const module = Class(name, base, prototype, classProperties);
module.INIT = moduleInit || {};
module.requires = prototype.requires || [];
@@ -96,7 +96,7 @@ window.addEventListener("load", function () {
try {
if (mod in module.INIT)
init(mod, module)();
delete module.INIT[mod]
delete module.INIT[mod];
}
catch (e) {
if (modules.liberator)
@@ -117,7 +117,7 @@ window.addEventListener("load", function () {
}
}
Module.list.forEach(load);
deferredInit["load"].forEach(call)
deferredInit["load"].forEach(call);
for (let module in values(Module.list))
delete module.INIT;

View File

@@ -191,7 +191,7 @@ const Sanitizer = Module("sanitizer", {
self.items[item.name] = {
canClear: true,
clear: item.action
}
};
});
// call Sanitize autocommand
@@ -201,9 +201,9 @@ const Sanitizer = Module("sanitizer", {
if (item.clear) {
let func = item.clear;
item.clear = function () {
autocommands.trigger("Sanitize", { name: arg })
autocommands.trigger("Sanitize", { name: arg });
func.call(item);
}
};
}
}
@@ -239,7 +239,7 @@ const Sanitizer = Module("sanitizer", {
["offlineapps", "Offline website data"],
["passwords", "Saved passwords"],
["sessions", "Authenticated sessions"],
["sitesettings", "Site preferences"],
["sitesettings", "Site preferences"]
]
});

View File

@@ -686,7 +686,7 @@ Module("styles", {
context.compare = CompletionContext.Sort.number;
return [[i, <>{sheet.sites.join(",")}: {sheet.css.replace("\n", "\\n")}</>]
for ([i, sheet] in styles.userSheets)
if (!cmd.filter || cmd.filter(sheet))]
if (!cmd.filter || cmd.filter(sheet))];
}],
[["-name", "-n"], commands.OPTION_STRING, null,
function () [[name, sheet.css]