Faster threading.
This commit is contained in:
parent
6c03dfe2ef
commit
311101297c
@ -2218,35 +2218,36 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
threading = {
|
threading = {
|
||||||
init: function() {
|
|
||||||
return threading.thread($('body > form').firstChild);
|
|
||||||
},
|
|
||||||
op: function(node) {
|
op: function(node) {
|
||||||
var op;
|
var nodes, op;
|
||||||
|
nodes = [];
|
||||||
|
while (node.nodeName !== 'BLOCKQUOTE') {
|
||||||
|
nodes.push(node);
|
||||||
|
node = node.nextSibling;
|
||||||
|
}
|
||||||
|
nodes.push(node);
|
||||||
|
node = node.nextSibling;
|
||||||
op = $.el('div', {
|
op = $.el('div', {
|
||||||
className: 'op'
|
className: 'op'
|
||||||
});
|
});
|
||||||
$.before(node, op);
|
$.add(op, nodes);
|
||||||
while (node.nodeName !== 'BLOCKQUOTE') {
|
|
||||||
$.add(op, node);
|
|
||||||
node = op.nextSibling;
|
|
||||||
}
|
|
||||||
$.add(op, node);
|
|
||||||
op.id = $('input', op).name;
|
op.id = $('input', op).name;
|
||||||
return op;
|
return $.before(node, op);
|
||||||
},
|
},
|
||||||
thread: function(node) {
|
thread: function(node) {
|
||||||
var div;
|
var div, nodes;
|
||||||
node = threading.op(node);
|
node = threading.op(node);
|
||||||
if (g.REPLY) return;
|
if (g.REPLY) return;
|
||||||
|
nodes = [];
|
||||||
|
while (node.nodeName !== 'HR') {
|
||||||
|
nodes.push(node);
|
||||||
|
node = node.nextElementSibling;
|
||||||
|
}
|
||||||
div = $.el('div', {
|
div = $.el('div', {
|
||||||
className: 'thread'
|
className: 'thread'
|
||||||
});
|
});
|
||||||
|
$.add(div, nodes);
|
||||||
$.before(node, div);
|
$.before(node, div);
|
||||||
while (node.nodeName !== 'HR') {
|
|
||||||
$.add(div, node);
|
|
||||||
node = div.nextSibling;
|
|
||||||
}
|
|
||||||
node = node.nextElementSibling;
|
node = node.nextElementSibling;
|
||||||
if (!(node.align || node.nodeName === 'CENTER')) {
|
if (!(node.align || node.nodeName === 'CENTER')) {
|
||||||
return threading.thread(node);
|
return threading.thread(node);
|
||||||
@ -3574,7 +3575,8 @@
|
|||||||
if (!$.id('navtopr')) return;
|
if (!$.id('navtopr')) return;
|
||||||
$.addClass(d.body, "chanx_" + (VERSION.match(/\.(\d+)/)[1]));
|
$.addClass(d.body, "chanx_" + (VERSION.match(/\.(\d+)/)[1]));
|
||||||
$.addClass(d.body, engine);
|
$.addClass(d.body, engine);
|
||||||
threading.init();
|
form = $('form[name=delform]');
|
||||||
|
threading.thread(form.firstElementChild);
|
||||||
Favicon.init();
|
Favicon.init();
|
||||||
if (conf['Quick Reply']) qr.init();
|
if (conf['Quick Reply']) qr.init();
|
||||||
if (conf['Image Expansion']) imgExpand.init();
|
if (conf['Image Expansion']) imgExpand.init();
|
||||||
@ -3592,7 +3594,6 @@
|
|||||||
if (conf['Comment Expansion']) expandComment.init();
|
if (conf['Comment Expansion']) expandComment.init();
|
||||||
if (conf['Index Navigation']) nav.init();
|
if (conf['Index Navigation']) nav.init();
|
||||||
}
|
}
|
||||||
form = $('body > form');
|
|
||||||
nodes = $$('.op, a + table', form);
|
nodes = $$('.op, a + table', form);
|
||||||
Main.node(nodes, true);
|
Main.node(nodes, true);
|
||||||
if (MutationObserver = window.WebKitMutationObserver || window.MozMutationObserver || window.OMutationObserver || window.MutationObserver) {
|
if (MutationObserver = window.WebKitMutationObserver || window.MozMutationObserver || window.OMutationObserver || window.MutationObserver) {
|
||||||
|
|||||||
@ -1748,35 +1748,35 @@ options =
|
|||||||
@nextElementSibling.innerHTML = "<img src=#{Favicon.unreadSFW}> <img src=#{Favicon.unreadNSFW}> <img src=#{Favicon.unreadDead}>"
|
@nextElementSibling.innerHTML = "<img src=#{Favicon.unreadSFW}> <img src=#{Favicon.unreadNSFW}> <img src=#{Favicon.unreadDead}>"
|
||||||
|
|
||||||
threading =
|
threading =
|
||||||
init: ->
|
|
||||||
threading.thread $('body > form').firstChild
|
|
||||||
|
|
||||||
op: (node) ->
|
op: (node) ->
|
||||||
|
nodes = []
|
||||||
|
until node.nodeName is 'BLOCKQUOTE'
|
||||||
|
nodes.push node
|
||||||
|
node = node.nextSibling
|
||||||
|
nodes.push node # Add the blockquote.
|
||||||
|
node = node.nextSibling
|
||||||
op = $.el 'div',
|
op = $.el 'div',
|
||||||
className: 'op'
|
className: 'op'
|
||||||
$.before node, op
|
$.add op, nodes
|
||||||
while node.nodeName isnt 'BLOCKQUOTE'
|
|
||||||
$.add op, node
|
|
||||||
node = op.nextSibling
|
|
||||||
$.add op, node #add the blockquote
|
|
||||||
op.id = $('input', op).name
|
op.id = $('input', op).name
|
||||||
op
|
$.before node, op
|
||||||
|
|
||||||
thread: (node) ->
|
thread: (node) ->
|
||||||
node = threading.op node
|
node = threading.op node
|
||||||
|
|
||||||
return if g.REPLY
|
return if g.REPLY
|
||||||
|
|
||||||
|
nodes = []
|
||||||
|
until node.nodeName is 'HR'
|
||||||
|
nodes.push node
|
||||||
|
node = node.nextElementSibling # Skip text nodes.
|
||||||
div = $.el 'div',
|
div = $.el 'div',
|
||||||
className: 'thread'
|
className: 'thread'
|
||||||
|
$.add div, nodes
|
||||||
$.before node, div
|
$.before node, div
|
||||||
|
|
||||||
while node.nodeName isnt 'HR'
|
node = node.nextElementSibling
|
||||||
$.add div, node
|
# {N,}SFW
|
||||||
node = div.nextSibling
|
|
||||||
|
|
||||||
node = node.nextElementSibling #skip text node
|
|
||||||
#{N,}SFW
|
|
||||||
unless node.align or node.nodeName is 'CENTER'
|
unless node.align or node.nodeName is 'CENTER'
|
||||||
threading.thread node
|
threading.thread node
|
||||||
|
|
||||||
@ -2853,7 +2853,8 @@ Main =
|
|||||||
return
|
return
|
||||||
$.addClass d.body, "chanx_#{VERSION.match(/\.(\d+)/)[1]}"
|
$.addClass d.body, "chanx_#{VERSION.match(/\.(\d+)/)[1]}"
|
||||||
$.addClass d.body, engine
|
$.addClass d.body, engine
|
||||||
threading.init()
|
form = $ 'form[name=delform]'
|
||||||
|
threading.thread form.firstElementChild
|
||||||
Favicon.init()
|
Favicon.init()
|
||||||
|
|
||||||
#major features
|
#major features
|
||||||
@ -2899,7 +2900,6 @@ Main =
|
|||||||
nav.init()
|
nav.init()
|
||||||
|
|
||||||
|
|
||||||
form = $ 'body > form'
|
|
||||||
nodes = $$ '.op, a + table', form
|
nodes = $$ '.op, a + table', form
|
||||||
Main.node nodes, true
|
Main.node nodes, true
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user