Merge branch 'master' into qr

Conflicts:
	4chan_x.user.js
	script.coffee
This commit is contained in:
Nicolas Stepien 2012-01-16 23:19:15 +01:00
commit 2263d2ba7a
5 changed files with 49 additions and 40 deletions

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan x
// @version 2.24.2
// @version 2.24.3
// @namespace aeosynth
// @description Adds various features.
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
@ -17,7 +17,7 @@
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
* Copyright (c) 2012 Nicolas Stepien <stepien.nicolas@gmail.com>
* http://mayhemydg.github.com/4chan-x/
* 4chan X 2.24.2
* 4chan X 2.24.3
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
@ -199,7 +199,7 @@
NAMESPACE = '4chan_x.';
VERSION = '2.24.2';
VERSION = '2.24.3';
SECOND = 1000;
@ -751,7 +751,7 @@
}
},
parse: function(req, pathname, thread, a) {
var body, br, frag, href, link, next, quote, reply, _i, _j, _len, _len2, _ref, _ref2;
var body, frag, href, link, next, quote, reply, _i, _j, _len, _len2, _ref, _ref2;
if (req.status !== 200) {
a.textContent = "" + req.status + " " + req.statusText;
$.off(a, 'click', expandThread.cb.toggle);
@ -782,8 +782,7 @@
while ((next = a.nextSibling) && !next.clear) {
$.rm(next);
}
br = next;
return $.before(br, frag);
return $.before(next, frag);
}
};
@ -1770,7 +1769,6 @@
updater = {
init: function() {
var checkbox, checked, dialog, html, input, name, title, _i, _len, _ref;
if (!$('form[name=post]')) return;
if (conf['Scrolling']) {
if (conf['Scroll BG']) {
updater.focus = true;
@ -2550,25 +2548,31 @@
threadStats = {
init: function() {
var dialog, html;
threadStats.posts = 1;
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);
var dialog;
dialog = ui.dialog('stats', 'bottom: 0; left: 0;', '<div class=move><span id=postcount>0</span> / <span id=imagecount>0</span></div>');
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';
}
}
};

View File

@ -2,7 +2,7 @@
{exec} = require 'child_process'
fs = require 'fs'
VERSION = '2.24.2'
VERSION = '2.24.3'
HEADER = """
// ==UserScript==

View File

@ -1,5 +1,10 @@
master
2.24.3
- Mayhem
Set image limit in Thread Stats to 252 for /a/ and /v/, default to 152.
Fix 4chan X in locked threads.
2.24.2
- mayhem
fix options popping up everytime a page loads

View File

@ -1 +1 @@
postMessage({version:'2.24.2'},'*');
postMessage({version:'2.24.3'},'*');

View File

@ -121,7 +121,7 @@ conf = {}
) null, config
NAMESPACE = '4chan_x.'
VERSION = '2.24.2'
VERSION = '2.24.3'
SECOND = 1000
MINUTE = 60*SECOND
HOUR = 60*MINUTE
@ -564,8 +564,7 @@ expandThread =
# eat everything, then replace with fresh full posts
while (next = a.nextSibling) and not next.clear #br[clear]
$.rm next
br = next
$.before br, frag
$.before next, frag
replyHiding =
init: ->
@ -1484,8 +1483,6 @@ threadHiding =
updater =
init: ->
#thread closed
return unless $ 'form[name=post]'
if conf['Scrolling']
if conf['Scroll BG']
updater.focus = true
@ -2051,22 +2048,25 @@ reportButton =
threadStats =
init: ->
threadStats.posts = 1
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 = ui.dialog 'stats', 'bottom: 0; left: 0;', '<div class=move><span id=postcount>0</span> / <span id=imagecount>0</span></div>'
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: ->