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

Clean up some old-style iterator gunk.

This commit is contained in:
Kris Maglione
2015-02-25 10:48:10 -08:00
parent d1937f708c
commit a8b1b278e2
12 changed files with 31 additions and 27 deletions

View File

@@ -275,11 +275,11 @@ var AutoCommands = Module("autocommands", {
},
completion: function initCompletion() {
completion.autocmdEvent = function autocmdEvent(context) {
context.completions = Iterator(config.autocommands);
context.completions = iter(config.autocommands);
};
},
javascript: function initJavascript() {
JavaScript.setCompleter(AutoCmdHive.prototype.get, [() => Iterator(config.autocommands)]);
JavaScript.setCompleter(AutoCmdHive.prototype.get, [() => iter(config.autocommands)]);
},
options: function initOptions() {
options.add(["eventignore", "ei"],

View File

@@ -1339,8 +1339,9 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
opts: update({
s: ["Status bar", [statusline.statusBar.id]]
}, config.guioptions),
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))
.forEach(function (elem) {
if (elem)

View File

@@ -278,7 +278,7 @@ var Marks = Module("marks", {
_onPageLoad: function _onPageLoad(event) {
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) {
this._scrollTo(mark);
this._pendingJumps.splice(i, 1);

View File

@@ -178,7 +178,7 @@ var QuickMarks = Module("quickmarks", {
completion: function initCompletion() {
completion.quickmark = function (context) {
context.title = ["QuickMark", "URL"];
context.generate = () => Iterator(quickmarks._qmarks);
context.generate = () => iter(quickmarks._qmarks);
};
},
mappings: function initMappings() {

View File

@@ -999,7 +999,7 @@ var Tabs = Module("tabs", {
context.keys = { text: function ([i, { state: s }]) (i + 1) + ": " + s.entries[s.index - 1].url,
description: "[1].title",
icon: "[1].image" };
context.completions = Iterator(tabs.closedTabs);
context.completions = tabs.closedTabs.entries();
},
count: true,
literal: 0,

View File

@@ -267,7 +267,7 @@ var Cache = Module("Cache", XPCOM(Ci.nsIRequestObserver), {
if (this.queue.length && !this.inQueue) {
// removeEntry does not work properly with queues.
let removed = 0;
for (let [, entry] of this.queue)
for (let entry of this.queue)
if (this.getCacheWriter().hasEntry(entry)) {
this.getCacheWriter().removeEntry(entry, false);
removed++;

View File

@@ -588,7 +588,7 @@ var RangeFind = Class("RangeFind", {
let anonNodes = doc.getAnonymousNodes(doc.documentElement);
if (anonNodes) {
for (let [, elem] of iter(anonNodes)) {
for (let elem of anonNodes) {
let range = RangeFind.nodeContents(elem);
pushRange(RangeFind.endpoint(range, true), RangeFind.endpoint(range, false));
}

View File

@@ -449,9 +449,9 @@ var Highlights = Module("Highlight", {
},
javascript: function initJavascript(dactyl, modules, window) {
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]),
[ null, (context, obj, args) => Iterator(highlight.highlight) ]);
[ null, (context, obj, args) => iter(highlight.highlight) ]);
}
});

View File

@@ -98,7 +98,7 @@ var IO = Module("io", {
outer:
for (let dir of values(dirs)) {
for (let [, path] of iter(paths)) {
for (let path of paths) {
let file = dir.child(path);
dactyl.echomsg(_("io.searchingFor", JSON.stringify(file.path)), 3);

View File

@@ -167,7 +167,9 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
if (!item.builtin && (!persistent || item.persistent) && item.name !== "all")
];
function prefOverlay(branch, persistent, local) update(Object.create(local), {
function prefOverlay(branch, persistent, local) {
return update(Object.create(local),
{
before: [
["preferences", { id: branch.substr(Item.PREFIX.length) + "history",
xmlns: "xul" },
@@ -176,11 +178,12 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
],
init: function init(win) {
let pane = win.document.getElementById("SanitizeDialogPane");
for (let [, pref] of iter(pane.preferences))
for (let pref of pane.preferences)
pref.updateElements();
init.superapply(this, arguments);
}
});
}
util.timeout(function () { // Load order issue...

View File

@@ -510,7 +510,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
if (acc.length == patterns.length)
res.push(array(substrings).zip(acc).flatten().join(""));
else
for (let [, pattern] of Iterator(patterns[acc.length]))
for (let pattern of patterns[acc.length])
rec(acc.concat(pattern));
};
rec([]);