actually work in chrome

This commit is contained in:
James Campos 2011-08-15 21:43:40 -07:00
parent 3faa0b3140
commit 9b3a119158
2 changed files with 22 additions and 7 deletions

View File

@ -1219,17 +1219,21 @@
};
qr = {
init: function() {
var iframe;
var data, iframe;
g.callbacks.push(qr.node);
$.bind(window, 'message', qr.message);
$.bind($('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode);
qr.captchaTime = Date.now();
iframe = $.el('iframe', {
name: 'iframe',
hidden: true,
id: 'iframe',
src: 'http://sys.4chan.org/post'
});
$.append(d.body, iframe);
data = $.el('span', {
hidden: true,
id: 'data'
});
$.append(d.body, iframe, data);
return $('#recaptcha_response_field').id = '';
},
attach: function() {
@ -1450,7 +1454,11 @@
data[el.name] = el.value;
}
}
return $('iframe').contentWindow.postMessage(JSON.stringify(data), '*');
$('#data').textContent = JSON.stringify(data);
return $.globalEval(function() {
data = document.getElementById('data').textContent;
return document.getElementById('iframe').contentWindow.postMessage(data, '*');
});
},
foo: function() {
var body, data, href, node, textContent, _ref;

View File

@ -972,10 +972,13 @@ qr =
qr.captchaTime = Date.now()
iframe = $.el 'iframe',
name: 'iframe'
hidden: true
id: 'iframe'
src: 'http://sys.4chan.org/post'
$.append d.body, iframe
data = $.el 'span',
hidden: true
id: 'data'
$.append d.body, iframe, data
#hack - nuke id so it doesn't grab focus when reloading
$('#recaptcha_response_field').id = ''
@ -1188,7 +1191,11 @@ qr =
for el in $$ '[name]', qr.el when el.value
data[el.name] = el.value
$('iframe').contentWindow.postMessage JSON.stringify(data), '*'
$('#data').textContent = JSON.stringify data
$.globalEval ->
data = document.getElementById('data').textContent
document.getElementById('iframe').contentWindow.postMessage data, '*'
foo: ->
body = $.el 'body',