Don't add a class to hidden threads with stubs. This will slightly improve performance for thread id perparsing on board pages.
This commit is contained in:
parent
4db82feca5
commit
42377c69cd
@ -2438,7 +2438,7 @@
|
|||||||
var hiddenThreads, id;
|
var hiddenThreads, id;
|
||||||
hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {});
|
hiddenThreads = $.get("hiddenThreads/" + g.BOARD + "/", {});
|
||||||
id = $('.op', thread).id;
|
id = $('.op', thread).id;
|
||||||
if (thread.hidden || /\bstub\b/.test(thread.className)) {
|
if (thread.hidden || thread.firstChild.className === 'block') {
|
||||||
ThreadHiding.show(thread);
|
ThreadHiding.show(thread);
|
||||||
delete hiddenThreads[id];
|
delete hiddenThreads[id];
|
||||||
} else {
|
} else {
|
||||||
@ -2454,7 +2454,7 @@
|
|||||||
thread.nextSibling.hidden = true;
|
thread.nextSibling.hidden = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (/\bstub\b/.test(thread.className)) return;
|
if (thread.firstChild.className === 'block') return;
|
||||||
num = 0;
|
num = 0;
|
||||||
if (span = $('.omittedposts', thread)) {
|
if (span = $('.omittedposts', thread)) {
|
||||||
num = Number(span.textContent.match(/\d+/)[0]);
|
num = Number(span.textContent.match(/\d+/)[0]);
|
||||||
@ -2474,12 +2474,10 @@
|
|||||||
className: 'block'
|
className: 'block'
|
||||||
});
|
});
|
||||||
$.add(div, a);
|
$.add(div, a);
|
||||||
$.prepend(thread, div);
|
return $.prepend(thread, div);
|
||||||
return $.addClass(thread, 'stub');
|
|
||||||
},
|
},
|
||||||
show: function(thread, id) {
|
show: function(thread, id) {
|
||||||
$.rm($('.block', thread));
|
$.rm($('.block', thread));
|
||||||
$.removeClass(thread, 'stub');
|
|
||||||
thread.hidden = false;
|
thread.hidden = false;
|
||||||
return thread.nextSibling.hidden = false;
|
return thread.nextSibling.hidden = false;
|
||||||
}
|
}
|
||||||
@ -3279,7 +3277,7 @@
|
|||||||
},
|
},
|
||||||
parse: function(req, id, threadID) {
|
parse: function(req, id, threadID) {
|
||||||
var doc, node, post, qp;
|
var doc, node, post, qp;
|
||||||
if (!((qp = ui.el) && qp.innerHTML === ("Loading " + id + "..."))) return;
|
if (!((qp = ui.el) && qp.textContent === ("Loading " + id + "..."))) return;
|
||||||
if (req.status !== 200) {
|
if (req.status !== 200) {
|
||||||
qp.textContent = "" + req.status + " " + req.statusText;
|
qp.textContent = "" + req.status + " " + req.statusText;
|
||||||
return;
|
return;
|
||||||
@ -3958,7 +3956,7 @@
|
|||||||
el: klass === 'op' ? node : node.firstChild.firstChild.lastChild,
|
el: klass === 'op' ? node : node.firstChild.firstChild.lastChild,
|
||||||
"class": klass,
|
"class": klass,
|
||||||
id: node.getElementsByTagName('input')[0].name,
|
id: node.getElementsByTagName('input')[0].name,
|
||||||
threadId: g.THREAD_ID || $.x('ancestor::div[contains(@class,"thread")]', node).firstChild.id,
|
threadId: g.THREAD_ID || $.x('ancestor::div[@class="thread"]', node).firstChild.id,
|
||||||
isOP: klass === 'op',
|
isOP: klass === 'op',
|
||||||
isInlined: /\binline\b/.test(klass),
|
isInlined: /\binline\b/.test(klass),
|
||||||
filesize: node.getElementsByClassName('filesize')[0] || false,
|
filesize: node.getElementsByClassName('filesize')[0] || false,
|
||||||
|
|||||||
@ -2051,7 +2051,7 @@ ThreadHiding =
|
|||||||
toggle: (thread) ->
|
toggle: (thread) ->
|
||||||
hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {}
|
hiddenThreads = $.get "hiddenThreads/#{g.BOARD}/", {}
|
||||||
id = $('.op', thread).id
|
id = $('.op', thread).id
|
||||||
if thread.hidden or /\bstub\b/.test thread.className
|
if thread.hidden or thread.firstChild.className is 'block'
|
||||||
ThreadHiding.show thread
|
ThreadHiding.show thread
|
||||||
delete hiddenThreads[id]
|
delete hiddenThreads[id]
|
||||||
else
|
else
|
||||||
@ -2065,7 +2065,7 @@ ThreadHiding =
|
|||||||
thread.nextSibling.hidden = true
|
thread.nextSibling.hidden = true
|
||||||
return
|
return
|
||||||
|
|
||||||
return if /\bstub\b/.test thread.className # already hidden by filter
|
return if thread.firstChild.className is 'block' # already hidden by filter
|
||||||
|
|
||||||
num = 0
|
num = 0
|
||||||
if span = $ '.omittedposts', thread
|
if span = $ '.omittedposts', thread
|
||||||
@ -2087,11 +2087,9 @@ ThreadHiding =
|
|||||||
|
|
||||||
$.add div, a
|
$.add div, a
|
||||||
$.prepend thread, div
|
$.prepend thread, div
|
||||||
$.addClass thread, 'stub'
|
|
||||||
|
|
||||||
show: (thread, id) ->
|
show: (thread, id) ->
|
||||||
$.rm $ '.block', thread
|
$.rm $ '.block', thread
|
||||||
$.removeClass thread, 'stub'
|
|
||||||
thread.hidden = false
|
thread.hidden = false
|
||||||
thread.nextSibling.hidden = false
|
thread.nextSibling.hidden = false
|
||||||
|
|
||||||
@ -2712,7 +2710,7 @@ QuotePreview =
|
|||||||
$.off @, 'mouseout', QuotePreview.mouseout
|
$.off @, 'mouseout', QuotePreview.mouseout
|
||||||
$.off @, 'click', QuotePreview.mouseout
|
$.off @, 'click', QuotePreview.mouseout
|
||||||
parse: (req, id, threadID) ->
|
parse: (req, id, threadID) ->
|
||||||
return unless (qp = ui.el) and qp.innerHTML is "Loading #{id}..."
|
return unless (qp = ui.el) and qp.textContent is "Loading #{id}..."
|
||||||
|
|
||||||
if req.status isnt 200
|
if req.status isnt 200
|
||||||
qp.textContent = "#{req.status} #{req.statusText}"
|
qp.textContent = "#{req.status} #{req.statusText}"
|
||||||
@ -3297,7 +3295,7 @@ Main =
|
|||||||
el: if klass is 'op' then node else node.firstChild.firstChild.lastChild
|
el: if klass is 'op' then node else node.firstChild.firstChild.lastChild
|
||||||
class: klass
|
class: klass
|
||||||
id: node.getElementsByTagName('input')[0].name
|
id: node.getElementsByTagName('input')[0].name
|
||||||
threadId: g.THREAD_ID or $.x('ancestor::div[contains(@class,"thread")]', node).firstChild.id
|
threadId: g.THREAD_ID or $.x('ancestor::div[@class="thread"]', node).firstChild.id
|
||||||
isOP: klass is 'op'
|
isOP: klass is 'op'
|
||||||
isInlined: /\binline\b/.test klass
|
isInlined: /\binline\b/.test klass
|
||||||
filesize: node.getElementsByClassName('filesize')[0] or false
|
filesize: node.getElementsByClassName('filesize')[0] or false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user