diff --git a/plugin/multi-hints.js b/plugin/multi-hints.js index e991abc..027b75b 100755 --- a/plugin/multi-hints.js +++ b/plugin/multi-hints.js @@ -70,6 +70,19 @@ xml` e.href ? e.href : _), liberator.NEW_BACKGROUND_TAB); + }, }, javascript: { desc: "execute javascript", @@ -192,7 +208,7 @@ xml` attr.lastIndexOf(name, 0) === 0 ? attr : _); if (names.length === 1) name = names[0]; else { if (names.length > 0) @@ -254,9 +270,9 @@ xml` [name, e.desc]); else { - let list = [[n.value, n.host] for([, n] in storage[historyQuery])]; + let list = iter_fmap(storage[historyQuery], ([,n]) => [n.value, n.host]); list.reverse(); context.completions = list; } @@ -268,14 +284,14 @@ xml` attr.lastIndexOf(arg) === 0 ? attr : _); if (arg === "") { commandline.input("mh:", function (arg) { commandline.open(":", "multihints " + arg + " ", modes.EX) }, { completer: function (context) { - context.completions = [[name, e.desc] for([name, e] in Iterator(_hintModes))]; + context.completions = iter_fmap(Iterator(_hintModes), ([name, e]) => [name, e.desc]); } }); return; @@ -305,7 +321,7 @@ xml` a[0].trim()); hints.addMode(prompt, "select node:", function () { }, function () util.makeXPath(tag)); hints._hintMode = hints._hintModes[prompt]; @@ -329,16 +345,15 @@ xml` id ? id : _); + let classList = [...elems[0].classList]; for (let i in util.range(1, elems.length)) { let elem = elems[i]; - parentId = [e.id for (e in parent(elem.parentNode)) if (e.id)] - .filter(function(n) parentId.indexOf(n) >= 0); - classList = [c for (c in util.Array.itervalues(elem.classList))] - .filter(function(n) classList.indexOf(n) >= 0); + parentId = iter_fmap(parent(elem.parentNode), + ({id}, _) => id && parentId.indexOf(id) >= 0 ? id : _); + classList = [...elem.classList].filter(s => classList.indexOf(s) >= 0); } let res = "";