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