Merge branch 'master' into menu

This commit is contained in:
Nicolas Stepien 2012-06-25 14:35:47 +02:00
commit 71fcb4d5ef
5 changed files with 81 additions and 34 deletions

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan x // @name 4chan x
// @version 2.33.3 // @version 2.33.4
// @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>
@ -23,7 +23,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.33.3 * 4chan X 2.33.4
* *
* 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
@ -1492,7 +1492,7 @@
QR = { QR = {
init: function() { init: function() {
if (!$.id('recaptcha_challenge_field_holder')) { if (!$.id('postForm')) {
return; return;
} }
Main.callbacks.push(this.node); Main.callbacks.push(this.node);
@ -1947,9 +1947,37 @@
captcha: { captcha: {
init: function() { init: function() {
var _this = this; var _this = this;
this.img = $('.captcha > img', QR.el); if (!(QR.captchaIsEnabled = !!$.id('captchaFormPart'))) {
this.input = $('[autocomplete]', QR.el); return;
this.challenge = $.id('recaptcha_challenge_field_holder'); }
if ($.id('recaptcha_challenge_field_holder')) {
return this.ready();
} else {
this.onready = function() {
return _this.ready();
};
return $.on($.id('recaptcha_widget_div'), 'DOMNodeInserted', this.onready);
}
},
ready: function() {
var _this = this;
if (this.challenge = $.id('recaptcha_challenge_field_holder')) {
$.off($.id('recaptcha_widget_div'), 'DOMNodeInserted', this.onready);
delete this.onready;
} else {
return;
}
$.after($('.textarea', QR.el), $.el('div', {
className: 'captchaimg',
title: 'Reload',
innerHTML: '<img>'
}));
$.after($('.captchaimg', QR.el), $.el('div', {
className: 'captchainput',
innerHTML: '<input title=Verification class=field autocomplete=off size=1>'
}));
this.img = $('.captchaimg > img', QR.el);
this.input = $('.captchainput > input', QR.el);
$.on(this.img.parentNode, 'click', this.reload); $.on(this.img.parentNode, 'click', this.reload);
$.on(this.input, 'keydown', this.keydown); $.on(this.input, 'keydown', this.keydown);
$.on(this.challenge, 'DOMNodeInserted', function() { $.on(this.challenge, 'DOMNodeInserted', function() {
@ -2029,9 +2057,7 @@
<form>\ <form>\
<div><input id=dump type=button title="Dump list" value=+ class=field><input name=name title=Name placeholder=Name class=field size=1><input name=email title=E-mail placeholder=E-mail class=field size=1><input name=sub title=Subject placeholder=Subject class=field size=1></div>\ <div><input id=dump type=button title="Dump list" value=+ class=field><input name=name title=Name placeholder=Name class=field size=1><input name=email title=E-mail placeholder=E-mail class=field size=1><input name=sub title=Subject placeholder=Subject class=field size=1></div>\
<div id=replies><div><a id=addReply href=javascript:; title="Add a reply">+</a></div></div>\ <div id=replies><div><a id=addReply href=javascript:; title="Add a reply">+</a></div></div>\
<div><textarea name=com title=Comment placeholder=Comment class=field></textarea><span id=charCount></span></div>\ <div class=textarea><textarea name=com title=Comment placeholder=Comment class=field></textarea><span id=charCount></span></div>\
<div class=captcha title=Reload><img></div>\
<div><input title=Verification class=field autocomplete=off size=1></div>\
<div><input type=file title="Shift+Click to remove the selected file." multiple size=16><input type=submit></div>\ <div><input type=file title="Shift+Click to remove the selected file." multiple size=16><input type=submit></div>\
<label id=spoilerLabel><input type=checkbox id=spoiler> Spoiler Image</label>\ <label id=spoilerLabel><input type=checkbox id=spoiler> Spoiler Image</label>\
<div class=warning></div>\ <div class=warning></div>\
@ -2139,7 +2165,7 @@
threadID = g.THREAD_ID || $('select', QR.el).value; threadID = g.THREAD_ID || $('select', QR.el).value;
if (!(threadID === 'new' && reply.file || threadID !== 'new' && (reply.com || reply.file))) { if (!(threadID === 'new' && reply.file || threadID !== 'new' && (reply.com || reply.file))) {
err = 'No file selected.'; err = 'No file selected.';
} else { } else if (QR.captchaIsEnabled) {
captchas = $.get('captchas', []); captchas = $.get('captchas', []);
while ((captcha = captchas[0]) && captcha.time < Date.now()) { while ((captcha = captchas[0]) && captcha.time < Date.now()) {
captchas.shift(); captchas.shift();
@ -4491,7 +4517,7 @@
return; return;
} }
$.ready(Options.init); $.ready(Options.init);
if (Conf['Quick Reply'] && Conf['Hide Original Post Form'] && g.BOARD !== 'f') { if (Conf['Quick Reply'] && Conf['Hide Original Post Form']) {
Main.css += '#postForm { display: none; }'; Main.css += '#postForm { display: none; }';
} }
Main.addStyle(); Main.addStyle();
@ -4795,7 +4821,7 @@
return $.globalEval(("(" + code + ")()").replace('_id_', bq.id)); return $.globalEval(("(" + code + ")()").replace('_id_', bq.id));
}, },
namespace: '4chan_x.', namespace: '4chan_x.',
version: '2.33.3', version: '2.33.4',
callbacks: [], callbacks: [],
css: '\ css: '\
/* dialog styling */\ /* dialog styling */\
@ -4858,7 +4884,7 @@ h1 {\
#qr > .move > span {\ #qr > .move > span {\
float: right;\ float: right;\
}\ }\
#autohide, .close, #qr select, #dump, .remove, .captcha, #qr div.warning {\ #autohide, .close, #qr select, #dump, .remove, .captchaimg, #qr div.warning {\
cursor: pointer;\ cursor: pointer;\
}\ }\
#qr select,\ #qr select,\
@ -5015,7 +5041,7 @@ h1 {\
min-height: 120px;\ min-height: 120px;\
min-width: 100%;\ min-width: 100%;\
}\ }\
#qr > form > div:nth-child(3) {\ .textarea {\
position: relative;\ position: relative;\
}\ }\
#charCount {\ #charCount {\
@ -5028,16 +5054,16 @@ h1 {\
#charCount.warning {\ #charCount.warning {\
color: red;\ color: red;\
}\ }\
.captcha + div > .field {\ .captchainput > .field {\
min-width: 100%;\ min-width: 100%;\
}\ }\
.captcha {\ .captchaimg {\
background: #FFF;\ background: #FFF;\
outline: 1px solid #CCC;\ outline: 1px solid #CCC;\
outline-offset: -1px;\ outline-offset: -1px;\
text-align: center;\ text-align: center;\
}\ }\
.captcha > img {\ .captchaimg > img {\
display: block;\ display: block;\
height: 57px;\ height: 57px;\
width: 300px;\ width: 300px;\

View File

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

View File

@ -1,5 +1,10 @@
master master
2.33.4
- Mayhem
Fix QR with the new captcha loading method.
The QR will now work on /f/ too.
2.33.3 2.33.3
- Mayhem - Mayhem
Revert changes that broke fetchers in Firefox. Revert changes that broke fetchers in Firefox.

View File

@ -1 +1 @@
postMessage({version:'2.33.3'},'*') postMessage({version:'2.33.4'},'*')

View File

@ -1112,7 +1112,7 @@ Nav =
QR = QR =
init: -> init: ->
return unless $.id 'recaptcha_challenge_field_holder' return unless $.id 'postForm'
Main.callbacks.push @node Main.callbacks.push @node
setTimeout @asyncInit setTimeout @asyncInit
@ -1456,9 +1456,27 @@ QR =
captcha: captcha:
init: -> init: ->
@img = $ '.captcha > img', QR.el return unless QR.captchaIsEnabled = !!$.id 'captchaFormPart'
@input = $ '[autocomplete]', QR.el if $.id 'recaptcha_challenge_field_holder'
@challenge = $.id 'recaptcha_challenge_field_holder' @ready()
else
@onready = => @ready()
$.on $.id('recaptcha_widget_div'), 'DOMNodeInserted', @onready
ready: ->
if @challenge = $.id 'recaptcha_challenge_field_holder'
$.off $.id('recaptcha_widget_div'), 'DOMNodeInserted', @onready
delete @onready
else
return
$.after $('.textarea', QR.el), $.el 'div',
className: 'captchaimg'
title: 'Reload'
innerHTML: '<img>'
$.after $('.captchaimg', QR.el), $.el 'div',
className: 'captchainput'
innerHTML: '<input title=Verification class=field autocomplete=off size=1>'
@img = $ '.captchaimg > img', QR.el
@input = $ '.captchainput > input', QR.el
$.on @img.parentNode, 'click', @reload $.on @img.parentNode, 'click', @reload
$.on @input, 'keydown', @keydown $.on @input, 'keydown', @keydown
$.on @challenge, 'DOMNodeInserted', => @load() $.on @challenge, 'DOMNodeInserted', => @load()
@ -1520,9 +1538,7 @@ QR =
<form> <form>
<div><input id=dump type=button title="Dump list" value=+ class=field><input name=name title=Name placeholder=Name class=field size=1><input name=email title=E-mail placeholder=E-mail class=field size=1><input name=sub title=Subject placeholder=Subject class=field size=1></div> <div><input id=dump type=button title="Dump list" value=+ class=field><input name=name title=Name placeholder=Name class=field size=1><input name=email title=E-mail placeholder=E-mail class=field size=1><input name=sub title=Subject placeholder=Subject class=field size=1></div>
<div id=replies><div><a id=addReply href=javascript:; title="Add a reply">+</a></div></div> <div id=replies><div><a id=addReply href=javascript:; title="Add a reply">+</a></div></div>
<div><textarea name=com title=Comment placeholder=Comment class=field></textarea><span id=charCount></span></div> <div class=textarea><textarea name=com title=Comment placeholder=Comment class=field></textarea><span id=charCount></span></div>
<div class=captcha title=Reload><img></div>
<div><input title=Verification class=field autocomplete=off size=1></div>
<div><input type=file title="Shift+Click to remove the selected file." multiple size=16><input type=submit></div> <div><input type=file title="Shift+Click to remove the selected file." multiple size=16><input type=submit></div>
<label id=spoilerLabel><input type=checkbox id=spoiler> Spoiler Image</label> <label id=spoilerLabel><input type=checkbox id=spoiler> Spoiler Image</label>
<div class=warning></div> <div class=warning></div>
@ -1614,7 +1630,7 @@ QR =
# prevent errors # prevent errors
unless threadID is 'new' and reply.file or threadID isnt 'new' and (reply.com or reply.file) unless threadID is 'new' and reply.file or threadID isnt 'new' and (reply.com or reply.file)
err = 'No file selected.' err = 'No file selected.'
else else if QR.captchaIsEnabled
# get oldest valid captcha # get oldest valid captcha
captchas = $.get 'captchas', [] captchas = $.get 'captchas', []
# remove old captchas # remove old captchas
@ -3482,7 +3498,7 @@ Main =
$.ready Options.init $.ready Options.init
if Conf['Quick Reply'] and Conf['Hide Original Post Form'] and g.BOARD isnt 'f' if Conf['Quick Reply'] and Conf['Hide Original Post Form']
Main.css += '#postForm { display: none; }' Main.css += '#postForm { display: none; }'
Main.addStyle() Main.addStyle()
@ -3726,7 +3742,7 @@ Main =
$.globalEval "(#{code})()".replace '_id_', bq.id $.globalEval "(#{code})()".replace '_id_', bq.id
namespace: '4chan_x.' namespace: '4chan_x.'
version: '2.33.3' version: '2.33.4'
callbacks: [] callbacks: []
css: ' css: '
/* dialog styling */ /* dialog styling */
@ -3789,7 +3805,7 @@ h1 {
#qr > .move > span { #qr > .move > span {
float: right; float: right;
} }
#autohide, .close, #qr select, #dump, .remove, .captcha, #qr div.warning { #autohide, .close, #qr select, #dump, .remove, .captchaimg, #qr div.warning {
cursor: pointer; cursor: pointer;
} }
#qr select, #qr select,
@ -3946,7 +3962,7 @@ h1 {
min-height: 120px; min-height: 120px;
min-width: 100%; min-width: 100%;
} }
#qr > form > div:nth-child(3) { .textarea {
position: relative; position: relative;
} }
#charCount { #charCount {
@ -3959,16 +3975,16 @@ h1 {
#charCount.warning { #charCount.warning {
color: red; color: red;
} }
.captcha + div > .field { .captchainput > .field {
min-width: 100%; min-width: 100%;
} }
.captcha { .captchaimg {
background: #FFF; background: #FFF;
outline: 1px solid #CCC; outline: 1px solid #CCC;
outline-offset: -1px; outline-offset: -1px;
text-align: center; text-align: center;
} }
.captcha > img { .captchaimg > img {
display: block; display: block;
height: 57px; height: 57px;
width: 300px; width: 300px;