mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 13:27:58 +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__;
|
let __iterator__ = obj.__iterator__;
|
||||||
try {
|
try {
|
||||||
if ('__iterator__' in obj) {
|
if ("__iterator__" in obj) {
|
||||||
yield '__iterator__';
|
yield "__iterator__";
|
||||||
delete obj.__iterator__;
|
delete obj.__iterator__;
|
||||||
}
|
}
|
||||||
for (let k in obj)
|
for (let k in obj)
|
||||||
@@ -55,9 +55,9 @@ function keys(obj) {
|
|||||||
catch (e) {}
|
catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('__iterator__' in obj) {
|
if ("__iterator__" in obj) {
|
||||||
var iter = obj.__iterator__;
|
var iter = obj.__iterator__;
|
||||||
yield '__iterator__';
|
yield "__iterator__";
|
||||||
// This is dangerous, but necessary.
|
// This is dangerous, but necessary.
|
||||||
delete obj.__iterator__;
|
delete obj.__iterator__;
|
||||||
}
|
}
|
||||||
@@ -87,21 +87,21 @@ function dict(ary) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function set(ary) {
|
function set(ary) {
|
||||||
var obj = {}
|
var obj = {};
|
||||||
if (ary)
|
if (ary)
|
||||||
for (var i = 0; i < ary.length; i++)
|
for (var i = 0; i < ary.length; i++)
|
||||||
obj[ary[i]] = true;
|
obj[ary[i]] = true;
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
set.add = function (set, key) { set[key] = true }
|
set.add = function (set, key) { set[key] = true; }
|
||||||
set.remove = function (set, key) { delete set[key] }
|
set.remove = function (set, key) { delete set[key]; }
|
||||||
|
|
||||||
function iter(obj) {
|
function iter(obj) {
|
||||||
if (obj instanceof Ci.nsISimpleEnumerator)
|
if (obj instanceof Ci.nsISimpleEnumerator)
|
||||||
return (function () {
|
return (function () {
|
||||||
while (obj.hasMoreElements())
|
while (obj.hasMoreElements())
|
||||||
yield obj.getNext();
|
yield obj.getNext();
|
||||||
})()
|
})();
|
||||||
if (isinstance(obj, [Ci.nsIStringEnumerator, Ci.nsIUTF8StringEnumerator]))
|
if (isinstance(obj, [Ci.nsIStringEnumerator, Ci.nsIUTF8StringEnumerator]))
|
||||||
return (function () {
|
return (function () {
|
||||||
while (obj.hasMore())
|
while (obj.hasMore())
|
||||||
@@ -111,7 +111,7 @@ function iter(obj) {
|
|||||||
return (function () {
|
return (function () {
|
||||||
try {
|
try {
|
||||||
while (true)
|
while (true)
|
||||||
yield obj.nextNode()
|
yield obj.nextNode();
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
})();
|
})();
|
||||||
@@ -120,7 +120,7 @@ function iter(obj) {
|
|||||||
if (obj instanceof NamedNodeMap)
|
if (obj instanceof NamedNodeMap)
|
||||||
return (function () {
|
return (function () {
|
||||||
for (let i = 0; i < obj.length; i++)
|
for (let i = 0; i < obj.length; i++)
|
||||||
yield [obj.name, obj]
|
yield [obj.name, obj];
|
||||||
})();
|
})();
|
||||||
return Iterator(obj);
|
return Iterator(obj);
|
||||||
}
|
}
|
||||||
@@ -240,7 +240,7 @@ function curry(fn, length, self, acc) {
|
|||||||
return fn.apply(self || this, args);
|
return fn.apply(self || this, args);
|
||||||
|
|
||||||
return curry(fn, length, self || this, args);
|
return curry(fn, length, self || this, args);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -274,10 +274,10 @@ function update(target) {
|
|||||||
if (target.__proto__ && callable(v)) {
|
if (target.__proto__ && callable(v)) {
|
||||||
v.superapply = function (self, args) {
|
v.superapply = function (self, args) {
|
||||||
return target.__proto__[k].apply(self, args);
|
return target.__proto__[k].apply(self, args);
|
||||||
}
|
};
|
||||||
v.supercall = function (self) {
|
v.supercall = function (self) {
|
||||||
return v.superapply(self, Array.slice(arguments, 1));
|
return v.superapply(self, Array.slice(arguments, 1));
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (get)
|
if (get)
|
||||||
@@ -354,7 +354,7 @@ function Class() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
var res = self.init.apply(self, arguments);
|
var res = self.init.apply(self, arguments);
|
||||||
return res !== undefined ? res : self
|
return res !== undefined ? res : self;
|
||||||
}
|
}
|
||||||
|
|
||||||
var args = Array.slice(arguments);
|
var args = Array.slice(arguments);
|
||||||
@@ -370,7 +370,7 @@ function Class() {
|
|||||||
|
|
||||||
if (!("init" in superclass.prototype)) {
|
if (!("init" in superclass.prototype)) {
|
||||||
var superc = superclass;
|
var superc = superclass;
|
||||||
superclass = function Shim() {}
|
superclass = function Shim() {};
|
||||||
extend(superclass, superc, {
|
extend(superclass, superc, {
|
||||||
init: superc
|
init: superc
|
||||||
});
|
});
|
||||||
@@ -464,7 +464,7 @@ const Struct = Class("Struct", {
|
|||||||
Struct.prototype.__defineSetter__(i, function (val) {
|
Struct.prototype.__defineSetter__(i, function (val) {
|
||||||
let value = val;
|
let value = val;
|
||||||
this.__defineGetter__(i, function () value);
|
this.__defineGetter__(i, function () value);
|
||||||
this.__defineSetter__(i, function (val) { value = val });
|
this.__defineSetter__(i, function (val) { value = val; });
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
return this.constructor = Struct;
|
return this.constructor = Struct;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ const Bookmarks = Module("bookmarks", {
|
|||||||
id = bookmarksService.getFolderIdForItem(id);
|
id = bookmarksService.getFolderIdForItem(id);
|
||||||
} while (id != bookmarksService.placesRoot && id != root);
|
} while (id != bookmarksService.placesRoot && id != root);
|
||||||
return root;
|
return root;
|
||||||
}
|
};
|
||||||
|
|
||||||
this.isBookmark = function (id) rootFolders.indexOf(self.findRoot(id)) >= 0;
|
this.isBookmark = function (id) rootFolders.indexOf(self.findRoot(id)) >= 0;
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ const Bookmarks = Module("bookmarks", {
|
|||||||
id = bookmarksService.getFolderIdForItem(id);
|
id = bookmarksService.getFolderIdForItem(id);
|
||||||
} while (id != bookmarksService.placesRoot && id != root);
|
} while (id != bookmarksService.placesRoot && id != root);
|
||||||
return rootFolders.indexOf(root) >= 0;
|
return rootFolders.indexOf(root) >= 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
// since we don't use a threaded bookmark loading (by set preload)
|
// since we don't use a threaded bookmark loading (by set preload)
|
||||||
// anymore, is this loading synchronization still needed? --mst
|
// anymore, is this loading synchronization still needed? --mst
|
||||||
|
|||||||
@@ -1653,7 +1653,7 @@ const ItemList = Class("ItemList", {
|
|||||||
|
|
||||||
// FIXME: Belongs elsewhere.
|
// FIXME: Belongs elsewhere.
|
||||||
commandline.updateOutputHeight(false);
|
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),
|
_getCompletion: function (index) this._completionElements.snapshotItem(index - this._startIndex),
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ const Command = Class("Command", {
|
|||||||
return;
|
return;
|
||||||
args.count = count;
|
args.count = count;
|
||||||
args.bang = bang;
|
args.bang = bang;
|
||||||
liberator.trapErrors(self.action, self, args, modifiers)
|
liberator.trapErrors(self.action, self, args, modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hereDoc) {
|
if (this.hereDoc) {
|
||||||
@@ -373,7 +373,7 @@ const Commands = Module("commands", {
|
|||||||
for (let [opt, val] in Iterator(args.options || {})) {
|
for (let [opt, val] in Iterator(args.options || {})) {
|
||||||
let chr = /^-.$/.test(opt) ? " " : "=";
|
let chr = /^-.$/.test(opt) ? " " : "=";
|
||||||
if (val != null)
|
if (val != null)
|
||||||
opt += chr + quote(val)
|
opt += chr + quote(val);
|
||||||
res.push(opt);
|
res.push(opt);
|
||||||
}
|
}
|
||||||
for (let [, arg] in Iterator(args.arguments || []))
|
for (let [, arg] in Iterator(args.arguments || []))
|
||||||
|
|||||||
@@ -777,17 +777,17 @@ const RangeFind = Class("RangeFind", {
|
|||||||
get backward() this.finder.findBackwards,
|
get backward() this.finder.findBackwards,
|
||||||
|
|
||||||
iter: function (word) {
|
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 {
|
try {
|
||||||
this.range = this.ranges[0];
|
this.range = this.ranges[0];
|
||||||
this.lastRange = null;
|
this.lastRange = null;
|
||||||
this.lastString = word
|
this.lastString = word;
|
||||||
var res;
|
var res;
|
||||||
while ((res = this.search(null, this.reverse, true)))
|
while ((res = this.search(null, this.reverse, true)))
|
||||||
yield res;
|
yield res;
|
||||||
}
|
}
|
||||||
finally {
|
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_)
|
if (!private_)
|
||||||
this.range.deselect();
|
this.range.deselect();
|
||||||
if (word == "")
|
if (word == "")
|
||||||
this.range.descroll()
|
this.range.descroll();
|
||||||
this.lastRange = this.startRange;
|
this.lastRange = this.startRange;
|
||||||
this.range = this.ranges.first;
|
this.range = this.ranges.first;
|
||||||
}
|
}
|
||||||
@@ -936,7 +936,7 @@ const RangeFind = Class("RangeFind", {
|
|||||||
cancel: function () {
|
cancel: function () {
|
||||||
this.purgeListeners();
|
this.purgeListeners();
|
||||||
this.range.deselect();
|
this.range.deselect();
|
||||||
this.range.descroll()
|
this.range.descroll();
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
Range: Class("RangeFind.Range", {
|
Range: Class("RangeFind.Range", {
|
||||||
|
|||||||
@@ -977,7 +977,7 @@ const Hints = Module("hints", {
|
|||||||
[0xff41, 0xff5a, "a"],
|
[0xff41, 0xff5a, "a"],
|
||||||
].map(function (a) {
|
].map(function (a) {
|
||||||
if (typeof a[2] == "string")
|
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
|
else
|
||||||
a[3] = function (chr) this[2][(chr - this[0]) % this[2].length];
|
a[3] = function (chr) this[2][(chr - this[0]) % this[2].length];
|
||||||
return a;
|
return a;
|
||||||
@@ -991,7 +991,7 @@ const Hints = Module("hints", {
|
|||||||
m = Math.floor(n / 2);
|
m = Math.floor(n / 2);
|
||||||
var t = table[i + m];
|
var t = table[i + m];
|
||||||
if (c >= t[0] && c <= t[1])
|
if (c >= t[0] && c <= t[1])
|
||||||
return t[3](c)
|
return t[3](c);
|
||||||
if (c < t[0] || m == 0)
|
if (c < t[0] || m == 0)
|
||||||
n = m;
|
n = m;
|
||||||
else {
|
else {
|
||||||
@@ -1022,7 +1022,6 @@ const Hints = Module("hints", {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
})(),
|
})(),
|
||||||
|
|
||||||
Mode: new Struct("prompt", "action", "tags")
|
Mode: new Struct("prompt", "action", "tags")
|
||||||
}, {
|
}, {
|
||||||
mappings: function () {
|
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."],
|
["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."],
|
["firstletters", "Behaves like wordstartswith, but all groups much match a sequence of words."],
|
||||||
["custom", "Delegate to a custom function: liberator.plugins.customHintMatcher(hintString)"],
|
["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 {
|
return {
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIRunnable]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIRunnable]),
|
||||||
run: function () { func.apply(self, args); }
|
run: function () { func.apply(self, args); }
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const FailedAssertion = Class("FailedAssertion", Error, {
|
const FailedAssertion = Class("FailedAssertion", Error, {
|
||||||
@@ -929,7 +929,7 @@ const Liberator = Module("liberator", {
|
|||||||
liberator.dump(obj);
|
liberator.dump(obj);
|
||||||
liberator.dump("");
|
liberator.dump("");
|
||||||
}
|
}
|
||||||
catch (e) { window.dump(e) }
|
catch (e) { window.dump(e); }
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1561,7 +1561,7 @@ const Liberator = Module("liberator", {
|
|||||||
},
|
},
|
||||||
literal: 0
|
literal: 0
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
tbcmd(["toolbars[how]", "tbs[how]"], "Show the named toolbar",
|
tbcmd(["toolbars[how]", "tbs[how]"], "Show the named toolbar",
|
||||||
function (toolbar) toolbar.collapsed = false,
|
function (toolbar) toolbar.collapsed = false,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ const ModuleBase = Class("ModuleBase", {
|
|||||||
function Module(name, prototype, classProperties, moduleInit) {
|
function Module(name, prototype, classProperties, moduleInit) {
|
||||||
var base = ModuleBase;
|
var base = ModuleBase;
|
||||||
if (callable(prototype))
|
if (callable(prototype))
|
||||||
base = Array.splice(arguments, 1, 1)[0]
|
base = Array.splice(arguments, 1, 1)[0];
|
||||||
const module = Class(name, base, prototype, classProperties);
|
const module = Class(name, base, prototype, classProperties);
|
||||||
module.INIT = moduleInit || {};
|
module.INIT = moduleInit || {};
|
||||||
module.requires = prototype.requires || [];
|
module.requires = prototype.requires || [];
|
||||||
@@ -96,7 +96,7 @@ window.addEventListener("load", function () {
|
|||||||
try {
|
try {
|
||||||
if (mod in module.INIT)
|
if (mod in module.INIT)
|
||||||
init(mod, module)();
|
init(mod, module)();
|
||||||
delete module.INIT[mod]
|
delete module.INIT[mod];
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (modules.liberator)
|
if (modules.liberator)
|
||||||
@@ -117,7 +117,7 @@ window.addEventListener("load", function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Module.list.forEach(load);
|
Module.list.forEach(load);
|
||||||
deferredInit["load"].forEach(call)
|
deferredInit["load"].forEach(call);
|
||||||
|
|
||||||
for (let module in values(Module.list))
|
for (let module in values(Module.list))
|
||||||
delete module.INIT;
|
delete module.INIT;
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ const Sanitizer = Module("sanitizer", {
|
|||||||
self.items[item.name] = {
|
self.items[item.name] = {
|
||||||
canClear: true,
|
canClear: true,
|
||||||
clear: item.action
|
clear: item.action
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// call Sanitize autocommand
|
// call Sanitize autocommand
|
||||||
@@ -201,9 +201,9 @@ const Sanitizer = Module("sanitizer", {
|
|||||||
if (item.clear) {
|
if (item.clear) {
|
||||||
let func = item.clear;
|
let func = item.clear;
|
||||||
item.clear = function () {
|
item.clear = function () {
|
||||||
autocommands.trigger("Sanitize", { name: arg })
|
autocommands.trigger("Sanitize", { name: arg });
|
||||||
func.call(item);
|
func.call(item);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ const Sanitizer = Module("sanitizer", {
|
|||||||
["offlineapps", "Offline website data"],
|
["offlineapps", "Offline website data"],
|
||||||
["passwords", "Saved passwords"],
|
["passwords", "Saved passwords"],
|
||||||
["sessions", "Authenticated sessions"],
|
["sessions", "Authenticated sessions"],
|
||||||
["sitesettings", "Site preferences"],
|
["sitesettings", "Site preferences"]
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -686,7 +686,7 @@ Module("styles", {
|
|||||||
context.compare = CompletionContext.Sort.number;
|
context.compare = CompletionContext.Sort.number;
|
||||||
return [[i, <>{sheet.sites.join(",")}: {sheet.css.replace("\n", "\\n")}</>]
|
return [[i, <>{sheet.sites.join(",")}: {sheet.css.replace("\n", "\\n")}</>]
|
||||||
for ([i, sheet] in styles.userSheets)
|
for ([i, sheet] in styles.userSheets)
|
||||||
if (!cmd.filter || cmd.filter(sheet))]
|
if (!cmd.filter || cmd.filter(sheet))];
|
||||||
}],
|
}],
|
||||||
[["-name", "-n"], commands.OPTION_STRING, null,
|
[["-name", "-n"], commands.OPTION_STRING, null,
|
||||||
function () [[name, sheet.css]
|
function () [[name, sheet.css]
|
||||||
|
|||||||
Reference in New Issue
Block a user