mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 17:47:59 +01:00
Camel-case array#{iteritems,itervalues}.
This commit is contained in:
@@ -18,7 +18,7 @@ const AutoCommands = Module("autocommands", {
|
|||||||
this._store = [];
|
this._store = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
__iterator__: function () array.itervalues(this._store),
|
__iterator__: function () array.iterValues(this._store),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new autocommand. <b>cmd</b> will be executed when one of the
|
* Adds a new autocommand. <b>cmd</b> will be executed when one of the
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ const Buffer = Module("buffer", {
|
|||||||
const ACCESS_READ = Ci.nsICache.ACCESS_READ;
|
const ACCESS_READ = Ci.nsICache.ACCESS_READ;
|
||||||
let cacheKey = doc.location.toString().replace(/#.*$/, "");
|
let cacheKey = doc.location.toString().replace(/#.*$/, "");
|
||||||
|
|
||||||
for (let proto in array.itervalues(["HTTP", "FTP"])) {
|
for (let proto in array.iterValues(["HTTP", "FTP"])) {
|
||||||
try {
|
try {
|
||||||
var cacheEntryDescriptor = services.get("cache").createSession(proto, 0, true)
|
var cacheEntryDescriptor = services.get("cache").createSession(proto, 0, true)
|
||||||
.openCacheEntry(cacheKey, ACCESS_READ, false);
|
.openCacheEntry(cacheKey, ACCESS_READ, false);
|
||||||
@@ -1022,7 +1022,7 @@ const Buffer = Module("buffer", {
|
|||||||
if (win.scrollMaxX > 0 || win.scrollMaxY > 0)
|
if (win.scrollMaxX > 0 || win.scrollMaxY > 0)
|
||||||
return win;
|
return win;
|
||||||
|
|
||||||
for (let frame in array.itervalues(win.frames))
|
for (let frame in array.iterValues(win.frames))
|
||||||
if (frame.scrollMaxX > 0 || frame.scrollMaxY > 0)
|
if (frame.scrollMaxX > 0 || frame.scrollMaxY > 0)
|
||||||
return frame;
|
return frame;
|
||||||
|
|
||||||
@@ -1335,7 +1335,7 @@ const Buffer = Module("buffer", {
|
|||||||
context.fork(id, 0, this, function (context, [name, browsers]) {
|
context.fork(id, 0, this, function (context, [name, browsers]) {
|
||||||
context.title = [name || "Buffers"];
|
context.title = [name || "Buffers"];
|
||||||
context.generate = function ()
|
context.generate = function ()
|
||||||
util.map(array.itervalues(browsers), function ([i, browser]) {
|
util.map(array.iterValues(browsers), function ([i, browser]) {
|
||||||
let indicator = " ";
|
let indicator = " ";
|
||||||
if (i == tabs.index())
|
if (i == tabs.index())
|
||||||
indicator = "%"
|
indicator = "%"
|
||||||
|
|||||||
@@ -1732,7 +1732,7 @@ const ItemList = Class("ItemList", {
|
|||||||
|
|
||||||
for (let [i, row] in Iterator(context.getRows(start, end, this._doc)))
|
for (let [i, row] in Iterator(context.getRows(start, end, this._doc)))
|
||||||
nodes[i] = row;
|
nodes[i] = row;
|
||||||
for (let [i, row] in array.iteritems(nodes)) {
|
for (let [i, row] in array.iterItems(nodes)) {
|
||||||
if (!row)
|
if (!row)
|
||||||
continue;
|
continue;
|
||||||
let display = (i >= start && i < end);
|
let display = (i >= start && i < end);
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ const Commands = Module("commands", {
|
|||||||
/** @property {Iterator(Command)} @private */
|
/** @property {Iterator(Command)} @private */
|
||||||
__iterator__: function () {
|
__iterator__: function () {
|
||||||
let sorted = this._exCommands.sort(function (a, b) a.name > b.name);
|
let sorted = this._exCommands.sort(function (a, b) a.name > b.name);
|
||||||
return array.itervalues(sorted);
|
return array.iterValues(sorted);
|
||||||
},
|
},
|
||||||
|
|
||||||
/** @property {string} The last executed Ex command line. */
|
/** @property {string} The last executed Ex command line. */
|
||||||
@@ -548,7 +548,7 @@ const Commands = Module("commands", {
|
|||||||
argCount = "*";
|
argCount = "*";
|
||||||
|
|
||||||
var args = []; // parsed options
|
var args = []; // parsed options
|
||||||
args.__iterator__ = function () array.iteritems(this);
|
args.__iterator__ = function () array.iterItems(this);
|
||||||
args.string = str; // for access to the unparsed string
|
args.string = str; // for access to the unparsed string
|
||||||
args.literalArg = "";
|
args.literalArg = "";
|
||||||
|
|
||||||
@@ -855,7 +855,7 @@ const Commands = Module("commands", {
|
|||||||
removeUserCommand: function (name) {
|
removeUserCommand: function (name) {
|
||||||
let cmd = this.get(name);
|
let cmd = this.get(name);
|
||||||
dactyl.assert(cmd.user, "E184: No such user-defined command: " + name);
|
dactyl.assert(cmd.user, "E184: No such user-defined command: " + name);
|
||||||
for (let name in array.itervalues(cmd.names))
|
for (let name in array.iterValues(cmd.names))
|
||||||
delete this._exMap[name];
|
delete this._exMap[name];
|
||||||
this._exCommands = this._exCommands.filter(function (c) c != cmd);
|
this._exCommands = this._exCommands.filter(function (c) c != cmd);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
// Find the tags in the document.
|
// Find the tags in the document.
|
||||||
function addTags(file, doc) {
|
function addTags(file, doc) {
|
||||||
for (let elem in util.evaluateXPath("//@tag|//dactyl:tags/text()|//dactyl:tag/text()", doc))
|
for (let elem in util.evaluateXPath("//@tag|//dactyl:tags/text()|//dactyl:tag/text()", doc))
|
||||||
for (let tag in array((elem.value || elem.textContent).split(/\s+/)).compact().itervalues())
|
for (let tag in array((elem.value || elem.textContent).split(/\s+/)).compact().iterValues())
|
||||||
tagMap[tag] = file;
|
tagMap[tag] = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -592,7 +592,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
if (node instanceof HTMLHtmlElement)
|
if (node instanceof HTMLHtmlElement)
|
||||||
data.push(" xmlns=" + XHTML.uri.quote());
|
data.push(" xmlns=" + XHTML.uri.quote());
|
||||||
|
|
||||||
for (let { name, value } in array.itervalues(node.attributes)) {
|
for (let { name, value } in array.iterValues(node.attributes)) {
|
||||||
if (name == "dactyl:highlight") {
|
if (name == "dactyl:highlight") {
|
||||||
name = "class";
|
name = "class";
|
||||||
value = "hl-" + value;
|
value = "hl-" + value;
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ const RangeFind = Class("RangeFind", {
|
|||||||
let pageStart = RangeFind.endpoint(pageRange, true);
|
let pageStart = RangeFind.endpoint(pageRange, true);
|
||||||
let pageEnd = RangeFind.endpoint(pageRange, false);
|
let pageEnd = RangeFind.endpoint(pageRange, false);
|
||||||
|
|
||||||
for (let frame in array.itervalues(win.frames)) {
|
for (let frame in array.iterValues(win.frames)) {
|
||||||
let range = doc.createRange();
|
let range = doc.createRange();
|
||||||
if (util.computedStyle(frame.frameElement).visibility == "visible") {
|
if (util.computedStyle(frame.frameElement).visibility == "visible") {
|
||||||
range.selectNode(frame.frameElement);
|
range.selectNode(frame.frameElement);
|
||||||
@@ -577,11 +577,11 @@ const RangeFind = Class("RangeFind", {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addListeners: function () {
|
addListeners: function () {
|
||||||
for (let range in array.itervalues(this.ranges))
|
for (let range in array.iterValues(this.ranges))
|
||||||
range.window.addEventListener("unload", this.closure.onUnload, true);
|
range.window.addEventListener("unload", this.closure.onUnload, true);
|
||||||
},
|
},
|
||||||
purgeListeners: function () {
|
purgeListeners: function () {
|
||||||
for (let range in array.itervalues(this.ranges))
|
for (let range in array.iterValues(this.ranges))
|
||||||
range.window.removeEventListener("unload", this.closure.onUnload, true);
|
range.window.removeEventListener("unload", this.closure.onUnload, true);
|
||||||
},
|
},
|
||||||
onUnload: function (event) {
|
onUnload: function (event) {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const History = Module("history", {
|
|||||||
let sh = window.getWebNavigation().sessionHistory;
|
let sh = window.getWebNavigation().sessionHistory;
|
||||||
let obj = [];
|
let obj = [];
|
||||||
obj.index = sh.index;
|
obj.index = sh.index;
|
||||||
obj.__iterator__ = function () array.iteritems(this);
|
obj.__iterator__ = function () array.iterItems(this);
|
||||||
for (let i in util.range(0, sh.count)) {
|
for (let i in util.range(0, sh.count)) {
|
||||||
obj[i] = update(Object.create(sh.getEntryAtIndex(i, false)),
|
obj[i] = update(Object.create(sh.getEntryAtIndex(i, false)),
|
||||||
{ index: i });
|
{ index: i });
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ const Modes = Module("modes", {
|
|||||||
|
|
||||||
NONE: 0,
|
NONE: 0,
|
||||||
|
|
||||||
__iterator__: function () array.itervalues(this.all),
|
__iterator__: function () array.iterValues(this.all),
|
||||||
|
|
||||||
get all() this._mainModes.slice(),
|
get all() this._mainModes.slice(),
|
||||||
|
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ set.remove = function (set, key) {
|
|||||||
*/
|
*/
|
||||||
function iter(obj) {
|
function iter(obj) {
|
||||||
if (isinstance(obj, [Ci.nsIDOMHTMLCollection, Ci.nsIDOMNodeList]))
|
if (isinstance(obj, [Ci.nsIDOMHTMLCollection, Ci.nsIDOMNodeList]))
|
||||||
return array.iteritems(obj);
|
return array.iterItems(obj);
|
||||||
if (obj instanceof Ci.nsIDOMNamedNodeMap)
|
if (obj instanceof Ci.nsIDOMNamedNodeMap)
|
||||||
return (function () {
|
return (function () {
|
||||||
for (let i = 0; i < obj.length; i++)
|
for (let i = 0; i < obj.length; i++)
|
||||||
@@ -899,7 +899,7 @@ const array = Class("array", Array, {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
__proto__: ary,
|
__proto__: ary,
|
||||||
__iterator__: function () this.iteritems(),
|
__iterator__: function () this.iterItems(),
|
||||||
__noSuchMethod__: function (meth, args) {
|
__noSuchMethod__: function (meth, args) {
|
||||||
var res = array[meth].apply(null, [this.array].concat(args));
|
var res = array[meth].apply(null, [this.array].concat(args));
|
||||||
if (isArray(res))
|
if (isArray(res))
|
||||||
@@ -966,7 +966,7 @@ const array = Class("array", Array, {
|
|||||||
* @param {Array} ary
|
* @param {Array} ary
|
||||||
* @returns {Iterator(Object)}
|
* @returns {Iterator(Object)}
|
||||||
*/
|
*/
|
||||||
itervalues: function itervalues(ary) {
|
iterValues: function iterValues(ary) {
|
||||||
let length = ary.length;
|
let length = ary.length;
|
||||||
for (let i = 0; i < length; i++)
|
for (let i = 0; i < length; i++)
|
||||||
yield ary[i];
|
yield ary[i];
|
||||||
@@ -978,7 +978,7 @@ const array = Class("array", Array, {
|
|||||||
* @param {Array} ary
|
* @param {Array} ary
|
||||||
* @returns {Iterator([{number}, {Object}])}
|
* @returns {Iterator([{number}, {Object}])}
|
||||||
*/
|
*/
|
||||||
iteritems: function iteritems(ary) {
|
iterItems: function iterItems(ary) {
|
||||||
let length = ary.length;
|
let length = ary.length;
|
||||||
for (let i = 0; i < length; i++)
|
for (let i = 0; i < length; i++)
|
||||||
yield [i, ary[i]];
|
yield [i, ary[i]];
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const Template = Module("Template", {
|
|||||||
|
|
||||||
map: function map(iter, func, sep, interruptable) {
|
map: function map(iter, func, sep, interruptable) {
|
||||||
if (iter.length) // FIXME: Kludge?
|
if (iter.length) // FIXME: Kludge?
|
||||||
iter = array.itervalues(iter);
|
iter = array.iterValues(iter);
|
||||||
let ret = <></>;
|
let ret = <></>;
|
||||||
let n = 0;
|
let n = 0;
|
||||||
for each (let i in Iterator(iter)) {
|
for each (let i in Iterator(iter)) {
|
||||||
|
|||||||
@@ -548,7 +548,7 @@ const Util = Module("Util", {
|
|||||||
if (color)
|
if (color)
|
||||||
return <span highlight="HelpXMLBlock"><span highlight="HelpXMLTagStart"><{
|
return <span highlight="HelpXMLBlock"><span highlight="HelpXMLTagStart"><{
|
||||||
namespaced(elem)} {
|
namespaced(elem)} {
|
||||||
template.map(array.itervalues(elem.attributes),
|
template.map(array.iterValues(elem.attributes),
|
||||||
function (attr)
|
function (attr)
|
||||||
<span highlight="HelpXMLAttribute">{namespaced(attr)}</span> +
|
<span highlight="HelpXMLAttribute">{namespaced(attr)}</span> +
|
||||||
<span highlight="HelpXMLString">{attr.value}</span>,
|
<span highlight="HelpXMLString">{attr.value}</span>,
|
||||||
@@ -560,7 +560,7 @@ const Util = Module("Util", {
|
|||||||
|
|
||||||
let tag = "<" + [namespaced(elem)].concat(
|
let tag = "<" + [namespaced(elem)].concat(
|
||||||
[namespaced(a) + "=" + template.highlight(a.value, true)
|
[namespaced(a) + "=" + template.highlight(a.value, true)
|
||||||
for ([i, a] in array.iteritems(elem.attributes))]).join(" ");
|
for ([i, a] in array.iterItems(elem.attributes))]).join(" ");
|
||||||
return tag + (hasChildren ? "/>" : ">...</" + namespaced(elem) + ">");
|
return tag + (hasChildren ? "/>" : ">...</" + namespaced(elem) + ">");
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user