Merge branch 'master' into Fx10

Conflicts:
	4chan_x.user.js
	script.coffee
This commit is contained in:
Nicolas Stepien 2012-01-19 15:55:59 +01:00
commit fd0099980a
5 changed files with 55 additions and 48 deletions

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan x // @name 4chan x
// @version 2.24.2 // @version 2.24.3
// @namespace aeosynth // @namespace aeosynth
// @description Adds various features. // @description Adds various features.
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com> // @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
@ -18,7 +18,7 @@
* Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com> * Copyright (c) 2009-2011 James Campos <james.r.campos@gmail.com>
* Copyright (c) 2012 Nicolas Stepien <stepien.nicolas@gmail.com> * Copyright (c) 2012 Nicolas Stepien <stepien.nicolas@gmail.com>
* http://mayhemydg.github.com/4chan-x/ * 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 * Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation * obtaining a copy of this software and associated documentation
@ -200,7 +200,7 @@
NAMESPACE = '4chan_x.'; NAMESPACE = '4chan_x.';
VERSION = '2.24.2'; VERSION = '2.24.3';
SECOND = 1000; SECOND = 1000;
@ -762,7 +762,7 @@
} }
}, },
parse: function(req, pathname, thread, a) { 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) { if (req.status !== 200) {
a.textContent = "" + req.status + " " + req.statusText; a.textContent = "" + req.status + " " + req.statusText;
$.off(a, 'click', expandThread.cb.toggle); $.off(a, 'click', expandThread.cb.toggle);
@ -793,8 +793,7 @@
while ((next = a.nextSibling) && !next.clear) { while ((next = a.nextSibling) && !next.clear) {
$.rm(next); $.rm(next);
} }
br = next; return $.before(next, frag);
return $.before(br, frag);
} }
}; };
@ -1933,7 +1932,6 @@
updater = { updater = {
init: function() { init: function() {
var checkbox, checked, dialog, html, input, name, title, _i, _len, _ref; var checkbox, checked, dialog, html, input, name, title, _i, _len, _ref;
if (!$('form[name=post]')) return;
html = "<div class=move><span id=count></span> <span id=timer>-" + conf['Interval'] + "</span></div>"; html = "<div class=move><span id=count></span> <span id=timer>-" + conf['Interval'] + "</span></div>";
checkbox = config.updater.checkbox; checkbox = config.updater.checkbox;
for (name in checkbox) { for (name in checkbox) {
@ -2581,7 +2579,7 @@
var el, id, qp, quote, replyID, threadID, _i, _len, _ref, _results; var el, id, qp, quote, replyID, threadID, _i, _len, _ref, _results;
qp = ui.el = $.el('div', { qp = ui.el = $.el('div', {
id: 'qp', id: 'qp',
className: 'reply' className: 'reply dialog'
}); });
$.add(d.body, qp); $.add(d.body, qp);
id = this.hash.slice(1); id = this.hash.slice(1);
@ -2714,25 +2712,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';
} }
} }
}; };
@ -3145,7 +3149,7 @@
if (conf['Auto Noko'] && canPost) form.action += '?noko'; if (conf['Auto Noko'] && canPost) form.action += '?noko';
if (conf['Cooldown'] && canPost) cooldown.init(); if (conf['Cooldown'] && canPost) cooldown.init();
if (conf['Image Expansion']) imgExpand.init(); if (conf['Image Expansion']) imgExpand.init();
if (conf['Quick Reply']) qr.init(); if (conf['Quick Reply'] && canPost) qr.init();
if (conf['Thread Watcher']) watcher.init(); if (conf['Thread Watcher']) watcher.init();
if (conf['Keybinds']) keybinds.init(); if (conf['Keybinds']) keybinds.init();
if (g.REPLY) { if (g.REPLY) {
@ -3212,7 +3216,7 @@
.move {\ .move {\
cursor: move;\ cursor: move;\
}\ }\
label, a, .favicon, #qr img {\ label, .favicon, #qr_form > div > img {\
cursor: pointer;\ cursor: pointer;\
}\ }\
a[href="javascript:;"] {\ a[href="javascript:;"] {\
@ -3398,7 +3402,6 @@
}\ }\
\ \
#qp {\ #qp {\
border: 1px solid;\
padding-bottom: 5px;\ padding-bottom: 5px;\
}\ }\
.qphl {\ .qphl {\

View File

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

View File

@ -1,5 +1,10 @@
master 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 2.24.2
- mayhem - mayhem
fix options popping up everytime a page loads 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 ) null, config
NAMESPACE = '4chan_x.' NAMESPACE = '4chan_x.'
VERSION = '2.24.2' VERSION = '2.24.3'
SECOND = 1000 SECOND = 1000
MINUTE = 60*SECOND MINUTE = 60*SECOND
HOUR = 60*MINUTE HOUR = 60*MINUTE
@ -569,8 +569,7 @@ expandThread =
# eat everything, then replace with fresh full posts # eat everything, then replace with fresh full posts
while (next = a.nextSibling) and not next.clear #br[clear] while (next = a.nextSibling) and not next.clear #br[clear]
$.rm next $.rm next
br = next $.before next, frag
$.before br, frag
replyHiding = replyHiding =
init: -> init: ->
@ -1547,8 +1546,6 @@ threadHiding =
updater = updater =
init: -> init: ->
#thread closed
return unless $ 'form[name=post]'
html = "<div class=move><span id=count></span> <span id=timer>-#{conf['Interval']}</span></div>" html = "<div class=move><span id=count></span> <span id=timer>-#{conf['Interval']}</span></div>"
{checkbox} = config.updater {checkbox} = config.updater
for name of checkbox for name of checkbox
@ -2039,7 +2036,7 @@ quotePreview =
mouseover: (e) -> mouseover: (e) ->
qp = ui.el = $.el 'div', qp = ui.el = $.el 'div',
id: 'qp' id: 'qp'
className: 'reply' className: 'reply dialog'
$.add d.body, qp $.add d.body, qp
id = @hash[1..] id = @hash[1..]
@ -2118,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: ->
@ -2497,7 +2497,7 @@ Main =
if conf['Image Expansion'] if conf['Image Expansion']
imgExpand.init() imgExpand.init()
if conf['Quick Reply'] if conf['Quick Reply'] and canPost
qr.init() qr.init()
if conf['Thread Watcher'] if conf['Thread Watcher']
@ -2574,7 +2574,7 @@ Main =
.move { .move {
cursor: move; cursor: move;
} }
label, a, .favicon, #qr img { label, .favicon, #qr_form > div > img {
cursor: pointer; cursor: pointer;
} }
a[href="javascript:;"] { a[href="javascript:;"] {
@ -2760,7 +2760,6 @@ Main =
} }
#qp { #qp {
border: 1px solid;
padding-bottom: 5px; padding-bottom: 5px;
} }
.qphl { .qphl {