diff --git a/LICENSE b/LICENSE index d45e0ed08..3b09fb3c0 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.4.1 - 2014-03-11 +* 4chan X - Version 1.4.1 - 2014-03-12 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 253b789a4..23c43b528 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.4.1 - 2014-03-11 +* 4chan X - Version 1.4.1 - 2014-03-12 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -3282,12 +3282,12 @@ }); }, buildThreads: function() { - var err, errors, i, posts, thread, threadData, threadRoot, threads, _i, _len, _ref; + var err, errors, i, liveThreadData, posts, thread, threadData, threadRoot, threads; threads = []; posts = []; - _ref = Index.liveThreadData; - for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { - threadData = _ref[i]; + i = 0; + liveThreadData = Index.liveThreadData; + while (threadData = liveThreadData[i]) { threadRoot = Build.thread(g.BOARD, threadData); if (thread = g.BOARD.threads[threadData.no]) { thread.setPage(Math.floor(i / Index.threadsNumPerPage)); @@ -3299,6 +3299,7 @@ thread = new Thread(threadData.no, g.BOARD); threads.push(thread); } + i++; if (thread.ID in thread.posts) { continue; } @@ -3323,15 +3324,6 @@ Index.updateHideLabel(); return $.event('IndexRefresh'); }, - buildHRs: function(threadRoots) { - var i, node, nodes; - nodes = []; - i = 0; - while (node = threadRoots[i++]) { - nodes.push(node, $.el('hr')); - } - return nodes; - }, buildReplies: function(threads) { var data, err, errors, i, lastReplies, node, nodes, post, posts, thread, _i, _j, _len, _len1; if (!Conf['Show Replies']) { @@ -3489,7 +3481,8 @@ } }, buildIndex: function(infinite) { - var nodes, pageNum, thread, threads, threadsPerPage, _i, _j, _len, _len1, _ref; + var i, max, nodes, pageNum, sortedThreads, thread, threads, threadsPerPage; + sortedThreads = Index.sortedThreads; switch (Conf['Index Mode']) { case 'paged': case 'infinite': @@ -3499,14 +3492,15 @@ return; } threadsPerPage = Index.getThreadsNumPerPage(); - threads = Index.sortedThreads.slice(threadsPerPage * pageNum, threadsPerPage * (pageNum + 1)); nodes = []; - for (_i = 0, _len = threads.length; _i < _len; _i++) { - thread = threads[_i]; - nodes.push(thread.OP.nodes.root.parentNode); + threads = []; + i = threadsPerPage * pageNum; + max = i + threadsPerPage; + while (i < max) { + threads.push(thread = sortedThreads[i++]); + nodes.push(thread.OP.nodes.root.parentNode, $.el('hr')); } Index.buildReplies(threads); - nodes = Index.buildHRs(nodes); Index.buildPagelist(); Index.setPage(); break; @@ -3516,13 +3510,11 @@ break; default: nodes = []; - _ref = Index.sortedThreads; - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - thread = _ref[_j]; - nodes.push(thread.OP.nodes.root.parentNode); + i = 0; + while (thread = sortedThreads[i++]) { + nodes.push(thread.OP.nodes.root.parentNode, $.el('hr')); } - Index.buildReplies(Index.sortedThreads); - nodes = Index.buildHRs(nodes); + Index.buildReplies(sortedThreads); } if (!infinite) { $.rmAll(Index.root); @@ -8471,6 +8463,9 @@ } return; } + if (!Linkify.regString.test(this.info.comment)) { + return; + } test = /[^\s'"]+/g; space = /[\s'"]/; snapshot = $.X('.//br|.//text()', this.nodes.comment); diff --git a/builds/crx/script.js b/builds/crx/script.js index efca1d139..181192ce2 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* 4chan X - Version 1.4.1 - 2014-03-11 +* 4chan X - Version 1.4.1 - 2014-03-12 * * Licensed under the MIT license. * https://github.com/Spittie/4chan-x/blob/master/LICENSE @@ -3341,12 +3341,12 @@ }); }, buildThreads: function() { - var err, errors, i, posts, thread, threadData, threadRoot, threads, _i, _len, _ref; + var err, errors, i, liveThreadData, posts, thread, threadData, threadRoot, threads; threads = []; posts = []; - _ref = Index.liveThreadData; - for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { - threadData = _ref[i]; + i = 0; + liveThreadData = Index.liveThreadData; + while (threadData = liveThreadData[i]) { threadRoot = Build.thread(g.BOARD, threadData); if (thread = g.BOARD.threads[threadData.no]) { thread.setPage(Math.floor(i / Index.threadsNumPerPage)); @@ -3358,6 +3358,7 @@ thread = new Thread(threadData.no, g.BOARD); threads.push(thread); } + i++; if (thread.ID in thread.posts) { continue; } @@ -3382,15 +3383,6 @@ Index.updateHideLabel(); return $.event('IndexRefresh'); }, - buildHRs: function(threadRoots) { - var i, node, nodes; - nodes = []; - i = 0; - while (node = threadRoots[i++]) { - nodes.push(node, $.el('hr')); - } - return nodes; - }, buildReplies: function(threads) { var data, err, errors, i, lastReplies, node, nodes, post, posts, thread, _i, _j, _len, _len1; if (!Conf['Show Replies']) { @@ -3548,7 +3540,8 @@ } }, buildIndex: function(infinite) { - var nodes, pageNum, thread, threads, threadsPerPage, _i, _j, _len, _len1, _ref; + var i, max, nodes, pageNum, sortedThreads, thread, threads, threadsPerPage; + sortedThreads = Index.sortedThreads; switch (Conf['Index Mode']) { case 'paged': case 'infinite': @@ -3558,14 +3551,15 @@ return; } threadsPerPage = Index.getThreadsNumPerPage(); - threads = Index.sortedThreads.slice(threadsPerPage * pageNum, threadsPerPage * (pageNum + 1)); nodes = []; - for (_i = 0, _len = threads.length; _i < _len; _i++) { - thread = threads[_i]; - nodes.push(thread.OP.nodes.root.parentNode); + threads = []; + i = threadsPerPage * pageNum; + max = i + threadsPerPage; + while (i < max) { + threads.push(thread = sortedThreads[i++]); + nodes.push(thread.OP.nodes.root.parentNode, $.el('hr')); } Index.buildReplies(threads); - nodes = Index.buildHRs(nodes); Index.buildPagelist(); Index.setPage(); break; @@ -3575,13 +3569,11 @@ break; default: nodes = []; - _ref = Index.sortedThreads; - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - thread = _ref[_j]; - nodes.push(thread.OP.nodes.root.parentNode); + i = 0; + while (thread = sortedThreads[i++]) { + nodes.push(thread.OP.nodes.root.parentNode, $.el('hr')); } - Index.buildReplies(Index.sortedThreads); - nodes = Index.buildHRs(nodes); + Index.buildReplies(sortedThreads); } if (!infinite) { $.rmAll(Index.root); @@ -8486,6 +8478,9 @@ } return; } + if (!Linkify.regString.test(this.info.comment)) { + return; + } test = /[^\s'"]+/g; space = /[\s'"]/; snapshot = $.X('.//br|.//text()', this.nodes.comment); diff --git a/src/General/Index.coffee b/src/General/Index.coffee index 7db9ae027..df05b06ff 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -591,7 +591,9 @@ Index = buildThreads: -> threads = [] posts = [] - for threadData, i in Index.liveThreadData + i = 0 + {liveThreadData} = Index + while threadData = liveThreadData[i] threadRoot = Build.thread g.BOARD, threadData if thread = g.BOARD.threads[threadData.no] thread.setPage i // Index.threadsNumPerPage @@ -602,6 +604,7 @@ Index = else thread = new Thread threadData.no, g.BOARD threads.push thread + i++ continue if thread.ID of thread.posts try posts.push new Post $('.opContainer', threadRoot), thread, g.BOARD @@ -618,13 +621,6 @@ Index = Index.updateHideLabel() $.event 'IndexRefresh' - buildHRs: (threadRoots) -> - nodes = [] - i = 0 - while node = threadRoots[i++] - nodes.push node, $.el 'hr' - nodes - buildReplies: (threads) -> return unless Conf['Show Replies'] posts = [] @@ -728,6 +724,7 @@ Index = return buildIndex: (infinite) -> + {sortedThreads} = Index switch Conf['Index Mode'] when 'paged', 'infinite' pageNum = Index.getCurrentPage() @@ -736,21 +733,29 @@ Index = Index.pageNav Index.getMaxPageNum() return threadsPerPage = Index.getThreadsNumPerPage() - threads = Index.sortedThreads[threadsPerPage * pageNum ... threadsPerPage * (pageNum + 1)] - nodes = [] - nodes.push thread.OP.nodes.root.parentNode for thread in threads + + nodes = [] + threads = [] + i = threadsPerPage * pageNum + max = i + threadsPerPage + while i < max + threads.push thread = sortedThreads[i++] + nodes.push thread.OP.nodes.root.parentNode, $.el 'hr' + Index.buildReplies threads - nodes = Index.buildHRs nodes Index.buildPagelist() Index.setPage() + when 'catalog' nodes = Index.buildCatalogViews() Index.sizeCatalogViews nodes + else nodes = [] - nodes.push thread.OP.nodes.root.parentNode for thread in Index.sortedThreads - Index.buildReplies Index.sortedThreads - nodes = Index.buildHRs nodes + i = 0 + while thread = sortedThreads[i++] + nodes.push thread.OP.nodes.root.parentNode, $.el 'hr' + Index.buildReplies sortedThreads $.rmAll Index.root unless infinite $.add Index.root, nodes $.event 'IndexBuild', nodes diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index 40591369f..8f6aa1e61 100755 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -23,6 +23,8 @@ Linkify = return + return unless Linkify.regString.test @info.comment + test = /[^\s'"]+/g space = /[\s'"]/