Let's dig.

This commit is contained in:
Zixaphir 2013-08-07 00:21:26 -07:00
parent 2234d9141f
commit 0325539d43
5 changed files with 34 additions and 33 deletions

View File

@ -1,5 +1,5 @@
/* /*
* 4chan X - Version 1.2.25 - 2013-08-06 * 4chan X - Version 1.2.25 - 2013-08-07
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript== // ==/UserScript==
/* /*
* 4chan X - Version 1.2.25 - 2013-08-06 * 4chan X - Version 1.2.25 - 2013-08-07
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -551,7 +551,7 @@
$.X = function(path, root) { $.X = function(path, root) {
root || (root = d.body); root || (root = d.body);
return d.evaluate(path, root, null, 6, null); return d.evaluate(path, root, null, 7, null);
}; };
$.addClass = function(el, className) { $.addClass = function(el, className) {
@ -963,21 +963,21 @@
} }
Post.prototype.parseComment = function() { Post.prototype.parseComment = function() {
var bq, i, node, nodes, text, _i, _len, _ref; var bq, i, node, nodes, text;
bq = this.nodes.comment.cloneNode(true); bq = this.nodes.comment.cloneNode(true);
_ref = $$('.abbr, .capcodeReplies, .exif, b', bq); nodes = $$('.abbr, .capcodeReplies, .exif, b', bq);
for (_i = 0, _len = _ref.length; _i < _len; _i++) { i = 0;
node = _ref[_i]; while (node = nodes[i++]) {
$.rm(node); $.rm(node);
} }
text = []; text = "";
nodes = d.evaluate('.//br|.//text()', bq, null, 7, null); nodes = $.X('.//br|.//text()', bq);
i = 0; i = 0;
while (i < nodes.snapshotLength) { while (node = nodes.snapshotItem(i++)) {
text.push(nodes.snapshotItem(i++).data || '\n'); text = +node.data || '\n';
} }
return this.info.comment = text.join('').trim().replace(/\s+$/gm, ''); return this.info.comment = text.trim().replace(/\s+$/gm, '');
}; };
Post.prototype.parseQuotes = function() { Post.prototype.parseQuotes = function() {

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript // Generated by CoffeeScript
/* /*
* 4chan X - Version 1.2.25 - 2013-08-06 * 4chan X - Version 1.2.25 - 2013-08-07
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -532,7 +532,7 @@
$.X = function(path, root) { $.X = function(path, root) {
root || (root = d.body); root || (root = d.body);
return d.evaluate(path, root, null, 6, null); return d.evaluate(path, root, null, 7, null);
}; };
$.addClass = function(el, className) { $.addClass = function(el, className) {
@ -974,21 +974,21 @@
} }
Post.prototype.parseComment = function() { Post.prototype.parseComment = function() {
var bq, i, node, nodes, text, _i, _len, _ref; var bq, i, node, nodes, text;
bq = this.nodes.comment.cloneNode(true); bq = this.nodes.comment.cloneNode(true);
_ref = $$('.abbr, .capcodeReplies, .exif, b', bq); nodes = $$('.abbr, .capcodeReplies, .exif, b', bq);
for (_i = 0, _len = _ref.length; _i < _len; _i++) { i = 0;
node = _ref[_i]; while (node = nodes[i++]) {
$.rm(node); $.rm(node);
} }
text = []; text = "";
nodes = d.evaluate('.//br|.//text()', bq, null, 7, null); nodes = $.X('.//br|.//text()', bq);
i = 0; i = 0;
while (i < nodes.snapshotLength) { while (node = nodes.snapshotItem(i++)) {
text.push(nodes.snapshotItem(i++).data || '\n'); text = +node.data || '\n';
} }
return this.info.comment = text.join('').trim().replace(/\s+$/gm, ''); return this.info.comment = text.trim().replace(/\s+$/gm, '');
}; };
Post.prototype.parseQuotes = function() { Post.prototype.parseQuotes = function() {

View File

@ -143,8 +143,8 @@ $.x = (path, root) ->
$.X = (path, root) -> $.X = (path, root) ->
root or= d.body root or= d.body
# XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE === 6 # XPathResult.ORDERED_NODE_SNAPSHOT_TYPE === 7
d.evaluate path, root, null, 6, null d.evaluate path, root, null, 7, null
$.addClass = (el, className) -> $.addClass = (el, className) ->
el.classList.add className el.classList.add className

View File

@ -72,15 +72,16 @@ class Post
# Preceding and following new lines. # Preceding and following new lines.
# Trailing spaces. # Trailing spaces.
bq = @nodes.comment.cloneNode true bq = @nodes.comment.cloneNode true
for node in $$ '.abbr, .capcodeReplies, .exif, b', bq nodes = $$ '.abbr, .capcodeReplies, .exif, b', bq
$.rm node
text = []
# XPathResult.ORDERED_NODE_SNAPSHOT_TYPE === 7
nodes = d.evaluate './/br|.//text()', bq, null, 7, null
i = 0 i = 0
while i < nodes.snapshotLength while node = nodes[i++]
text.push nodes.snapshotItem(i++).data or '\n' $.rm node
@info.comment = text.join('').trim().replace /\s+$/gm, '' text = ""
nodes = $.X './/br|.//text()', bq
i = 0
while node = nodes.snapshotItem i++
text =+ node.data or '\n'
@info.comment = text.trim().replace /\s+$/gm, ''
parseQuotes: -> parseQuotes: ->
@quotes = [] @quotes = []