diff --git a/4chan_x.user.js b/4chan_x.user.js
index a6d241ab4..7b8feb363 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -2716,25 +2716,31 @@
threadStats = {
init: function() {
- var dialog, html;
- threadStats.posts = 1;
- threadStats.images = $('.op img[md5]') ? 1 : 0;
- html = "
" + threadStats.posts + " / " + threadStats.images + "
";
- dialog = ui.dialog('stats', 'bottom: 0; left: 0;', html);
+ var dialog;
+ dialog = ui.dialog('stats', 'bottom: 0; left: 0;', '0 / 0
');
dialog.className = 'dialog';
- threadStats.postcountEl = $('#postcount', dialog);
- threadStats.imagecountEl = $('#imagecount', dialog);
$.add(d.body, dialog);
+ threadStats.posts = threadStats.images = 0;
+ threadStats.imgLimit = (function() {
+ switch (g.BOARD) {
+ case 'a':
+ case 'v':
+ return 251;
+ default:
+ return 151;
+ }
+ })();
return g.callbacks.push(threadStats.node);
},
node: function(root) {
- if (root.className) return;
- threadStats.postcountEl.textContent = ++threadStats.posts;
- if ($('img[md5]', root)) {
- threadStats.imagecountEl.textContent = ++threadStats.images;
- if (threadStats.images > 151) {
- return threadStats.imagecountEl.className = 'error';
- }
+ var imgcount;
+ if (/\binline\b/.test(root.className)) return;
+ $.id('postcount').textContent = ++threadStats.posts;
+ if (!$('img[md5]', root)) return;
+ imgcount = $.id('imagecount');
+ imgcount.textContent = ++threadStats.images;
+ if (threadStats.images > threadStats.imgLimit) {
+ return imgcount.className = 'error';
}
}
};
diff --git a/changelog b/changelog
index 6a1953df1..264276ac9 100644
--- a/changelog
+++ b/changelog
@@ -1,4 +1,6 @@
master
+- mayhem
+ Set image limit in Thread Stats to 251 for /a/ and /v/, default to 151.
2.24.2
- mayhem
diff --git a/script.coffee b/script.coffee
index d8f96d0e5..c65a93b6e 100644
--- a/script.coffee
+++ b/script.coffee
@@ -2115,22 +2115,25 @@ reportButton =
threadStats =
init: ->
- threadStats.posts = 1
- threadStats.images = if $ '.op img[md5]' then 1 else 0
- html = "#{threadStats.posts} / #{threadStats.images}
"
- dialog = ui.dialog 'stats', 'bottom: 0; left: 0;', html
+ dialog = ui.dialog 'stats', 'bottom: 0; left: 0;', '0 / 0
'
dialog.className = 'dialog'
- threadStats.postcountEl = $ '#postcount', dialog
- threadStats.imagecountEl = $ '#imagecount', dialog
$.add d.body, dialog
+ threadStats.posts = threadStats.images = 0
+ threadStats.imgLimit =
+ switch g.BOARD
+ when 'a', 'v'
+ 251
+ else
+ 151
g.callbacks.push threadStats.node
node: (root) ->
- return if root.className
- threadStats.postcountEl.textContent = ++threadStats.posts
- if $ 'img[md5]', root
- threadStats.imagecountEl.textContent = ++threadStats.images
- if threadStats.images > 151
- threadStats.imagecountEl.className = 'error'
+ return if /\binline\b/.test root.className
+ $.id('postcount').textContent = ++threadStats.posts
+ return unless $ 'img[md5]', root
+ imgcount = $.id 'imagecount'
+ imgcount.textContent = ++threadStats.images
+ if threadStats.images > threadStats.imgLimit
+ imgcount.className = 'error'
unread =
init: ->