diff --git a/LICENSE b/LICENSE index e79c58b2d..9ec89a5f9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* appchan x - Version 2.2.2 - 2013-08-06 +* appchan x - Version 2.2.2 - 2013-08-07 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 159f0fbb0..a54e6a059 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() { @@ -1972,7 +1972,7 @@ container = $.el('div', { id: "pc" + postID, className: "postContainer " + (isOP ? 'op' : 'reply') + "Container", - innerHTML: (isOP ? '' : "
>>
") + ("
") + ("
") + ("") + ("" + (name || '') + "") + tripcode + capcodeStart + capcode + userID + flag + sticky + closed + ("
" + subject) + ("
" + date) + ("No.") + ("" + postID + "") + '' + '
' + (isOP ? fileHTML : '') + ("
") + (" ") + ("" + subject + " ") + ("") + emailStart + ("" + (name || '') + "") + tripcode + capcodeStart + emailEnd + capcode + userID + flag + sticky + closed + ' ' + ("" + date + " ") + "" + ("No.") + ("" + postID + "") + '' + '
' + (isOP ? '' : fileHTML) + ("
" + (comment || '') + capcodeReplies + "
") + '
' + innerHTML: "" + (isOP ? '' : "
>>
") + "
" + (name || '') + "" + (tripcode + capcodeStart + capcode + userID + flag + sticky + closed) + "
" + subject + "
" + date + "No." + postID + "
" + (isOP ? fileHTML : '') + "
" + subject + "" + emailStart + "" + (name || '') + "" + (tripcode + capcodeStart + emailEnd + capcode + userID + flag + sticky + closed) + "" + " " + "" + date + "" + " " + "No." + postID + "
" + (isOP ? '' : fileHTML) + "
" + (comment || '') + capcodeReplies + "
" + " " + "
" }); _ref = $$('.quotelink', container); for (_i = 0, _len = _ref.length; _i < _len; _i++) { @@ -2176,32 +2176,7 @@ bq = $.el('blockquote', { textContent: data.comment }); - bq.innerHTML = bq.innerHTML.replace(/\n|\[\/?b\]|\[\/?spoiler\]|\[\/?code\]|\[\/?moot\]|\[\/?banned\]/g, function(text) { - switch (text) { - case '\n': - return '
'; - case '[b]': - return ''; - case '[/b]': - return ''; - case '[spoiler]': - return ''; - case '[/spoiler]': - return ''; - case '[code]': - return '
';
-          case '[/code]':
-            return '
'; - case '[moot]': - return '
'; - case '[/moot]': - return '
'; - case '[banned]': - return ''; - case '[/banned]': - return ''; - } - }); + bq.innerHTML = bq.innerHTML.replace(/\n|\[\/?b\]|\[\/?spoiler\]|\[\/?code\]|\[\/?moot\]|\[\/?banned\]/g, Get.parseMarkup); comment = bq.innerHTML.replace(/(^|>)(>[^<$]*)(<|$)/g, '$1$2$3').replace(/((>){2}(>\/[a-z\d]+\/)?\d+)/g, '$1'); threadID = +data.thread_num; o = { @@ -2251,6 +2226,32 @@ }); Main.callbackNodes(Post, [post]); return Get.insert(post, root, context); + }, + parseMarkup: function(text) { + switch (text) { + case '\n': + return '
'; + case '[b]': + return ''; + case '[/b]': + return ''; + case '[spoiler]': + return ''; + case '[/spoiler]': + return ''; + case '[code]': + return '
';
+        case '[/code]':
+          return '
'; + case '[moot]': + return '
'; + case '[/moot]': + return '
'; + case '[banned]': + return ''; + case '[/banned]': + return ''; + } } }; diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 31e245ca7..2bc9afc9d 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -18,7 +18,7 @@ // ==/UserScript== /* -* appchan x - Version 2.2.2 - 2013-08-06 +* appchan x - Version 2.2.2 - 2013-08-07 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -2908,7 +2908,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) { @@ -3320,21 +3320,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() { @@ -4268,7 +4268,7 @@ container = $.el('div', { id: "pc" + postID, className: "postContainer " + (isOP ? 'op' : 'reply') + "Container", - innerHTML: (isOP ? '' : "
>>
") + ("
") + ("
") + ("") + ("" + (name || '') + "") + tripcode + capcodeStart + capcode + userID + flag + sticky + closed + ("
" + subject) + ("
" + date) + ("No.") + ("" + postID + "") + '' + '
' + (isOP ? fileHTML : '') + ("
") + (" ") + ("" + subject + " ") + ("") + emailStart + ("" + (name || '') + "") + tripcode + capcodeStart + emailEnd + capcode + userID + flag + sticky + closed + ' ' + ("" + date + " ") + "" + ("No.") + ("" + postID + "") + '' + '
' + (isOP ? '' : fileHTML) + ("
" + (comment || '') + capcodeReplies + "
") + '
' + innerHTML: "" + (isOP ? '' : "
>>
") + "
" + (name || '') + "" + (tripcode + capcodeStart + capcode + userID + flag + sticky + closed) + "
" + subject + "
" + date + "No." + postID + "
" + (isOP ? fileHTML : '') + "
" + subject + "" + emailStart + "" + (name || '') + "" + (tripcode + capcodeStart + emailEnd + capcode + userID + flag + sticky + closed) + "" + " " + "" + date + "" + " " + "No." + postID + "
" + (isOP ? '' : fileHTML) + "
" + (comment || '') + capcodeReplies + "
" + " " + "
" }); _ref = $$('.quotelink', container); for (_i = 0, _len = _ref.length; _i < _len; _i++) { @@ -4472,32 +4472,7 @@ bq = $.el('blockquote', { textContent: data.comment }); - bq.innerHTML = bq.innerHTML.replace(/\n|\[\/?b\]|\[\/?spoiler\]|\[\/?code\]|\[\/?moot\]|\[\/?banned\]/g, function(text) { - switch (text) { - case '\n': - return '
'; - case '[b]': - return ''; - case '[/b]': - return ''; - case '[spoiler]': - return ''; - case '[/spoiler]': - return ''; - case '[code]': - return '
';
-          case '[/code]':
-            return '
'; - case '[moot]': - return '
'; - case '[/moot]': - return '
'; - case '[banned]': - return ''; - case '[/banned]': - return ''; - } - }); + bq.innerHTML = bq.innerHTML.replace(/\n|\[\/?b\]|\[\/?spoiler\]|\[\/?code\]|\[\/?moot\]|\[\/?banned\]/g, Get.parseMarkup); comment = bq.innerHTML.replace(/(^|>)(>[^<$]*)(<|$)/g, '$1$2$3').replace(/((>){2}(>\/[a-z\d]+\/)?\d+)/g, '$1'); threadID = +data.thread_num; o = { @@ -4547,6 +4522,32 @@ }); Main.callbackNodes(Post, [post]); return Get.insert(post, root, context); + }, + parseMarkup: function(text) { + switch (text) { + case '\n': + return '
'; + case '[b]': + return ''; + case '[/b]': + return ''; + case '[spoiler]': + return ''; + case '[/spoiler]': + return ''; + case '[code]': + return '
';
+        case '[/code]':
+          return '
'; + case '[moot]': + return '
'; + case '[/moot]': + return '
'; + case '[banned]': + return ''; + case '[/banned]': + return ''; + } } }; diff --git a/builds/crx/script.js b/builds/crx/script.js index 13aa896a0..4ea3212e8 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* appchan x - Version 2.2.2 - 2013-08-06 +* appchan x - Version 2.2.2 - 2013-08-07 * * Licensed under the MIT license. * https://github.com/zixaphir/appchan-x/blob/master/LICENSE @@ -2891,7 +2891,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) { @@ -3333,21 +3333,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() { @@ -4282,7 +4282,7 @@ container = $.el('div', { id: "pc" + postID, className: "postContainer " + (isOP ? 'op' : 'reply') + "Container", - innerHTML: (isOP ? '' : "
>>
") + ("
") + ("
") + ("") + ("" + (name || '') + "") + tripcode + capcodeStart + capcode + userID + flag + sticky + closed + ("
" + subject) + ("
" + date) + ("No.") + ("" + postID + "") + '' + '
' + (isOP ? fileHTML : '') + ("
") + (" ") + ("" + subject + " ") + ("") + emailStart + ("" + (name || '') + "") + tripcode + capcodeStart + emailEnd + capcode + userID + flag + sticky + closed + ' ' + ("" + date + " ") + "" + ("No.") + ("" + postID + "") + '' + '
' + (isOP ? '' : fileHTML) + ("
" + (comment || '') + capcodeReplies + "
") + '
' + innerHTML: "" + (isOP ? '' : "
>>
") + "
" + (name || '') + "" + (tripcode + capcodeStart + capcode + userID + flag + sticky + closed) + "
" + subject + "
" + date + "No." + postID + "
" + (isOP ? fileHTML : '') + "
" + subject + "" + emailStart + "" + (name || '') + "" + (tripcode + capcodeStart + emailEnd + capcode + userID + flag + sticky + closed) + "" + " " + "" + date + "" + " " + "No." + postID + "
" + (isOP ? '' : fileHTML) + "
" + (comment || '') + capcodeReplies + "
" + " " + "
" }); _ref = $$('.quotelink', container); for (_i = 0, _len = _ref.length; _i < _len; _i++) { @@ -4486,32 +4486,7 @@ bq = $.el('blockquote', { textContent: data.comment }); - bq.innerHTML = bq.innerHTML.replace(/\n|\[\/?b\]|\[\/?spoiler\]|\[\/?code\]|\[\/?moot\]|\[\/?banned\]/g, function(text) { - switch (text) { - case '\n': - return '
'; - case '[b]': - return ''; - case '[/b]': - return ''; - case '[spoiler]': - return ''; - case '[/spoiler]': - return ''; - case '[code]': - return '
';
-          case '[/code]':
-            return '
'; - case '[moot]': - return '
'; - case '[/moot]': - return '
'; - case '[banned]': - return ''; - case '[/banned]': - return ''; - } - }); + bq.innerHTML = bq.innerHTML.replace(/\n|\[\/?b\]|\[\/?spoiler\]|\[\/?code\]|\[\/?moot\]|\[\/?banned\]/g, Get.parseMarkup); comment = bq.innerHTML.replace(/(^|>)(>[^<$]*)(<|$)/g, '$1$2$3').replace(/((>){2}(>\/[a-z\d]+\/)?\d+)/g, '$1'); threadID = +data.thread_num; o = { @@ -4561,6 +4536,32 @@ }); Main.callbackNodes(Post, [post]); return Get.insert(post, root, context); + }, + parseMarkup: function(text) { + switch (text) { + case '\n': + return '
'; + case '[b]': + return ''; + case '[/b]': + return ''; + case '[spoiler]': + return ''; + case '[/spoiler]': + return ''; + case '[code]': + return '
';
+        case '[/code]':
+          return '
'; + case '[moot]': + return '
'; + case '[/moot]': + return '
'; + case '[banned]': + return ''; + case '[/banned]': + return ''; + } } }; diff --git a/src/General/Build.coffee b/src/General/Build.coffee index bb0903db1..cd4f73e01 100644 --- a/src/General/Build.coffee +++ b/src/General/Build.coffee @@ -214,58 +214,7 @@ Build = container = $.el 'div', id: "pc#{postID}" className: "postContainer #{if isOP then 'op' else 'reply'}Container" - innerHTML: \ - (if isOP then '' else "
>>
") + - "
" + - - "
" + - "" + - "#{name or ''}" + tripcode + - capcodeStart + capcode + userID + flag + sticky + closed + - "
#{subject}" + - "
#{date}" + - "No." + - "#{postID}" + - '' + - '
' + - - (if isOP then fileHTML else '') + - - "
" + - " " + - "#{subject} " + - "" + - emailStart + - "#{name or ''}" + tripcode + - capcodeStart + emailEnd + capcode + userID + flag + sticky + closed + - ' ' + - "#{date} " + - "" + - "No." + - "#{postID}" + - '' + - '
' + - - (if isOP then '' else fileHTML) + - - "
#{comment or ''}#{capcodeReplies}
" + - - '
' + innerHTML: <%= grunt.file.read('src/General/html/Build/post.html').replace(/>\s+/g, '>').replace(/\s+ for quote in $$ '.quotelink', container href = quote.getAttribute 'href' diff --git a/src/General/Get.coffee b/src/General/Get.coffee index a5c1a54c1..50d32684b 100644 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -153,30 +153,7 @@ Get = | \[/?code\] | \[/?moot\] | \[/?banned\] - ///g, (text) -> - switch text - when '\n' - '
' - when '[b]' - '' - when '[/b]' - '' - when '[spoiler]' - '' - when '[/spoiler]' - '' - when '[code]' - '
'
-          when '[/code]'
-            '
' - when '[moot]' - '
' - when '[/moot]' - '
' - when '[banned]' - '' - when '[/banned]' - '' + ///g, Get.parseMarkup comment = bq.innerHTML # greentext @@ -228,3 +205,27 @@ Get = isArchived: true Main.callbackNodes Post, [post] Get.insert post, root, context + parseMarkup: (text) -> + switch text + when '\n' + '
' + when '[b]' + '' + when '[/b]' + '' + when '[spoiler]' + '' + when '[/spoiler]' + '' + when '[code]' + '
'
+      when '[/code]'
+        '
' + when '[moot]' + '
' + when '[/moot]' + '
' + when '[banned]' + '' + when '[/banned]' + '' \ No newline at end of file diff --git a/src/General/html/Build/post.html b/src/General/html/Build/post.html new file mode 100644 index 000000000..cf833ebdd --- /dev/null +++ b/src/General/html/Build/post.html @@ -0,0 +1,59 @@ +"""#{if isOP then '' else "
>>
"} +
+ +
+ + + #{name or ''} + + #{tripcode + capcodeStart + capcode + userID + flag + sticky + closed} +
#{subject} +
+ + #{date} + + No. + + + #{postID} + + +
+ + #{if isOP then fileHTML else ''} + +
+ + #{subject} + + #{emailStart} + #{name or ''} + #{tripcode + capcodeStart + emailEnd + capcode + userID + flag + sticky + closed} + #{" "} + #{date}#{" "} + + No. + #{postID} + +
+ + #{if isOP then '' else fileHTML} + +
#{comment or ''}#{capcodeReplies}
#{" "} + +
""" \ No newline at end of file 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..ee4391bbf 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 = []