Almost twice faster comment text reading for filters.
This commit is contained in:
parent
5db4f7e882
commit
5bd1d3ebb5
@ -631,9 +631,20 @@
|
|||||||
return sub.textContent;
|
return sub.textContent;
|
||||||
},
|
},
|
||||||
comment: function(root) {
|
comment: function(root) {
|
||||||
return ($.el('a', {
|
var i, len, node, nodes, text;
|
||||||
innerHTML: root.lastChild.innerHTML.replace(/<br>/g, '\n')
|
text = [];
|
||||||
})).textContent;
|
nodes = d.evaluate('.//node()', root.lastChild, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
|
||||||
|
i = 0;
|
||||||
|
len = nodes.snapshotLength;
|
||||||
|
while (i < len) {
|
||||||
|
node = nodes.snapshotItem(i++);
|
||||||
|
if (node instanceof Text) {
|
||||||
|
text.push(node.data);
|
||||||
|
} else if (node instanceof HTMLBRElement) {
|
||||||
|
text.push('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return text.join('');
|
||||||
},
|
},
|
||||||
filename: function(root) {
|
filename: function(root) {
|
||||||
var file;
|
var file;
|
||||||
|
|||||||
@ -543,7 +543,17 @@ filter =
|
|||||||
sub = if isOP then $ '.filetitle', root else $ '.replytitle', root
|
sub = if isOP then $ '.filetitle', root else $ '.replytitle', root
|
||||||
sub.textContent
|
sub.textContent
|
||||||
comment: (root) ->
|
comment: (root) ->
|
||||||
($.el 'a', innerHTML: root.lastChild.innerHTML.replace /<br>/g, '\n').textContent
|
text = []
|
||||||
|
nodes = d.evaluate './/node()', root.lastChild, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
|
||||||
|
i = 0
|
||||||
|
len = nodes.snapshotLength
|
||||||
|
while i < len
|
||||||
|
node = nodes.snapshotItem i++
|
||||||
|
if node instanceof Text
|
||||||
|
text.push node.data
|
||||||
|
else if node instanceof HTMLBRElement
|
||||||
|
text.push '\n'
|
||||||
|
text.join ''
|
||||||
filename: (root) ->
|
filename: (root) ->
|
||||||
if file = $ '.filesize > span', root
|
if file = $ '.filesize > span', root
|
||||||
return file.title
|
return file.title
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user