mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 15:48:00 +01:00
Formatting fixes.
This commit is contained in:
0
common/content/autocommands.js
Executable file → Normal file
0
common/content/autocommands.js
Executable file → Normal 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__;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ function foreach(iter, fn, self) {
|
||||
|
||||
function dict(ary) {
|
||||
var obj = {};
|
||||
for (var i=0; i < ary.length; i++) {
|
||||
for (var i = 0; i < ary.length; i++) {
|
||||
var val = ary[i];
|
||||
obj[val[0]] = val[1];
|
||||
}
|
||||
@@ -87,21 +87,21 @@ function dict(ary) {
|
||||
}
|
||||
|
||||
function set(ary) {
|
||||
var obj = {}
|
||||
var obj = {};
|
||||
if (ary)
|
||||
for (var i=0; i < ary.length; i++)
|
||||
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) {}
|
||||
})();
|
||||
@@ -119,8 +119,8 @@ function iter(obj) {
|
||||
return util.Array.iteritems(obj);
|
||||
if (obj instanceof NamedNodeMap)
|
||||
return (function () {
|
||||
for (let i=0; i < obj.length; i++)
|
||||
yield [obj.name, obj]
|
||||
for (let i = 0; i < obj.length; i++)
|
||||
yield [obj.name, obj];
|
||||
})();
|
||||
return Iterator(obj);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ function isinstance(targ, src) {
|
||||
number: Number
|
||||
}
|
||||
src = Array.concat(src);
|
||||
for (var i=0; i < src.length; i++) {
|
||||
for (var i = 0; i < src.length; i++) {
|
||||
if (targ instanceof src[i])
|
||||
return true;
|
||||
var type = types[typeof targ];
|
||||
@@ -240,7 +240,7 @@ function curry(fn, length, self, acc) {
|
||||
return fn.apply(self || this, args);
|
||||
|
||||
return curry(fn, length, self || this, args);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -263,7 +263,7 @@ function curry(fn, length, self, acc) {
|
||||
* @returns {Object} Returns its updated first argument.
|
||||
*/
|
||||
function update(target) {
|
||||
for (let i=1; i < arguments.length; i++) {
|
||||
for (let i = 1; i < arguments.length; i++) {
|
||||
let src = arguments[i];
|
||||
foreach(keys(src || {}), function (k) {
|
||||
var get = src.__lookupGetter__(k),
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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 || []))
|
||||
|
||||
@@ -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", {
|
||||
|
||||
@@ -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 {
|
||||
@@ -1007,11 +1007,11 @@ const Hints = Module("hints", {
|
||||
if (src.length == 0)
|
||||
return 0;
|
||||
outer:
|
||||
for (var i=0; i < end; i++) {
|
||||
for (var i = 0; i < end; i++) {
|
||||
var j = i;
|
||||
for (var k=0; k < src.length;) {
|
||||
for (var k = 0; k < src.length;) {
|
||||
var s = translate(dest[j++]);
|
||||
for (var l=0; l < s.length; l++, k++) {
|
||||
for (var l = 0; l < s.length; l++, k++) {
|
||||
if (s[l] != src[k])
|
||||
continue outer;
|
||||
if (k == src.length - 1)
|
||||
@@ -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)"]
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"]
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user