Fix thread-stats.js to attach to correct location and count correctly.

This commit is contained in:
Benjamin Southall 2017-05-04 13:56:19 +09:00
parent 7589bc3843
commit 83989bba88

View File

@ -14,8 +14,8 @@ $(document).ready(function(){
var thread_id = (document.location.pathname + document.location.search).split('/'); var thread_id = (document.location.pathname + document.location.search).split('/');
thread_id = thread_id[thread_id.length -1].split('+')[0].split('.')[0]; thread_id = thread_id[thread_id.length -1].split('+')[0].split('.')[0];
$('#thread-links') $('.clear')
.after('<div id="thread_stats"></div>'); .before('<div id="thread_stats"></div>');
var el = $('#thread_stats'); var el = $('#thread_stats');
el.prepend('Page <span id="thread_stats_page">?</span>'); el.prepend('Page <span id="thread_stats_page">?</span>');
if (IDsupport){ if (IDsupport){
@ -25,8 +25,8 @@ $(document).ready(function(){
el.prepend('<span id="thread_stats_posts">0</span> replies |&nbsp;'); el.prepend('<span id="thread_stats_posts">0</span> replies |&nbsp;');
delete el; delete el;
function update_thread_stats(){ function update_thread_stats(){
var op = $('#thread_'+ thread_id +' > div.post.op:not(.post-hover):not(.inline)').first(); var op = $('#thread_'+ thread_id).find('div.post.op:not(.post-hover):not(.inline)').first();
var replies = $('#thread_'+ thread_id +' > div.post.reply:not(.post-hover):not(.inline)'); var replies = $('#thread_'+ thread_id).find('div.post.reply:not(.post-hover):not(.inline)');
// post count // post count
$('#thread_stats_posts').text(replies.length); $('#thread_stats_posts').text(replies.length);
// image count // image count