Lets not even bother linkifying a comment with no links.
Also switch out some loops.
This commit is contained in:
parent
6bb31cc845
commit
61e1447a5f
2
LICENSE
2
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.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.4.1 - 2014-03-11
|
* 4chan X - Version 1.4.1 - 2014-03-12
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||||
@ -3282,12 +3282,12 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
buildThreads: function() {
|
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 = [];
|
threads = [];
|
||||||
posts = [];
|
posts = [];
|
||||||
_ref = Index.liveThreadData;
|
i = 0;
|
||||||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
|
liveThreadData = Index.liveThreadData;
|
||||||
threadData = _ref[i];
|
while (threadData = liveThreadData[i]) {
|
||||||
threadRoot = Build.thread(g.BOARD, threadData);
|
threadRoot = Build.thread(g.BOARD, threadData);
|
||||||
if (thread = g.BOARD.threads[threadData.no]) {
|
if (thread = g.BOARD.threads[threadData.no]) {
|
||||||
thread.setPage(Math.floor(i / Index.threadsNumPerPage));
|
thread.setPage(Math.floor(i / Index.threadsNumPerPage));
|
||||||
@ -3299,6 +3299,7 @@
|
|||||||
thread = new Thread(threadData.no, g.BOARD);
|
thread = new Thread(threadData.no, g.BOARD);
|
||||||
threads.push(thread);
|
threads.push(thread);
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
if (thread.ID in thread.posts) {
|
if (thread.ID in thread.posts) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3323,15 +3324,6 @@
|
|||||||
Index.updateHideLabel();
|
Index.updateHideLabel();
|
||||||
return $.event('IndexRefresh');
|
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) {
|
buildReplies: function(threads) {
|
||||||
var data, err, errors, i, lastReplies, node, nodes, post, posts, thread, _i, _j, _len, _len1;
|
var data, err, errors, i, lastReplies, node, nodes, post, posts, thread, _i, _j, _len, _len1;
|
||||||
if (!Conf['Show Replies']) {
|
if (!Conf['Show Replies']) {
|
||||||
@ -3489,7 +3481,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
buildIndex: function(infinite) {
|
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']) {
|
switch (Conf['Index Mode']) {
|
||||||
case 'paged':
|
case 'paged':
|
||||||
case 'infinite':
|
case 'infinite':
|
||||||
@ -3499,14 +3492,15 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
threadsPerPage = Index.getThreadsNumPerPage();
|
threadsPerPage = Index.getThreadsNumPerPage();
|
||||||
threads = Index.sortedThreads.slice(threadsPerPage * pageNum, threadsPerPage * (pageNum + 1));
|
|
||||||
nodes = [];
|
nodes = [];
|
||||||
for (_i = 0, _len = threads.length; _i < _len; _i++) {
|
threads = [];
|
||||||
thread = threads[_i];
|
i = threadsPerPage * pageNum;
|
||||||
nodes.push(thread.OP.nodes.root.parentNode);
|
max = i + threadsPerPage;
|
||||||
|
while (i < max) {
|
||||||
|
threads.push(thread = sortedThreads[i++]);
|
||||||
|
nodes.push(thread.OP.nodes.root.parentNode, $.el('hr'));
|
||||||
}
|
}
|
||||||
Index.buildReplies(threads);
|
Index.buildReplies(threads);
|
||||||
nodes = Index.buildHRs(nodes);
|
|
||||||
Index.buildPagelist();
|
Index.buildPagelist();
|
||||||
Index.setPage();
|
Index.setPage();
|
||||||
break;
|
break;
|
||||||
@ -3516,13 +3510,11 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nodes = [];
|
nodes = [];
|
||||||
_ref = Index.sortedThreads;
|
i = 0;
|
||||||
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
|
while (thread = sortedThreads[i++]) {
|
||||||
thread = _ref[_j];
|
nodes.push(thread.OP.nodes.root.parentNode, $.el('hr'));
|
||||||
nodes.push(thread.OP.nodes.root.parentNode);
|
|
||||||
}
|
}
|
||||||
Index.buildReplies(Index.sortedThreads);
|
Index.buildReplies(sortedThreads);
|
||||||
nodes = Index.buildHRs(nodes);
|
|
||||||
}
|
}
|
||||||
if (!infinite) {
|
if (!infinite) {
|
||||||
$.rmAll(Index.root);
|
$.rmAll(Index.root);
|
||||||
@ -8471,6 +8463,9 @@
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!Linkify.regString.test(this.info.comment)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
test = /[^\s'"]+/g;
|
test = /[^\s'"]+/g;
|
||||||
space = /[\s'"]/;
|
space = /[\s'"]/;
|
||||||
snapshot = $.X('.//br|.//text()', this.nodes.comment);
|
snapshot = $.X('.//br|.//text()', this.nodes.comment);
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// Generated by CoffeeScript
|
// 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.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
|
||||||
@ -3341,12 +3341,12 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
buildThreads: function() {
|
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 = [];
|
threads = [];
|
||||||
posts = [];
|
posts = [];
|
||||||
_ref = Index.liveThreadData;
|
i = 0;
|
||||||
for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) {
|
liveThreadData = Index.liveThreadData;
|
||||||
threadData = _ref[i];
|
while (threadData = liveThreadData[i]) {
|
||||||
threadRoot = Build.thread(g.BOARD, threadData);
|
threadRoot = Build.thread(g.BOARD, threadData);
|
||||||
if (thread = g.BOARD.threads[threadData.no]) {
|
if (thread = g.BOARD.threads[threadData.no]) {
|
||||||
thread.setPage(Math.floor(i / Index.threadsNumPerPage));
|
thread.setPage(Math.floor(i / Index.threadsNumPerPage));
|
||||||
@ -3358,6 +3358,7 @@
|
|||||||
thread = new Thread(threadData.no, g.BOARD);
|
thread = new Thread(threadData.no, g.BOARD);
|
||||||
threads.push(thread);
|
threads.push(thread);
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
if (thread.ID in thread.posts) {
|
if (thread.ID in thread.posts) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3382,15 +3383,6 @@
|
|||||||
Index.updateHideLabel();
|
Index.updateHideLabel();
|
||||||
return $.event('IndexRefresh');
|
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) {
|
buildReplies: function(threads) {
|
||||||
var data, err, errors, i, lastReplies, node, nodes, post, posts, thread, _i, _j, _len, _len1;
|
var data, err, errors, i, lastReplies, node, nodes, post, posts, thread, _i, _j, _len, _len1;
|
||||||
if (!Conf['Show Replies']) {
|
if (!Conf['Show Replies']) {
|
||||||
@ -3548,7 +3540,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
buildIndex: function(infinite) {
|
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']) {
|
switch (Conf['Index Mode']) {
|
||||||
case 'paged':
|
case 'paged':
|
||||||
case 'infinite':
|
case 'infinite':
|
||||||
@ -3558,14 +3551,15 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
threadsPerPage = Index.getThreadsNumPerPage();
|
threadsPerPage = Index.getThreadsNumPerPage();
|
||||||
threads = Index.sortedThreads.slice(threadsPerPage * pageNum, threadsPerPage * (pageNum + 1));
|
|
||||||
nodes = [];
|
nodes = [];
|
||||||
for (_i = 0, _len = threads.length; _i < _len; _i++) {
|
threads = [];
|
||||||
thread = threads[_i];
|
i = threadsPerPage * pageNum;
|
||||||
nodes.push(thread.OP.nodes.root.parentNode);
|
max = i + threadsPerPage;
|
||||||
|
while (i < max) {
|
||||||
|
threads.push(thread = sortedThreads[i++]);
|
||||||
|
nodes.push(thread.OP.nodes.root.parentNode, $.el('hr'));
|
||||||
}
|
}
|
||||||
Index.buildReplies(threads);
|
Index.buildReplies(threads);
|
||||||
nodes = Index.buildHRs(nodes);
|
|
||||||
Index.buildPagelist();
|
Index.buildPagelist();
|
||||||
Index.setPage();
|
Index.setPage();
|
||||||
break;
|
break;
|
||||||
@ -3575,13 +3569,11 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
nodes = [];
|
nodes = [];
|
||||||
_ref = Index.sortedThreads;
|
i = 0;
|
||||||
for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) {
|
while (thread = sortedThreads[i++]) {
|
||||||
thread = _ref[_j];
|
nodes.push(thread.OP.nodes.root.parentNode, $.el('hr'));
|
||||||
nodes.push(thread.OP.nodes.root.parentNode);
|
|
||||||
}
|
}
|
||||||
Index.buildReplies(Index.sortedThreads);
|
Index.buildReplies(sortedThreads);
|
||||||
nodes = Index.buildHRs(nodes);
|
|
||||||
}
|
}
|
||||||
if (!infinite) {
|
if (!infinite) {
|
||||||
$.rmAll(Index.root);
|
$.rmAll(Index.root);
|
||||||
@ -8486,6 +8478,9 @@
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!Linkify.regString.test(this.info.comment)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
test = /[^\s'"]+/g;
|
test = /[^\s'"]+/g;
|
||||||
space = /[\s'"]/;
|
space = /[\s'"]/;
|
||||||
snapshot = $.X('.//br|.//text()', this.nodes.comment);
|
snapshot = $.X('.//br|.//text()', this.nodes.comment);
|
||||||
|
|||||||
@ -591,7 +591,9 @@ Index =
|
|||||||
buildThreads: ->
|
buildThreads: ->
|
||||||
threads = []
|
threads = []
|
||||||
posts = []
|
posts = []
|
||||||
for threadData, i in Index.liveThreadData
|
i = 0
|
||||||
|
{liveThreadData} = Index
|
||||||
|
while threadData = liveThreadData[i]
|
||||||
threadRoot = Build.thread g.BOARD, threadData
|
threadRoot = Build.thread g.BOARD, threadData
|
||||||
if thread = g.BOARD.threads[threadData.no]
|
if thread = g.BOARD.threads[threadData.no]
|
||||||
thread.setPage i // Index.threadsNumPerPage
|
thread.setPage i // Index.threadsNumPerPage
|
||||||
@ -602,6 +604,7 @@ Index =
|
|||||||
else
|
else
|
||||||
thread = new Thread threadData.no, g.BOARD
|
thread = new Thread threadData.no, g.BOARD
|
||||||
threads.push thread
|
threads.push thread
|
||||||
|
i++
|
||||||
continue if thread.ID of thread.posts
|
continue if thread.ID of thread.posts
|
||||||
try
|
try
|
||||||
posts.push new Post $('.opContainer', threadRoot), thread, g.BOARD
|
posts.push new Post $('.opContainer', threadRoot), thread, g.BOARD
|
||||||
@ -618,13 +621,6 @@ Index =
|
|||||||
Index.updateHideLabel()
|
Index.updateHideLabel()
|
||||||
$.event 'IndexRefresh'
|
$.event 'IndexRefresh'
|
||||||
|
|
||||||
buildHRs: (threadRoots) ->
|
|
||||||
nodes = []
|
|
||||||
i = 0
|
|
||||||
while node = threadRoots[i++]
|
|
||||||
nodes.push node, $.el 'hr'
|
|
||||||
nodes
|
|
||||||
|
|
||||||
buildReplies: (threads) ->
|
buildReplies: (threads) ->
|
||||||
return unless Conf['Show Replies']
|
return unless Conf['Show Replies']
|
||||||
posts = []
|
posts = []
|
||||||
@ -728,6 +724,7 @@ Index =
|
|||||||
return
|
return
|
||||||
|
|
||||||
buildIndex: (infinite) ->
|
buildIndex: (infinite) ->
|
||||||
|
{sortedThreads} = Index
|
||||||
switch Conf['Index Mode']
|
switch Conf['Index Mode']
|
||||||
when 'paged', 'infinite'
|
when 'paged', 'infinite'
|
||||||
pageNum = Index.getCurrentPage()
|
pageNum = Index.getCurrentPage()
|
||||||
@ -736,21 +733,29 @@ Index =
|
|||||||
Index.pageNav Index.getMaxPageNum()
|
Index.pageNav Index.getMaxPageNum()
|
||||||
return
|
return
|
||||||
threadsPerPage = Index.getThreadsNumPerPage()
|
threadsPerPage = Index.getThreadsNumPerPage()
|
||||||
threads = Index.sortedThreads[threadsPerPage * pageNum ... threadsPerPage * (pageNum + 1)]
|
|
||||||
nodes = []
|
nodes = []
|
||||||
nodes.push thread.OP.nodes.root.parentNode for thread in threads
|
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
|
Index.buildReplies threads
|
||||||
nodes = Index.buildHRs nodes
|
|
||||||
Index.buildPagelist()
|
Index.buildPagelist()
|
||||||
Index.setPage()
|
Index.setPage()
|
||||||
|
|
||||||
when 'catalog'
|
when 'catalog'
|
||||||
nodes = Index.buildCatalogViews()
|
nodes = Index.buildCatalogViews()
|
||||||
Index.sizeCatalogViews nodes
|
Index.sizeCatalogViews nodes
|
||||||
|
|
||||||
else
|
else
|
||||||
nodes = []
|
nodes = []
|
||||||
nodes.push thread.OP.nodes.root.parentNode for thread in Index.sortedThreads
|
i = 0
|
||||||
Index.buildReplies Index.sortedThreads
|
while thread = sortedThreads[i++]
|
||||||
nodes = Index.buildHRs nodes
|
nodes.push thread.OP.nodes.root.parentNode, $.el 'hr'
|
||||||
|
Index.buildReplies sortedThreads
|
||||||
$.rmAll Index.root unless infinite
|
$.rmAll Index.root unless infinite
|
||||||
$.add Index.root, nodes
|
$.add Index.root, nodes
|
||||||
$.event 'IndexBuild', nodes
|
$.event 'IndexBuild', nodes
|
||||||
|
|||||||
@ -23,6 +23,8 @@ Linkify =
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
return unless Linkify.regString.test @info.comment
|
||||||
|
|
||||||
test = /[^\s'"]+/g
|
test = /[^\s'"]+/g
|
||||||
space = /[\s'"]/
|
space = /[\s'"]/
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user