From 49de3385c08826030bc04e15d598bfa6562b453f Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 23 May 2011 12:44:47 +0200 Subject: [PATCH 1/2] Fix correct image count if there is no replies. --- 4chan_x.js | 3 ++- script.coffee | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 0beb352e0..79a872148 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1971,13 +1971,14 @@ threadStats = { init: function() { var html; - html = "
Replies: 0 Images: 1
"; + html = "
Replies: 0 Images:
"; $.append(d.body, ui.dialog('stats', { bottom: '0px', left: '0px' }, html)); threadStats.replies = 0; threadStats.images = $('.op img[md5]') ? 1 : 0; + $('#icount').textContent = threadStats.images; return g.callbacks.push(threadStats.node); }, node: function(root) { diff --git a/script.coffee b/script.coffee index 54f05a565..b7bb4eaac 100644 --- a/script.coffee +++ b/script.coffee @@ -1547,10 +1547,11 @@ reportButton = threadStats = init: -> - html = "
Replies: 0 Images: 1
" + html = "
Replies: 0 Images:
" $.append d.body, (ui.dialog 'stats', bottom: '0px', left: '0px', html) threadStats.replies = 0 threadStats.images = if $ '.op img[md5]' then 1 else 0 + $('#icount').textContent = threadStats.images g.callbacks.push threadStats.node node: (root) -> return if root.className From 3570e1f70be716e63c7220b988d2f5bc837c3b51 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 23 May 2011 16:16:06 +0200 Subject: [PATCH 2/2] Simple. --- 4chan_x.js | 7 +++---- script.coffee | 5 ++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/4chan_x.js b/4chan_x.js index 79a872148..9294ed71b 100644 --- a/4chan_x.js +++ b/4chan_x.js @@ -1971,14 +1971,13 @@ threadStats = { init: function() { var html; - html = "
Replies: 0 Images:
"; + threadStats.replies = 0; + threadStats.images = $('.op img[md5]') ? 1 : 0; + html = "
Replies: " + threadStats.replies + " Images: " + threadStats.images + "
"; $.append(d.body, ui.dialog('stats', { bottom: '0px', left: '0px' }, html)); - threadStats.replies = 0; - threadStats.images = $('.op img[md5]') ? 1 : 0; - $('#icount').textContent = threadStats.images; return g.callbacks.push(threadStats.node); }, node: function(root) { diff --git a/script.coffee b/script.coffee index b7bb4eaac..6a39a79c7 100644 --- a/script.coffee +++ b/script.coffee @@ -1547,11 +1547,10 @@ reportButton = threadStats = init: -> - html = "
Replies: 0 Images:
" - $.append d.body, (ui.dialog 'stats', bottom: '0px', left: '0px', html) threadStats.replies = 0 threadStats.images = if $ '.op img[md5]' then 1 else 0 - $('#icount').textContent = threadStats.images + html = "
Replies: #{threadStats.replies} Images: #{threadStats.images}
" + $.append d.body, (ui.dialog 'stats', bottom: '0px', left: '0px', html) g.callbacks.push threadStats.node node: (root) -> return if root.className