Sometimes while loops are better than for loops.
This commit is contained in:
parent
dc8b772099
commit
176913138c
@ -973,7 +973,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Post.prototype.parseComment = function() {
|
Post.prototype.parseComment = function() {
|
||||||
var bq, data, i, node, nodes, text, _i, _j, _len, _ref, _ref1;
|
var bq, data, i, node, nodes, text, _i, _len, _ref;
|
||||||
|
|
||||||
bq = this.nodes.comment.cloneNode(true);
|
bq = this.nodes.comment.cloneNode(true);
|
||||||
_ref = $$('.abbr, .capcodeReplies, .exif, b', bq);
|
_ref = $$('.abbr, .capcodeReplies, .exif, b', bq);
|
||||||
@ -983,8 +983,9 @@
|
|||||||
}
|
}
|
||||||
text = [];
|
text = [];
|
||||||
nodes = d.evaluate('.//br|.//text()', bq, null, 7, null);
|
nodes = d.evaluate('.//br|.//text()', bq, null, 7, null);
|
||||||
for (i = _j = 0, _ref1 = nodes.snapshotLength; 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
|
i = 0;
|
||||||
text.push((data = nodes.snapshotItem(i).data) ? data : '\n');
|
while (i < nodes.snapshotLength) {
|
||||||
|
text.push((data = nodes.snapshotItem(i++).data) ? data : '\n');
|
||||||
}
|
}
|
||||||
return this.info.comment = text.join('').trim().replace(/\s+$/gm, '');
|
return this.info.comment = text.join('').trim().replace(/\s+$/gm, '');
|
||||||
};
|
};
|
||||||
@ -10015,14 +10016,15 @@
|
|||||||
return Main.checkUpdate();
|
return Main.checkUpdate();
|
||||||
},
|
},
|
||||||
callbackNodes: function(klass, nodes) {
|
callbackNodes: function(klass, nodes) {
|
||||||
var callback, err, errors, i, len, node, _i, _j, _len, _ref;
|
var callback, err, errors, i, len, node, _i, _len, _ref;
|
||||||
|
|
||||||
len = nodes.length;
|
len = nodes.length;
|
||||||
_ref = klass.prototype.callbacks;
|
_ref = klass.prototype.callbacks;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
callback = _ref[_i];
|
callback = _ref[_i];
|
||||||
for (i = _j = 0; 0 <= len ? _j < len : _j > len; i = 0 <= len ? ++_j : --_j) {
|
i = 0;
|
||||||
node = nodes[i];
|
while (i < len) {
|
||||||
|
node = nodes[i++];
|
||||||
try {
|
try {
|
||||||
callback.cb.call(node);
|
callback.cb.call(node);
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
|
|||||||
@ -969,7 +969,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Post.prototype.parseComment = function() {
|
Post.prototype.parseComment = function() {
|
||||||
var bq, data, i, node, nodes, text, _i, _j, _len, _ref, _ref1;
|
var bq, data, i, node, nodes, text, _i, _len, _ref;
|
||||||
|
|
||||||
bq = this.nodes.comment.cloneNode(true);
|
bq = this.nodes.comment.cloneNode(true);
|
||||||
_ref = $$('.abbr, .capcodeReplies, .exif, b', bq);
|
_ref = $$('.abbr, .capcodeReplies, .exif, b', bq);
|
||||||
@ -979,8 +979,9 @@
|
|||||||
}
|
}
|
||||||
text = [];
|
text = [];
|
||||||
nodes = d.evaluate('.//br|.//text()', bq, null, 7, null);
|
nodes = d.evaluate('.//br|.//text()', bq, null, 7, null);
|
||||||
for (i = _j = 0, _ref1 = nodes.snapshotLength; 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
|
i = 0;
|
||||||
text.push((data = nodes.snapshotItem(i).data) ? data : '\n');
|
while (i < nodes.snapshotLength) {
|
||||||
|
text.push((data = nodes.snapshotItem(i++).data) ? data : '\n');
|
||||||
}
|
}
|
||||||
return this.info.comment = text.join('').trim().replace(/\s+$/gm, '');
|
return this.info.comment = text.join('').trim().replace(/\s+$/gm, '');
|
||||||
};
|
};
|
||||||
@ -10038,14 +10039,15 @@
|
|||||||
return Main.checkUpdate();
|
return Main.checkUpdate();
|
||||||
},
|
},
|
||||||
callbackNodes: function(klass, nodes) {
|
callbackNodes: function(klass, nodes) {
|
||||||
var callback, err, errors, i, len, node, _i, _j, _len, _ref;
|
var callback, err, errors, i, len, node, _i, _len, _ref;
|
||||||
|
|
||||||
len = nodes.length;
|
len = nodes.length;
|
||||||
_ref = klass.prototype.callbacks;
|
_ref = klass.prototype.callbacks;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
callback = _ref[_i];
|
callback = _ref[_i];
|
||||||
for (i = _j = 0; 0 <= len ? _j < len : _j > len; i = 0 <= len ? ++_j : --_j) {
|
i = 0;
|
||||||
node = nodes[i];
|
while (i < len) {
|
||||||
|
node = nodes[i++];
|
||||||
try {
|
try {
|
||||||
callback.cb.call(node);
|
callback.cb.call(node);
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
|
|||||||
@ -972,7 +972,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
Post.prototype.parseComment = function() {
|
Post.prototype.parseComment = function() {
|
||||||
var bq, data, i, node, nodes, text, _i, _j, _len, _ref, _ref1;
|
var bq, data, i, node, nodes, text, _i, _len, _ref;
|
||||||
|
|
||||||
bq = this.nodes.comment.cloneNode(true);
|
bq = this.nodes.comment.cloneNode(true);
|
||||||
_ref = $$('.abbr, .capcodeReplies, .exif, b', bq);
|
_ref = $$('.abbr, .capcodeReplies, .exif, b', bq);
|
||||||
@ -982,8 +982,9 @@
|
|||||||
}
|
}
|
||||||
text = [];
|
text = [];
|
||||||
nodes = d.evaluate('.//br|.//text()', bq, null, 7, null);
|
nodes = d.evaluate('.//br|.//text()', bq, null, 7, null);
|
||||||
for (i = _j = 0, _ref1 = nodes.snapshotLength; 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
|
i = 0;
|
||||||
text.push((data = nodes.snapshotItem(i).data) ? data : '\n');
|
while (i < nodes.snapshotLength) {
|
||||||
|
text.push((data = nodes.snapshotItem(i++).data) ? data : '\n');
|
||||||
}
|
}
|
||||||
return this.info.comment = text.join('').trim().replace(/\s+$/gm, '');
|
return this.info.comment = text.join('').trim().replace(/\s+$/gm, '');
|
||||||
};
|
};
|
||||||
@ -10020,14 +10021,15 @@
|
|||||||
return Main.checkUpdate();
|
return Main.checkUpdate();
|
||||||
},
|
},
|
||||||
callbackNodes: function(klass, nodes) {
|
callbackNodes: function(klass, nodes) {
|
||||||
var callback, err, errors, i, len, node, _i, _j, _len, _ref;
|
var callback, err, errors, i, len, node, _i, _len, _ref;
|
||||||
|
|
||||||
len = nodes.length;
|
len = nodes.length;
|
||||||
_ref = klass.prototype.callbacks;
|
_ref = klass.prototype.callbacks;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
callback = _ref[_i];
|
callback = _ref[_i];
|
||||||
for (i = _j = 0; 0 <= len ? _j < len : _j > len; i = 0 <= len ? ++_j : --_j) {
|
i = 0;
|
||||||
node = nodes[i];
|
while (i < len) {
|
||||||
|
node = nodes[i++];
|
||||||
try {
|
try {
|
||||||
callback.cb.call(node);
|
callback.cb.call(node);
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
|
|||||||
@ -221,8 +221,9 @@ Main =
|
|||||||
len = nodes.length
|
len = nodes.length
|
||||||
for callback in klass::callbacks
|
for callback in klass::callbacks
|
||||||
# c.profile callback.name
|
# c.profile callback.name
|
||||||
for i in [0...len]
|
i = 0
|
||||||
node = nodes[i]
|
while i < len
|
||||||
|
node = nodes[i++]
|
||||||
try
|
try
|
||||||
callback.cb.call node
|
callback.cb.call node
|
||||||
catch err
|
catch err
|
||||||
|
|||||||
@ -108,8 +108,9 @@ class Post
|
|||||||
text = []
|
text = []
|
||||||
# XPathResult.ORDERED_NODE_SNAPSHOT_TYPE === 7
|
# XPathResult.ORDERED_NODE_SNAPSHOT_TYPE === 7
|
||||||
nodes = d.evaluate './/br|.//text()', bq, null, 7, null
|
nodes = d.evaluate './/br|.//text()', bq, null, 7, null
|
||||||
for i in [0...nodes.snapshotLength]
|
i = 0
|
||||||
text.push if data = nodes.snapshotItem(i).data then data else '\n'
|
while i < nodes.snapshotLength
|
||||||
|
text.push if data = nodes.snapshotItem(i++).data then data else '\n'
|
||||||
@info.comment = text.join('').trim().replace /\s+$/gm, ''
|
@info.comment = text.join('').trim().replace /\s+$/gm, ''
|
||||||
|
|
||||||
parseQuotes: ->
|
parseQuotes: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user