This commit is contained in:
Nicolas Stepien 2012-02-02 20:21:51 +01:00
parent f1eca3da2e
commit 32878d7e2f
2 changed files with 15 additions and 10 deletions

View File

@ -1200,7 +1200,7 @@
qr = { qr = {
init: function() { init: function() {
var h1, iframe; var h1, iframe, loadChecking;
if (!$.id('recaptcha_challenge_field_holder')) return; if (!$.id('recaptcha_challenge_field_holder')) return;
$('form[name=post]').hidden = true; $('form[name=post]').hidden = true;
h1 = $.el('h1', { h1 = $.el('h1', {
@ -1219,14 +1219,16 @@
$.on(iframe, 'error', function() { $.on(iframe, 'error', function() {
return this.src = this.src; return this.src = this.src;
}); });
$.on(iframe, 'load', function() { loadChecking = function(iframe) {
var _this = this; if (!qr.status.ready) {
if (!(qr.status.ready || this.src === 'about:blank')) { iframe.src = 'about:blank';
this.src = 'about:blank';
return setTimeout((function() { return setTimeout((function() {
return _this.src = 'http://sys.4chan.org/post'; return iframe.src = 'http://sys.4chan.org/post';
}), 250); }), 250);
} }
};
$.on(iframe, 'load', function() {
if (this.src !== 'about:blank') return setTimeout(loadChecking, 250, this);
}); });
$.add(d.body, iframe); $.add(d.body, iframe);
if (conf['Persistent QR']) { if (conf['Persistent QR']) {

View File

@ -869,17 +869,20 @@ qr =
$.add $('.postarea'), h1 $.add $('.postarea'), h1
g.callbacks.push (root) -> g.callbacks.push (root) ->
$.on $('.quotejs + .quotejs', root), 'click', qr.quote $.on $('.quotejs + .quotejs', root), 'click', qr.quote
iframe = $.el 'iframe', iframe = $.el 'iframe',
id: 'iframe' id: 'iframe'
hidden: true hidden: true
src: 'http://sys.4chan.org/post' src: 'http://sys.4chan.org/post'
$.on iframe, 'error', -> @src = @src $.on iframe, 'error', -> @src = @src
# Greasemonkey ghetto fix # Greasemonkey ghetto fix
$.on iframe, 'load', -> loadChecking = (iframe) ->
unless qr.status.ready or @src is 'about:blank' unless qr.status.ready
@src = 'about:blank' iframe.src = 'about:blank'
setTimeout (=> @src = 'http://sys.4chan.org/post'), 250 setTimeout (-> iframe.src = 'http://sys.4chan.org/post'), 250
$.on iframe, 'load', -> unless @src is 'about:blank' then setTimeout loadChecking, 250, @
$.add d.body, iframe $.add d.body, iframe
if conf['Persistent QR'] if conf['Persistent QR']
qr.dialog() qr.dialog()
qr.hide() if conf['Auto Hide QR'] qr.hide() if conf['Auto Hide QR']