From 0325539d43ed79e06eb5256c49668291c3ea4382 Mon Sep 17 00:00:00 2001 From: Zixaphir Date: Wed, 7 Aug 2013 00:21:26 -0700 Subject: [PATCH] Let's dig. --- LICENSE | 2 +- builds/4chan-X.user.js | 22 +++++++++++----------- builds/crx/script.js | 22 +++++++++++----------- src/General/lib/$.coffee | 4 ++-- src/General/lib/post.class | 17 +++++++++-------- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/LICENSE b/LICENSE index 43b9ec419..c83c43ea3 100644 --- a/LICENSE +++ b/LICENSE @@ -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. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 159f0fbb0..e19d45057 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -19,7 +19,7 @@ // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC // ==/UserScript== /* -* 4chan X - Version 1.2.25 - 2013-08-06 +* 4chan X - Version 1.2.25 - 2013-08-07 * * Licensed under the MIT license. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -551,7 +551,7 @@ $.X = function(path, root) { root || (root = d.body); - return d.evaluate(path, root, null, 6, null); + return d.evaluate(path, root, null, 7, null); }; $.addClass = function(el, className) { @@ -963,21 +963,21 @@ } 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); - _ref = $$('.abbr, .capcodeReplies, .exif, b', bq); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - node = _ref[_i]; + nodes = $$('.abbr, .capcodeReplies, .exif, b', bq); + i = 0; + while (node = nodes[i++]) { $.rm(node); } - text = []; - nodes = d.evaluate('.//br|.//text()', bq, null, 7, null); + text = ""; + nodes = $.X('.//br|.//text()', bq); i = 0; - while (i < nodes.snapshotLength) { - text.push(nodes.snapshotItem(i++).data || '\n'); + while (node = nodes.snapshotItem(i++)) { + 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() { diff --git a/builds/crx/script.js b/builds/crx/script.js index d191b5e49..5e80d1718 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // 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. * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE @@ -532,7 +532,7 @@ $.X = function(path, root) { root || (root = d.body); - return d.evaluate(path, root, null, 6, null); + return d.evaluate(path, root, null, 7, null); }; $.addClass = function(el, className) { @@ -974,21 +974,21 @@ } 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); - _ref = $$('.abbr, .capcodeReplies, .exif, b', bq); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - node = _ref[_i]; + nodes = $$('.abbr, .capcodeReplies, .exif, b', bq); + i = 0; + while (node = nodes[i++]) { $.rm(node); } - text = []; - nodes = d.evaluate('.//br|.//text()', bq, null, 7, null); + text = ""; + nodes = $.X('.//br|.//text()', bq); i = 0; - while (i < nodes.snapshotLength) { - text.push(nodes.snapshotItem(i++).data || '\n'); + while (node = nodes.snapshotItem(i++)) { + 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() { diff --git a/src/General/lib/$.coffee b/src/General/lib/$.coffee index a9afda0bb..0bdf1df75 100644 --- a/src/General/lib/$.coffee +++ b/src/General/lib/$.coffee @@ -143,8 +143,8 @@ $.x = (path, root) -> $.X = (path, root) -> root or= d.body - # XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE === 6 - d.evaluate path, root, null, 6, null + # XPathResult.ORDERED_NODE_SNAPSHOT_TYPE === 7 + d.evaluate path, root, null, 7, null $.addClass = (el, className) -> el.classList.add className diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 02e9fb9a0..8529473ba 100644 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -72,15 +72,16 @@ class Post # Preceding and following new lines. # Trailing spaces. bq = @nodes.comment.cloneNode true - for node in $$ '.abbr, .capcodeReplies, .exif, b', bq - $.rm node - text = [] - # XPathResult.ORDERED_NODE_SNAPSHOT_TYPE === 7 - nodes = d.evaluate './/br|.//text()', bq, null, 7, null + nodes = $$ '.abbr, .capcodeReplies, .exif, b', bq i = 0 - while i < nodes.snapshotLength - text.push nodes.snapshotItem(i++).data or '\n' - @info.comment = text.join('').trim().replace /\s+$/gm, '' + while node = nodes[i++] + $.rm node + 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: -> @quotes = []