diff --git a/components/keysnail-loader.js b/components/keysnail-loader.js index 6a85057..1bde0fa 100644 --- a/components/keysnail-loader.js +++ b/components/keysnail-loader.js @@ -113,7 +113,7 @@ KeySnailLoader.prototype = { let context = win.KeySnail.modules; - for (let [, module] in Iterator(modules)) + for (let module of modules) loadModule(module, context); }, @@ -122,7 +122,7 @@ KeySnailLoader.prototype = { "password1Container", "password2Container"]; - for (let [, id] in Iterator(ids)) + for (let id of ids) { let elem = aDocument.getElementById(id); if (elem && !elem.hidden) diff --git a/content/keysnail.js b/content/keysnail.js index 76ea8d7..d43ab20 100644 --- a/content/keysnail.js +++ b/content/keysnail.js @@ -101,7 +101,7 @@ _ = modules._; } catch (x) {} - for (let [, name] in Iterator(moduleObjects)) + for (let name of moduleObjects) this.initModule(name); // set modules diff --git a/content/modules/ext.js b/content/modules/ext.js index 46198a5..07a7c3c 100755 --- a/content/modules/ext.js +++ b/content/modules/ext.js @@ -25,7 +25,7 @@ var ext = function () { } keyList = keyList.sort(); - for (let [, name] in Iterator(keyList)) + for (let name of keyList) extList.push([name, exts[name].description || ""]); return extList; diff --git a/content/modules/hook.js b/content/modules/hook.js index 6565c6c..9b45e0c 100755 --- a/content/modules/hook.js +++ b/content/modules/hook.js @@ -54,7 +54,7 @@ var hook = { if (!hook) return; - for (let [i, action] in Iterator(hook)) { + for (let [i, action] of util.keyValues(hook)) { try { action(arg); } catch (x) { diff --git a/content/modules/key.js b/content/modules/key.js index 84c4682..c4474f3 100755 --- a/content/modules/key.js +++ b/content/modules/key.js @@ -371,8 +371,8 @@ var key = { this.passAllKeys = true; - for (let [, keyStr] in Iterator(aKeys)) { - for (let [, type] in Iterator(aType)) { + for (let keyStr of aKeys) { + for (let type of aType) { util.message("feed " + keyStr); let event = this.stringToKeyEvent(keyStr, true, type, true); // event.ksNoHandle becomes undefined while propagating @@ -1049,7 +1049,7 @@ var key = { var aTarget = this.keyMapHolder[aTargetKeyMapName]; var aDestination = this.keyMapHolder[aDestinationKeyMapName]; - for (let [property, value] in Iterator(aTarget)) + for (let [property, value] of util.keyValues(aTarget)) aDestination[property] = value; }, @@ -1104,7 +1104,7 @@ var key = { if (!(aKeyMapName instanceof Array)) aKeyMapName = [aKeyMapName]; - for (let [, keyMapName] in Iterator(aKeyMapName)) + for (let keyMapName of aKeyMapName) { var addTo = this.keyMapHolder[keyMapName]; @@ -1348,7 +1348,7 @@ var key = { if (!aKeySequence) aKeySequence = []; - for (let [keyStr, cont] in Iterator(aKeyMap)) + for (let [keyStr, cont] of util.keyValues(aKeyMap)) { switch (typeof cont) { diff --git a/content/modules/macro.js b/content/modules/macro.js index 9fd0575..779cd25 100755 --- a/content/modules/macro.js +++ b/content/modules/macro.js @@ -34,7 +34,7 @@ var macro = { var len = aEvents.length; var sleepTime = this.sleepTime; - for (let [, event] in Iterator(aEvents)) + for (let event of aEvents) { if (event.keyCode === KeyEvent.DOM_VK_TAB) { diff --git a/content/modules/plugins.js b/content/modules/plugins.js index 14aea24..dffb90d 100644 --- a/content/modules/plugins.js +++ b/content/modules/plugins.js @@ -17,7 +17,7 @@ var plugins = { setupOptions: function (prefix, defaults, pluginInfo) { let options = {}; - for (let [name, { preset, description, type, hidden }] in Iterator(defaults)) { + for (let [name, { preset, description, type, hidden }] of util.keyValues(defaults)) { let fullName = prefix + "." + name; // XXX: bind values @@ -107,7 +107,7 @@ var plugins = { getInstalledPlugins: function () { let pluginList = {}; - for (let [pluginPath, pluginContext] in Iterator(plugins.context)) { + for (let [pluginPath, pluginContext] of util.keyValues(plugins.context)) { let isDisabled = userscript.isDisabledPlugin(pluginPath); let isNotCompatible = pluginContext.__ksNotCompatible__; diff --git a/content/modules/prompt.js b/content/modules/prompt.js index 416b3cb..354c378 100755 --- a/content/modules/prompt.js +++ b/content/modules/prompt.js @@ -164,19 +164,19 @@ var prompt = function () { function $E(aName, aAttributes) { let elem = document.createElement(aName); - for (let [k, v] in Iterator(aAttributes)) + for (let [k, v] of util.keyValues(aAttributes)) elem.setAttribute(k, v); return elem; } function implant(a, b) { - for (let [k, v] in Iterator(b)) + for (let [k, v] of util.keyValues(b)) a[k] = v; } function implantAll(a, b) { - for (let k in util.getAllPropertyNames(b)) { + for (let k of util.getAllPropertyNames(b)) { try { a[k] = b[k]; } catch (_) {} @@ -193,10 +193,10 @@ var prompt = function () { var newObject = {}; var key; - for (let [key, value] in Iterator(a)) + for (let [key, value] of util.keyValues(a)) newObject[key] = value; - for (let [key, value] in Iterator(b)) + for (let [key, value] of util.keyValues(b)) newObject[key] = value; return newObject; @@ -210,7 +210,7 @@ var prompt = function () { function getActualCols(aCols) { if (gFlags) - for (let [, flag] in Iterator(gFlags)) + for (let flag of gFlags) if (flag & (HIDDEN | ICON)) aCols--; return aCols; } @@ -259,7 +259,7 @@ var prompt = function () { function setColumns(aColumn) { if (gFlags) { - for (let [, flag] in Iterator(gFlags)) + for (let flag of gFlags) { if (flag & (HIDDEN | ICON)) aColumn--; @@ -726,7 +726,7 @@ var prompt = function () { var found = {}; var uniqStr = ""; - for (let [, c] in Iterator(str)) + for (let c of str) { if (found[c]) continue; @@ -749,7 +749,7 @@ var prompt = function () { var continuousMode = false; - for (let [, opt] in Iterator(uniq(opts))) + for (let opt of uniq(opts)) { switch (opt) { @@ -1016,7 +1016,7 @@ var prompt = function () { if (typeof aActions === "function") aActions = [[aActions, "Default callback"]]; - for (let [i, action] in Iterator(aActions)) + for (let [i, action] of util.keyValues(aActions)) { var item = document.createElement("menuitem"); item.setAttribute("label", action[1]); @@ -1047,7 +1047,7 @@ var prompt = function () { ); function stick(keymap) { - for (let [k, a] in Iterator(keymap)) + for (let [k, a] of util.keyValues(keymap)) { let act = a.split(",")[0]; let desc = actionDescriptionMap[act] || ""; @@ -1091,7 +1091,7 @@ var prompt = function () { var list = []; // create action list and local command - for (let [i, action] in Iterator(aActions)) + for (let [i, action] of util.keyValues(aActions)) { let index = i + 1; list.push([action[0], index.toString() + ". " + action[1]]); @@ -1456,7 +1456,7 @@ var prompt = function () { let buffer = []; let escapeIt = false; - for (let [, c] in Iterator(str)) + for (let c of str) { if (!escapeIt && c === escapeChar) escapeIt = true; @@ -1734,7 +1734,7 @@ var prompt = function () { collection : null }; - for (let [, cmpltr] in Iterator(completers)) + for (let cmpltr of completers) { let tmpCc = cmpltr(currentText, text) || {collection : null}; let collection = tmpCc.collection; @@ -1749,7 +1749,7 @@ var prompt = function () { let max = -1; - for (let [, c] in Iterator(collections)) + for (let c of collections) { let first = c[0]; @@ -1964,12 +1964,12 @@ var prompt = function () { "watch" : undefined }; - for (let k in Iterator(objectPrototype, true)) + for (let k of Object.keys(objectPrototype)) objectPrototype[k] = Object[k]; let functionPrototype = {__proto__ : objectPrototype}; - for (let [, k] in Iterator(["apply", "call", "toSource", "toString", "valueOf"])) + for (let k of ["apply", "call", "toSource", "toString", "valueOf"]) functionPrototype[k] = Function[k]; let globalObjects = { @@ -1994,11 +1994,11 @@ var prompt = function () { URIError : [] }; - for (let [objName, keys] in Iterator(globalObjects)) + for (let [objName, keys] of util.keyValues(globalObjects)) { globalObjects[objName] = {}; - for ([, k] in Iterator(keys)) + for (k of keys) { globalObjects[objName][k] = global[objName][k]; } @@ -2826,7 +2826,7 @@ var prompt = function () { hook.removeHook('KeySnailInitialized', onInitialized); let displayHelpKey = []; - for (let [k, act] in Iterator(actionKeys.selector)) + for (let [k, act] of util.keyValues(actionKeys.selector)) { if (act === "prompt-display-keymap-help") displayHelpKey.push(k); diff --git a/content/modules/shell.js b/content/modules/shell.js index 029876e..4dbdaa9 100644 --- a/content/modules/shell.js +++ b/content/modules/shell.js @@ -317,7 +317,7 @@ var shell = * @param {} b */ function implant(a, b) { - for (let [k, v] in Iterator(a)) + for (let [k, v] of util.keyValues(a)) b[k] = v; return b; @@ -480,7 +480,7 @@ var shell = // if user input // "h" // returned item is will be "hoge". - for ([name, cmd] in Iterator(commands)) + for (let [name, cmd] of util.keyValues(commands)) { if (name.indexOf(left) === 0) { diff --git a/content/modules/userscript.js b/content/modules/userscript.js index ddf8f48..40839a5 100755 --- a/content/modules/userscript.js +++ b/content/modules/userscript.js @@ -777,7 +777,7 @@ var userscript = { main: "chrome://browser/content/browser.xul" }; - for (let [, entry] in Iterator(includeURIs)) + for (let entry of includeURIs) { uri = replacePair[entry] || entry; @@ -785,7 +785,7 @@ var userscript = { return false; } - for (let [, entry] in Iterator(excludeURIs)) + for (let entry of excludeURIs) { uri = replacePair[entry] || entry; @@ -1320,7 +1320,7 @@ var userscript = { var maxLen = Math.max.apply(null, [for (str of keys) str.length]); - for (let [, key] in Iterator(keys)) + for (let key of keys) { var setting = settings[key] || "undefined"; var padding = Math.max(maxLen - key.length, 0) + 2; @@ -1335,7 +1335,7 @@ var userscript = { return; } - for (let [, setting] in Iterator(aScheme.hooks)) + for (let setting of aScheme.hooks) { let [name, body] = setting; if (!name || !body) @@ -1376,7 +1376,7 @@ var userscript = { function getFunction(aCommand) { if (typeof aCommand === "string") { - for (let [, commands] in Iterator(builtin)) + for (let commands of util.values(builtin)) { if (commands[aCommand]) return commands[aCommand][0].toString(); @@ -1420,7 +1420,7 @@ var userscript = { var settings = aScheme.keybindings[mode]; - for (let [, setting] in Iterator(settings)) + for (let setting of settings) { if (!setting) continue; diff --git a/content/modules/util.js b/content/modules/util.js index afd1345..fda11b3 100755 --- a/content/modules/util.js +++ b/content/modules/util.js @@ -35,7 +35,7 @@ var util = function () { // partially borrowed from bookmarks.js of liberator ensureAliases : function (aEngines) { - for (let [, engine] in Iterator(aEngines)) + for (let engine of aEngines) { if (!engine.alias) { @@ -633,7 +633,7 @@ var util = function () { */ setPrefs: function setPrefs(aPrefList) { - for (let [key, value] in Iterator(aPrefList)) + for (let [key, value] of util.keyValues(aPrefList)) this.setPref(key, value); }, @@ -1257,7 +1257,7 @@ var util = function () { if (opts.mimeType) req.overrideMimeType(opts.mimeType); - for (let [name, value] in Iterator(opts.header || {})) + for (let [name, value] of util.keyValue(opts.header || {})) req.setRequestHeader(name, value); req.send(util.paramsToString(params) || null); @@ -1529,7 +1529,7 @@ var util = function () { if ("getOwnPropertyNames" in Object) { let encountered = { __proto__ : null }; - for (let [, k] in Iterator(Object.getOwnPropertyNames(obj))) + for (let k of Object.getOwnPropertyNames(obj)) try { encountered[k] = true; yield k; @@ -1559,17 +1559,20 @@ var util = function () { sortMultiple: function ([a], [b]) { return (a < b) ? -1 : (a > b) ? 1 : 0; }, find: function (array, pred) { - for (let [i, v] in Iterator(array)) + for (let [i, v] of util.keyValues(array)) { if (pred(v, i)) return v; + } + return undefined; }, findAll: function (array, pred) { let res = []; - for (let [i, v] in Iterator(array)) + for (let [i, v] of util.keyValues(array)) { if (pred(v, i)) - res.push(v); + res.push(v); + } return res.length ? res : null; }, diff --git a/content/modules/vimp.js b/content/modules/vimp.js index 92e44e0..0c4995a 100644 --- a/content/modules/vimp.js +++ b/content/modules/vimp.js @@ -351,7 +351,7 @@ shell.add("dia[log]", "Open a dialog", try { - for (let [, dialog] in Iterator(dialogs)) + for (let dialog of dialogs) { if (dialog[0].toLowerCase() === arg.toLowerCase()) { @@ -404,7 +404,7 @@ function getRemotePluginListCached(purgeCache) { return remotePluginListCache; } function getRemotePluginInfoByPluginName(pluginName) { - for (let [, remotePluginInfo] in Iterator(getRemotePluginListCached())) + for (let remotePluginInfo of getRemotePluginListCached()) if (remotePluginInfo.leafName === pluginName) return remotePluginInfo; return null; diff --git a/content/pluginmanager.js b/content/pluginmanager.js index 8bad062..45b0958 100644 --- a/content/pluginmanager.js +++ b/content/pluginmanager.js @@ -41,11 +41,11 @@ let ksPluginManager = (function () { let elem = document.createElement(name); if (attrs) - for (let [k, v] in Iterator(attrs)) + for (let [k, v] of util.keyValues(attrs)) elem.setAttribute(k, v); if (childs) - for (let [, child] in Iterator(childs)) + for (let child of childs) elem.appendChild(child); return elem; @@ -414,7 +414,7 @@ let ksPluginManager = (function () { function updateDisabledPluginList() { var disabledPlugins = []; - for (let [pluginPath, ] in Iterator(pluginInfoHolder)) { + for (let pluginPath of Object.keys(pluginInfoHolder)) { if (pluginInfoHolder[pluginPath].status === KS_PLUGIN_DISABLED) { disabledPlugins.push(pluginPath); } diff --git a/content/preference.js b/content/preference.js index 5b4bc6f..2931b43 100644 --- a/content/preference.js +++ b/content/preference.js @@ -91,7 +91,7 @@ var ksPreference = { setPluginUpdaterIntervalFieldState: function (enabled) { let box = document.getElementById("plugin-updater-interval"); - for (let [, elem] in Iterator(box.childNodes)) + for (let elem of box.childNodes) elem.disabled = !enabled; }, diff --git a/content/rcwizard.js b/content/rcwizard.js index b01203b..2152b9a 100644 --- a/content/rcwizard.js +++ b/content/rcwizard.js @@ -68,7 +68,7 @@ let self = this; this.getSchemeFiles(function (files) { - for (let [, leaf] in Iterator(files.map(function (f) f.leafName))) + for (let leaf of files.map(function (f) f.leafName)) { try { diff --git a/plugins/_color-theme-solarized.ks.js b/plugins/_color-theme-solarized.ks.js index f93cc9a..bc7d674 100644 --- a/plugins/_color-theme-solarized.ks.js +++ b/plugins/_color-theme-solarized.ks.js @@ -86,8 +86,8 @@ let PLUGIN_INFO = style.js["undefined"] = color($red); style.js["null"] = color($cyan); - for (let [prefix, opts] in Iterator(ooo)) - for (let [k, v] in Iterator(opts)) + for (let [prefix, opts] of util.keyValues(ooo)) + for (let [k, v] of util.keyValues(opts)) plugins.options[prefix + "." + k] = arrange(v); let colorThemeSolarized = arrange('\ diff --git a/plugins/_dark-theme.ks.js b/plugins/_dark-theme.ks.js index fb040a8..34692af 100644 --- a/plugins/_dark-theme.ks.js +++ b/plugins/_dark-theme.ks.js @@ -78,8 +78,8 @@ let PLUGIN_INFO = style.js["undefined"] = "color:#e000a5;"; style.js["null"] = "color:#07d8a8;"; - for (let [prefix, opts] in Iterator(ooo)) - for (let [k, v] in Iterator(opts)) + for (let [prefix, opts] of util.keyValues(ooo)) + for (let [k, v] of util.keyValues(opts)) plugins.options[prefix + "." + k] = arrange(v); let darkTheme = arrange(<>), getIndexAndMessageByCount: function (count) { - for (let [i, gm] in Iterator(this.gmList)) + for (let [i, gm] of util.keyValues(this.gmList)) { if (count == gm.count) return [i, gm]; diff --git a/plugins/builtin-commands-ext.ks.js b/plugins/builtin-commands-ext.ks.js index ebe1652..9bd1dc5 100644 --- a/plugins/builtin-commands-ext.ks.js +++ b/plugins/builtin-commands-ext.ks.js @@ -125,8 +125,8 @@ function main() { return; } - for (let [, commands] in Iterator(context.ksBuiltin)) { - for (var name in commands) { + for (let commands of util.keyValues(context.ksBuiltin)) { + for (let name of Object.keys(commands)) { var ename = propertyToExtName(name); diff --git a/plugins/dabbrev.ks.js b/plugins/dabbrev.ks.js index bb5a774..389fdd7 100644 --- a/plugins/dabbrev.ks.js +++ b/plugins/dabbrev.ks.js @@ -123,7 +123,7 @@ let dabbrev = popup.setAttribute("ignorekeys", "true"); - for (let [i, text] in Iterator(items)) + for (let [i, text] of util.keyValues(items)) { let item = document.createElement("menuitem"); item.setAttribute("label", text); diff --git a/plugins/dmacro.ks.js b/plugins/dmacro.ks.js index 889bbca..3962fc0 100644 --- a/plugins/dmacro.ks.js +++ b/plugins/dmacro.ks.js @@ -246,7 +246,7 @@ let dmacro = function play(aEvents) { var len = aEvents.length; - for (let [, event] in Iterator(aEvents)) + for (let event of aEvents) { let target = macro.getCurrentFocusedElement(); let fakedEv = {originalTarget : target}; diff --git a/plugins/hok.ks.js b/plugins/hok.ks.js index 766ddf2..d6aaa15 100644 --- a/plugins/hok.ks.js +++ b/plugins/hok.ks.js @@ -566,7 +566,7 @@ function followRel(doc, rel, pattern) { doc.querySelectorAll(pOptions["follow_link_candidate_selector"]) ); - for (let [, elem] in Iterator(relLinkCandidates.reverse())) { + for (let elem of relLinkCandidates.reverse()) { if (relLinkPattern.test(elem.textContent) || relLinkPattern.test(elem.alt) || relLinkPattern.test(elem.title)) { @@ -736,7 +736,7 @@ var hok = function () { } var hints = []; - for (let [hint] in Iterator(reverseHints)) { + for (let hint of Object.keys(reverseHints)) { hints.push(hint); } @@ -897,7 +897,7 @@ var hok = function () { var hintSpan = doc.createElement('span'); let st = hintSpan.style; - for (let [prop, value] in Iterator(hintBaseStyle)) + for (let [prop, value] of util.keyValues(hintBaseStyle)) st[formatPropertyName(prop)] = value; st.backgroundColor = hintColorLink; @@ -1016,7 +1016,7 @@ var hok = function () { const hideUnmatchedHint = pOptions["hide_unmatched_hint"]; let foundCount = 0; - for (let [hintStr, hintElem] in Iterator(hintElements)) { + for (let [hintStr, hintElem] of util.keyValues(hintElements)) { hintStr = String(hintStr); if (hintStr.indexOf(inputKey) === 0) { if (hintStr != inputKey) @@ -1033,7 +1033,7 @@ var hok = function () { } function resetHintsColor() { - for (let [, span] in Iterator(hintElements)) { + for (let span of util.values(hintElements)) { span.style.backgroundColor = getHintColor(span.element); span.style.display = "inline"; } @@ -1188,8 +1188,8 @@ var hok = function () { let currentPageURL = content.location.href; if (pOptions["local_queries"] && currentPageURL) { - for (let [, [targetURLPattern, localSelector, toOverride]] - in Iterator(pOptions["local_queries"])) + for (let [targetURLPattern, localSelector, toOverride] + of pOptions["local_queries"]) { if (currentPageURL.match(targetURLPattern)) { @@ -1254,7 +1254,7 @@ var hok = function () { try { // TODO: Is there a good way to do this? - for (let [, hintElem] in Iterator(hintElements)) + for (let hintElem of util.values(hintElements)) { if (supressUniqueFire) hintElem.element.focus(); diff --git a/plugins/kkk.ks.js b/plugins/kkk.ks.js index 798e2a7..078fb81 100644 --- a/plugins/kkk.ks.js +++ b/plugins/kkk.ks.js @@ -127,12 +127,12 @@ let kkk = }, start: function () { - for (let [, type] in Iterator(eventType)) + for (let type of eventType) window.addEventListener(type, preventEvent, true); }, stop: function () { - for (let [, type] in Iterator(eventType)) + for (let type of eventType) window.removeEventListener(type, preventEvent, true); } }; diff --git a/plugins/metaplus.ks.js b/plugins/metaplus.ks.js index de41921..ace9066 100644 --- a/plugins/metaplus.ks.js +++ b/plugins/metaplus.ks.js @@ -104,12 +104,12 @@ function getOption(aName) { return aName in optionsDefaultValue ? optionsDefaultValue[aName] : undefined; } -for (let [mode, keymap] in Iterator(key.keyMapHolder)) +for (let [mode, keymap] of util.keyValues(key.keyMapHolder)) { if (!keymap) continue; - for (let [k, f] in Iterator(keymap)) + for (let [k, f] of util.keyValues(keymap)) { let matched = k.match(/^(C-)?M-(.+)/); if (matched) diff --git a/plugins/yet-another-twitter-client-keysnail.ks.js b/plugins/yet-another-twitter-client-keysnail.ks.js index 8992486..d69872b 100755 --- a/plugins/yet-another-twitter-client-keysnail.ks.js +++ b/plugins/yet-another-twitter-client-keysnail.ks.js @@ -524,11 +524,11 @@ const $U = { let elem = document.createElement(name); if (attrs) - for (let [k, v] in Iterator(attrs)) + for (let [k, v] of util.keyValues(attrs)) elem.setAttribute(k, v); if (childs) - for (let [, v] in Iterator(childs)) + for (let v of childs) elem.appendChild(v); return elem; @@ -1048,7 +1048,7 @@ OAuth.prototype = { if (options.parameters && message.method === "POST") { outer: - for (let [, params] in Iterator(options.parameters)) + for (let params of options.parameters) { for (let i = 0; i < message.parameters; ++i) { @@ -1112,7 +1112,7 @@ const twitterAPI = { let action = proto.action; - for (let [k, v] in Iterator(args)) + for (let [k, v] of util.keyValues(args)) if (typeof v !== "undefined") action = action.replace(util.format("{%s}", k), $U.encodeOAuth(v), "g"); @@ -1629,7 +1629,7 @@ var twitterClient = window.addEventListener("unload", function () { self.stop(); - for (let [, win] in Iterator(Notifier.getBrowserWindows())) + for (let win of Notifier.getBrowserWindows()) { try { @@ -1792,7 +1792,7 @@ var twitterClient = if (!share.twitterTrackingInfo) share.twitterTrackingInfo = persist.restore("yatck_tracking_info") || {}; - for (let [name, info] in Iterator(share.twitterTrackingInfo)) + for (let [name, info] of util.keyValues(share.twitterTrackingInfo)) { if (!share.twitterTrackingInfo[name]) share.twitterTrackingInfo[name] = {}; @@ -2585,7 +2585,7 @@ var twitterClient = let listOrigin = document.getElementById(HEAD_LIST_ORIGIN); let listButtons = {}; - for (let [, crawler] in Iterator(gLists)) + for (let crawler of util.values(gLists)) { let button = document.createElement("toolbarbutton"); @@ -2608,7 +2608,7 @@ var twitterClient = let searchOrigin = document.getElementById(HEAD_SEARCH_ORIGIN); let trackingButtons = {}; - for (let [, crawler] in Iterator(gTrackings)) + for (let crawler of util.values(gTrackings)) { let name = crawler.name; let keyword = crawler.nameEscaped; @@ -3588,7 +3588,7 @@ var twitterClient = ["entities", "media"].forEach(function (entityContainerName) { let entityContainer = status[entityContainerName]; if (status[entityContainerName]) { - for (let [entityName, entity] in Iterator(entityContainer)) { + for (let [entityName, entity] of util.keyValues(entityContainer)) { entities[entityName] = entity; } } @@ -3614,7 +3614,7 @@ var twitterClient = retweetedMessageNode.removeChild(retweetedMessageNode.firstChild); } - for (let [, childNode] in Iterator(newChildren)) { + for (let childNode of newChildren) { retweetedMessageNode.appendChild(childNode); } @@ -3999,7 +3999,7 @@ var twitterClient = if (!gStatuses.cache) return; - for (let [, status] in Iterator(gStatuses.cache)) + for (let status of gStatuses.cache) if (status.id_str === aId) proc(status); } @@ -4383,7 +4383,7 @@ var twitterClient = updateListButton: function () { let listButtons = my.twitterClientHeader.listButtons; - for (let [, crawler] in Iterator(gLists)) + for (let crawler of gLists) { if (crawler.name in listButtons && crawler.cache && crawler.cache.length) { @@ -4397,7 +4397,7 @@ var twitterClient = updateTrackingButton: function () { let trackingButtons = my.twitterClientHeader.trackingButtons; - for (let [, crawler] in Iterator(gTrackings)) + for (let crawler of util.values(gTrackings)) { if (crawler.name in trackingButtons && crawler.cache && crawler.cache.length) { @@ -4575,7 +4575,7 @@ var twitterClient = if (pOptions["automatically_begin_list"]) { - for (let [, crawler] in Iterator(gLists)) + for (let crawler of gLists) { if (crawler.cache) continue; @@ -4587,7 +4587,7 @@ var twitterClient = if (pOptions["automatically_begin_tracking"]) { - for (let [, crawler] in Iterator(gTrackings)) + for (let crawler of util.keyValues(gTrackings)) { if (crawler.cache) continue; diff --git a/share/WikiParser.js b/share/WikiParser.js index e34850d..8b6c0ce 100644 --- a/share/WikiParser.js +++ b/share/WikiParser.js @@ -109,7 +109,6 @@ WikiParser.prototype = { } }, parse: function(){ - var ite = Iterator(this.lines); var num, line, indent; var currentIndent = 0, indentList = [0], nest=0; var prevMode = ""; @@ -117,7 +116,7 @@ WikiParser.prototype = { var stack = []; var prevNode; //try { - for ([num, line] in ite){ + for ([num, line] of util.keyValues(this.lines)){ [,indent, line] = line.match(/^(\s*)(.*)\s*$/); currentIndent = indent.length; var prevIndent = indentList[indentList.length -1]; diff --git a/share/share.js b/share/share.js index 4cb7de7..59fef34 100644 --- a/share/share.js +++ b/share/share.js @@ -243,7 +243,7 @@ function hookApplicationQuit() { quitObserver.prototype = { observe: function(subject, topic, data) { - for (let [name, obj] in Iterator(persist.registeredObjects)) + for (let [name, obj] of util.keyValues(persist.registeredObjects)) { persist.preserve(obj, name); } diff --git a/stub/hit-a-hint.ks.js b/stub/hit-a-hint.ks.js index a44b4ac..a90bd2a 100644 --- a/stub/hit-a-hint.ks.js +++ b/stub/hit-a-hint.ks.js @@ -396,11 +396,11 @@ var ksHah = new function () { let type = elem.type; if (elem instanceof HTMLInputElement && /(submit|button|reset)/.test(type)) { - return [elem.value, false]; + return [elem.value, false]; } else { - for (let [, option] in Iterator(options["hintinputs"].split(","))) + for (let option of options["hintinputs"].split(",")) { if (option == "value") { @@ -641,7 +641,7 @@ var ksHah = new function () { let activeHint = hintNumber || 1; validHints = []; - for (let [,{ doc: doc, start: start, end: end }] in Iterator(docs)) + for (let { doc: doc, start: start, end: end } of docs) { let [scrollX, scrollY] = getBodyOffsets(doc); @@ -701,7 +701,7 @@ var ksHah = new function () { { let css = []; // FIXME: Broken for imgspans. - for (let [, { doc: doc }] in Iterator(docs)) + for (let { doc: doc } of docs) { for (let elem in evaluateXPath("//*[@keysnail:highlight and @number]", doc)) { @@ -727,7 +727,7 @@ var ksHah = new function () { { let firstElem = validHints[0] || null; - for (let [,{ doc: doc, start: start, end: end }] in Iterator(docs)) + for (let { doc: doc, start: start, end: end } of docs) { for (let elem in evaluateXPath("//*[@keysnail:highlight='hints']", doc)) elem.parentNode.removeChild(elem); @@ -987,7 +987,7 @@ var ksHah = new function () { function stringsAtBeginningOfWords(strings, words, allowWordOverleaping) { let strIdx = 0; - for (let [, word] in Iterator(words)) + for (let word of words) { if (word.length == 0) continue;