diff --git a/4chan_x.user.js b/4chan_x.user.js
index ecde67147..64007c6aa 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -1225,6 +1225,7 @@
QR = {
init: function() {
var holder;
+ g.callbacks.push(QR.node);
$.append(d.body, $.el('iframe', {
name: 'iframe'
}));
@@ -1233,7 +1234,7 @@
QR.challengeNode({
target: holder.firstChild
});
- return g.callbacks.push(QR.node);
+ return $.bind(window, 'message', QR.receive);
},
challengeNode: function(e) {
return QR.captcha = {
@@ -1258,7 +1259,7 @@
qr.el = ui.dialog('qr', {
top: '0',
left: '0'
- }, " X
Quick Reply
");
+ }, " X Quick Reply
");
$.bind($('form', qr.el), 'submit', QR.submit);
$.append(d.body, qr.el);
ta = $('textarea', qr.el);
@@ -1269,6 +1270,30 @@
submit: function(e) {
$('#challenge', qr.el).value = QR.captcha.challenge;
return $('#response', qr.el).value = $('#recaptcha_response_field', qr.el).value;
+ },
+ sys: function() {
+ return $.globalEval(function() {
+ var data, href, location, node, textContent, _ref;
+ if (node = (_ref = document.querySelector('table font b')) != null ? _ref.firstChild : void 0) {
+ textContent = node.textContent, href = node.href;
+ data = JSON.stringify({
+ textContent: textContent,
+ href: href
+ });
+ }
+ parent.postMessage(data, '*');
+ return location = 'about:blank';
+ });
+ },
+ receive: function(e) {
+ var data;
+ data = e.data;
+ if (data) {
+ return $.extend($('a.error', qr.el), JSON.parse(data));
+ } else {
+ $.rm(qr.el);
+ return qr.el = null;
+ }
}
};
qr = {
diff --git a/script.coffee b/script.coffee
index 575ee91ea..0189ee23f 100644
--- a/script.coffee
+++ b/script.coffee
@@ -963,12 +963,13 @@ cooldown =
QR =
init: ->
+ g.callbacks.push QR.node
$.append d.body, $.el 'iframe',
name: 'iframe'
holder = $ '#recaptcha_challenge_field_holder'
$.bind holder, 'DOMNodeInserted', QR.challengeNode
QR.challengeNode target: holder.firstChild
- g.callbacks.push QR.node
+ $.bind window, 'message', QR.receive
challengeNode: (e) ->
QR.captcha =
challenge: e.target.value
@@ -996,6 +997,7 @@ QR =
+
"
$.bind $('form', qr.el), 'submit', QR.submit
$.append d.body, qr.el
@@ -1006,6 +1008,21 @@ QR =
submit: (e) ->
$('#challenge', qr.el).value = QR.captcha.challenge
$('#response', qr.el).value = $('#recaptcha_response_field', qr.el).value
+ sys: ->
+ $.globalEval ->
+ if node = document.querySelector('table font b')?.firstChild
+ {textContent, href} = node
+ data = JSON.stringify {textContent, href}
+ parent.postMessage data, '*'
+ location = 'about:blank'
+
+ receive: (e) ->
+ {data} = e
+ if data
+ $.extend $('a.error', qr.el), JSON.parse data
+ else
+ $.rm qr.el
+ qr.el = null
qr =
# TODO