mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 00:17:57 +01:00
Clean up some old-style iterator gunk.
This commit is contained in:
@@ -275,11 +275,11 @@ var AutoCommands = Module("autocommands", {
|
|||||||
},
|
},
|
||||||
completion: function initCompletion() {
|
completion: function initCompletion() {
|
||||||
completion.autocmdEvent = function autocmdEvent(context) {
|
completion.autocmdEvent = function autocmdEvent(context) {
|
||||||
context.completions = Iterator(config.autocommands);
|
context.completions = iter(config.autocommands);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
javascript: function initJavascript() {
|
javascript: function initJavascript() {
|
||||||
JavaScript.setCompleter(AutoCmdHive.prototype.get, [() => Iterator(config.autocommands)]);
|
JavaScript.setCompleter(AutoCmdHive.prototype.get, [() => iter(config.autocommands)]);
|
||||||
},
|
},
|
||||||
options: function initOptions() {
|
options: function initOptions() {
|
||||||
options.add(["eventignore", "ei"],
|
options.add(["eventignore", "ei"],
|
||||||
|
|||||||
@@ -1339,8 +1339,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
opts: update({
|
opts: update({
|
||||||
s: ["Status bar", [statusline.statusBar.id]]
|
s: ["Status bar", [statusline.statusBar.id]]
|
||||||
}, config.guioptions),
|
}, config.guioptions),
|
||||||
|
|
||||||
setter: function (opts) {
|
setter: function (opts) {
|
||||||
for (let [opt, [, ids]] in Iterator(this.opts)) {
|
for (let [opt, [, ids]] of iter(this.opts)) {
|
||||||
ids.map(id => document.getElementById(id))
|
ids.map(id => document.getElementById(id))
|
||||||
.forEach(function (elem) {
|
.forEach(function (elem) {
|
||||||
if (elem)
|
if (elem)
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ var Marks = Module("marks", {
|
|||||||
|
|
||||||
_onPageLoad: function _onPageLoad(event) {
|
_onPageLoad: function _onPageLoad(event) {
|
||||||
let win = event.originalTarget.defaultView;
|
let win = event.originalTarget.defaultView;
|
||||||
for (let [i, mark] in Iterator(this._pendingJumps)) {
|
for (let [i, mark] of this._pendingJumps.entries()) {
|
||||||
if (win && win.location.href == mark.location) {
|
if (win && win.location.href == mark.location) {
|
||||||
this._scrollTo(mark);
|
this._scrollTo(mark);
|
||||||
this._pendingJumps.splice(i, 1);
|
this._pendingJumps.splice(i, 1);
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ var QuickMarks = Module("quickmarks", {
|
|||||||
completion: function initCompletion() {
|
completion: function initCompletion() {
|
||||||
completion.quickmark = function (context) {
|
completion.quickmark = function (context) {
|
||||||
context.title = ["QuickMark", "URL"];
|
context.title = ["QuickMark", "URL"];
|
||||||
context.generate = () => Iterator(quickmarks._qmarks);
|
context.generate = () => iter(quickmarks._qmarks);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mappings: function initMappings() {
|
mappings: function initMappings() {
|
||||||
|
|||||||
@@ -999,7 +999,7 @@ var Tabs = Module("tabs", {
|
|||||||
context.keys = { text: function ([i, { state: s }]) (i + 1) + ": " + s.entries[s.index - 1].url,
|
context.keys = { text: function ([i, { state: s }]) (i + 1) + ": " + s.entries[s.index - 1].url,
|
||||||
description: "[1].title",
|
description: "[1].title",
|
||||||
icon: "[1].image" };
|
icon: "[1].image" };
|
||||||
context.completions = Iterator(tabs.closedTabs);
|
context.completions = tabs.closedTabs.entries();
|
||||||
},
|
},
|
||||||
count: true,
|
count: true,
|
||||||
literal: 0,
|
literal: 0,
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ var Buffer = Module("Buffer", {
|
|||||||
/**
|
/**
|
||||||
* @property {nsIURI} The current top-level document's URI.
|
* @property {nsIURI} The current top-level document's URI.
|
||||||
*/
|
*/
|
||||||
get uri() util.newURI(this.win.location.href),
|
get uri() util.newURI(this.win.location.href),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {nsIURI} The current top-level document's URI, sans
|
* @property {nsIURI} The current top-level document's URI, sans
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
|
|||||||
if (this.queue.length && !this.inQueue) {
|
if (this.queue.length && !this.inQueue) {
|
||||||
// removeEntry does not work properly with queues.
|
// removeEntry does not work properly with queues.
|
||||||
let removed = 0;
|
let removed = 0;
|
||||||
for (let [, entry] of this.queue)
|
for (let entry of this.queue)
|
||||||
if (this.getCacheWriter().hasEntry(entry)) {
|
if (this.getCacheWriter().hasEntry(entry)) {
|
||||||
this.getCacheWriter().removeEntry(entry, false);
|
this.getCacheWriter().removeEntry(entry, false);
|
||||||
removed++;
|
removed++;
|
||||||
|
|||||||
@@ -588,7 +588,7 @@ var RangeFind = Class("RangeFind", {
|
|||||||
|
|
||||||
let anonNodes = doc.getAnonymousNodes(doc.documentElement);
|
let anonNodes = doc.getAnonymousNodes(doc.documentElement);
|
||||||
if (anonNodes) {
|
if (anonNodes) {
|
||||||
for (let [, elem] of iter(anonNodes)) {
|
for (let elem of anonNodes) {
|
||||||
let range = RangeFind.nodeContents(elem);
|
let range = RangeFind.nodeContents(elem);
|
||||||
pushRange(RangeFind.endpoint(range, true), RangeFind.endpoint(range, false));
|
pushRange(RangeFind.endpoint(range, true), RangeFind.endpoint(range, false));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -449,9 +449,9 @@ var Highlights = Module("Highlight", {
|
|||||||
},
|
},
|
||||||
javascript: function initJavascript(dactyl, modules, window) {
|
javascript: function initJavascript(dactyl, modules, window) {
|
||||||
modules.JavaScript.setCompleter(["get", "set"].map(m => highlight[m]),
|
modules.JavaScript.setCompleter(["get", "set"].map(m => highlight[m]),
|
||||||
[ (context, obj, args) => Iterator(highlight.highlight) ]);
|
[ (context, obj, args) => iter(highlight.highlight) ]);
|
||||||
modules.JavaScript.setCompleter(["highlightNode"].map(m => highlight[m]),
|
modules.JavaScript.setCompleter(["highlightNode"].map(m => highlight[m]),
|
||||||
[ null, (context, obj, args) => Iterator(highlight.highlight) ]);
|
[ null, (context, obj, args) => iter(highlight.highlight) ]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ var IO = Module("io", {
|
|||||||
|
|
||||||
outer:
|
outer:
|
||||||
for (let dir of values(dirs)) {
|
for (let dir of values(dirs)) {
|
||||||
for (let [, path] of iter(paths)) {
|
for (let path of paths) {
|
||||||
let file = dir.child(path);
|
let file = dir.child(path);
|
||||||
|
|
||||||
dactyl.echomsg(_("io.searchingFor", JSON.stringify(file.path)), 3);
|
dactyl.echomsg(_("io.searchingFor", JSON.stringify(file.path)), 3);
|
||||||
|
|||||||
@@ -167,20 +167,23 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
|
|||||||
if (!item.builtin && (!persistent || item.persistent) && item.name !== "all")
|
if (!item.builtin && (!persistent || item.persistent) && item.name !== "all")
|
||||||
];
|
];
|
||||||
|
|
||||||
function prefOverlay(branch, persistent, local) update(Object.create(local), {
|
function prefOverlay(branch, persistent, local) {
|
||||||
before: [
|
return update(Object.create(local),
|
||||||
["preferences", { id: branch.substr(Item.PREFIX.length) + "history",
|
{
|
||||||
xmlns: "xul" },
|
before: [
|
||||||
template.map(ourItems(persistent), item =>
|
["preferences", { id: branch.substr(Item.PREFIX.length) + "history",
|
||||||
["preference", { type: "bool", id: branch + item.name, name: branch + item.name }])]
|
xmlns: "xul" },
|
||||||
],
|
template.map(ourItems(persistent), item =>
|
||||||
init: function init(win) {
|
["preference", { type: "bool", id: branch + item.name, name: branch + item.name }])]
|
||||||
let pane = win.document.getElementById("SanitizeDialogPane");
|
],
|
||||||
for (let [, pref] of iter(pane.preferences))
|
init: function init(win) {
|
||||||
pref.updateElements();
|
let pane = win.document.getElementById("SanitizeDialogPane");
|
||||||
init.superapply(this, arguments);
|
for (let pref of pane.preferences)
|
||||||
}
|
pref.updateElements();
|
||||||
});
|
init.superapply(this, arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
util.timeout(function () { // Load order issue...
|
util.timeout(function () { // Load order issue...
|
||||||
|
|
||||||
|
|||||||
@@ -510,7 +510,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
|||||||
if (acc.length == patterns.length)
|
if (acc.length == patterns.length)
|
||||||
res.push(array(substrings).zip(acc).flatten().join(""));
|
res.push(array(substrings).zip(acc).flatten().join(""));
|
||||||
else
|
else
|
||||||
for (let [, pattern] of Iterator(patterns[acc.length]))
|
for (let pattern of patterns[acc.length])
|
||||||
rec(acc.concat(pattern));
|
rec(acc.concat(pattern));
|
||||||
};
|
};
|
||||||
rec([]);
|
rec([]);
|
||||||
|
|||||||
Reference in New Issue
Block a user