Set image limit to 251 for /a/ and /v/, default to 151.

This commit is contained in:
Nicolas Stepien 2012-01-15 14:51:46 +01:00
parent ca8d119e57
commit 679630e887
3 changed files with 37 additions and 26 deletions

View File

@ -2716,25 +2716,31 @@
threadStats = { threadStats = {
init: function() { init: function() {
var dialog, html; var dialog;
threadStats.posts = 1; dialog = ui.dialog('stats', 'bottom: 0; left: 0;', '<div class=move><span id=postcount>0</span> / <span id=imagecount>0</span></div>');
threadStats.images = $('.op img[md5]') ? 1 : 0;
html = "<div class=move><span id=postcount>" + threadStats.posts + "</span> / <span id=imagecount>" + threadStats.images + "</span></div>";
dialog = ui.dialog('stats', 'bottom: 0; left: 0;', html);
dialog.className = 'dialog'; dialog.className = 'dialog';
threadStats.postcountEl = $('#postcount', dialog);
threadStats.imagecountEl = $('#imagecount', dialog);
$.add(d.body, 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); return g.callbacks.push(threadStats.node);
}, },
node: function(root) { node: function(root) {
if (root.className) return; var imgcount;
threadStats.postcountEl.textContent = ++threadStats.posts; if (/\binline\b/.test(root.className)) return;
if ($('img[md5]', root)) { $.id('postcount').textContent = ++threadStats.posts;
threadStats.imagecountEl.textContent = ++threadStats.images; if (!$('img[md5]', root)) return;
if (threadStats.images > 151) { imgcount = $.id('imagecount');
return threadStats.imagecountEl.className = 'error'; imgcount.textContent = ++threadStats.images;
} if (threadStats.images > threadStats.imgLimit) {
return imgcount.className = 'error';
} }
} }
}; };

View File

@ -1,4 +1,6 @@
master master
- mayhem
Set image limit in Thread Stats to 251 for /a/ and /v/, default to 151.
2.24.2 2.24.2
- mayhem - mayhem

View File

@ -2115,22 +2115,25 @@ reportButton =
threadStats = threadStats =
init: -> init: ->
threadStats.posts = 1 dialog = ui.dialog 'stats', 'bottom: 0; left: 0;', '<div class=move><span id=postcount>0</span> / <span id=imagecount>0</span></div>'
threadStats.images = if $ '.op img[md5]' then 1 else 0
html = "<div class=move><span id=postcount>#{threadStats.posts}</span> / <span id=imagecount>#{threadStats.images}</span></div>"
dialog = ui.dialog 'stats', 'bottom: 0; left: 0;', html
dialog.className = 'dialog' dialog.className = 'dialog'
threadStats.postcountEl = $ '#postcount', dialog
threadStats.imagecountEl = $ '#imagecount', dialog
$.add d.body, 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 g.callbacks.push threadStats.node
node: (root) -> node: (root) ->
return if root.className return if /\binline\b/.test root.className
threadStats.postcountEl.textContent = ++threadStats.posts $.id('postcount').textContent = ++threadStats.posts
if $ 'img[md5]', root return unless $ 'img[md5]', root
threadStats.imagecountEl.textContent = ++threadStats.images imgcount = $.id 'imagecount'
if threadStats.images > 151 imgcount.textContent = ++threadStats.images
threadStats.imagecountEl.className = 'error' if threadStats.images > threadStats.imgLimit
imgcount.className = 'error'
unread = unread =
init: -> init: ->