cleanup, should work in chrome
This commit is contained in:
parent
bc98665c69
commit
3faa0b3140
@ -1417,20 +1417,7 @@
|
|||||||
submit: function(e) {
|
submit: function(e) {
|
||||||
var data, el, id, msg, op, _i, _len, _ref;
|
var data, el, id, msg, op, _i, _len, _ref;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
data = {
|
|
||||||
board: g.BOARD
|
|
||||||
};
|
|
||||||
_ref = $$('[name]', qr.el);
|
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
|
||||||
el = _ref[_i];
|
|
||||||
if (el.value) {
|
|
||||||
data[el.name] = el.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$('iframe').contentWindow.postMessage(JSON.stringify(data), '*');
|
|
||||||
return;
|
|
||||||
if (msg = qr.postInvalid()) {
|
if (msg = qr.postInvalid()) {
|
||||||
e.preventDefault();
|
|
||||||
alert(msg);
|
alert(msg);
|
||||||
if (msg === 'You forgot to type in the verification.') {
|
if (msg === 'You forgot to type in the verification.') {
|
||||||
$('#recaptcha_response_field', qr.el).focus();
|
$('#recaptcha_response_field', qr.el).focus();
|
||||||
@ -1448,17 +1435,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.id !== 'qr_form') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!e) {
|
|
||||||
this.submit();
|
|
||||||
}
|
|
||||||
$('#error', qr.el).textContent = '';
|
$('#error', qr.el).textContent = '';
|
||||||
if (conf['Auto Hide QR']) {
|
if (conf['Auto Hide QR']) {
|
||||||
$('#autohide', qr.el).checked = true;
|
$('#autohide', qr.el).checked = true;
|
||||||
}
|
}
|
||||||
return qr.sage = /sage/i.test($('input[name=email]', this).value);
|
qr.sage = /sage/i.test($('input[name=email]', this).value);
|
||||||
|
data = {
|
||||||
|
board: g.BOARD
|
||||||
|
};
|
||||||
|
_ref = $$('[name]', qr.el);
|
||||||
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
|
el = _ref[_i];
|
||||||
|
if (el.value) {
|
||||||
|
data[el.name] = el.value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $('iframe').contentWindow.postMessage(JSON.stringify(data), '*');
|
||||||
},
|
},
|
||||||
foo: function() {
|
foo: function() {
|
||||||
var body, data, href, node, textContent, _ref;
|
var body, data, href, node, textContent, _ref;
|
||||||
@ -1474,7 +1466,18 @@
|
|||||||
} else {
|
} else {
|
||||||
data = '';
|
data = '';
|
||||||
}
|
}
|
||||||
return parent.postMessage(data, '*');
|
$('#error').textContent = data;
|
||||||
|
return $.globalEval(function() {
|
||||||
|
data = document.getElementById('error').textContent;
|
||||||
|
return parent.postMessage(data, '*');
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
http://code.google.com/p/chromium/issues/detail?id=20773
|
||||||
|
Let content scripts see other frames (instead of them being undefined)
|
||||||
|
|
||||||
|
To access the parent, we have to break out of the sandbox and evaluate
|
||||||
|
in the global context.
|
||||||
|
*/
|
||||||
},
|
},
|
||||||
sysMessage: function(e) {
|
sysMessage: function(e) {
|
||||||
var board, data, formData, key, val, x;
|
var board, data, formData, key, val, x;
|
||||||
@ -1489,33 +1492,16 @@
|
|||||||
return x = $.xhr("http://sys.4chan.org/" + board + "/post", qr.foo, formData);
|
return x = $.xhr("http://sys.4chan.org/" + board + "/post", qr.foo, formData);
|
||||||
},
|
},
|
||||||
sys: function() {
|
sys: function() {
|
||||||
var c, duration, id, noko, recaptcha, sage, search, thread, url, watch, _, _ref, _ref2;
|
var c, duration, error, id, noko, recaptcha, sage, search, thread, url, watch, _, _ref, _ref2;
|
||||||
$.bind(window, 'message', qr.sysMessage);
|
|
||||||
return;
|
|
||||||
if (recaptcha = $('#recaptcha_response_field')) {
|
if (recaptcha = $('#recaptcha_response_field')) {
|
||||||
$.bind(recaptcha, 'keydown', Recaptcha.listener);
|
$.bind(recaptcha, 'keydown', Recaptcha.listener);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
$.bind(window, 'message', qr.sysMessage);
|
||||||
http://code.google.com/p/chromium/issues/detail?id=20773
|
error = $.el('span', {
|
||||||
Let content scripts see other frames (instead of them being undefined)
|
id: 'error'
|
||||||
|
|
||||||
To access the parent, we have to break out of the sandbox and evaluate
|
|
||||||
in the global context.
|
|
||||||
*/
|
|
||||||
$.globalEval(function() {
|
|
||||||
var data, href, 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
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
data = '';
|
|
||||||
}
|
|
||||||
return parent.postMessage(data, '*');
|
|
||||||
});
|
});
|
||||||
|
$.append(d.body, error);
|
||||||
c = (_ref = $('b')) != null ? _ref.lastChild : void 0;
|
c = (_ref = $('b')) != null ? _ref.lastChild : void 0;
|
||||||
if (!(c && c.nodeType === 8)) {
|
if (!(c && c.nodeType === 8)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -1163,18 +1163,7 @@ qr =
|
|||||||
submit: (e) ->
|
submit: (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
data =
|
|
||||||
board: g.BOARD
|
|
||||||
|
|
||||||
for el in $$ '[name]', qr.el when el.value
|
|
||||||
data[el.name] = el.value
|
|
||||||
|
|
||||||
$('iframe').contentWindow.postMessage JSON.stringify(data), '*'
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
if msg = qr.postInvalid()
|
if msg = qr.postInvalid()
|
||||||
e.preventDefault()
|
|
||||||
alert msg
|
alert msg
|
||||||
if msg is 'You forgot to type in the verification.'
|
if msg is 'You forgot to type in the verification.'
|
||||||
$('#recaptcha_response_field', qr.el).focus()
|
$('#recaptcha_response_field', qr.el).focus()
|
||||||
@ -1189,13 +1178,18 @@ qr =
|
|||||||
if $('img.favicon', op).src is Favicon.empty
|
if $('img.favicon', op).src is Favicon.empty
|
||||||
watcher.watch op, id
|
watcher.watch op, id
|
||||||
|
|
||||||
return unless @id is 'qr_form'
|
|
||||||
|
|
||||||
if !e then @submit()
|
|
||||||
$('#error', qr.el).textContent = ''
|
$('#error', qr.el).textContent = ''
|
||||||
$('#autohide', qr.el).checked = true if conf['Auto Hide QR']
|
$('#autohide', qr.el).checked = true if conf['Auto Hide QR']
|
||||||
qr.sage = /sage/i.test $('input[name=email]', @).value
|
qr.sage = /sage/i.test $('input[name=email]', @).value
|
||||||
|
|
||||||
|
data =
|
||||||
|
board: g.BOARD
|
||||||
|
|
||||||
|
for el in $$ '[name]', qr.el when el.value
|
||||||
|
data[el.name] = el.value
|
||||||
|
|
||||||
|
$('iframe').contentWindow.postMessage JSON.stringify(data), '*'
|
||||||
|
|
||||||
foo: ->
|
foo: ->
|
||||||
body = $.el 'body',
|
body = $.el 'body',
|
||||||
innerHTML: @responseText
|
innerHTML: @responseText
|
||||||
@ -1205,7 +1199,19 @@ qr =
|
|||||||
data = JSON.stringify {textContent, href}
|
data = JSON.stringify {textContent, href}
|
||||||
else
|
else
|
||||||
data = ''
|
data = ''
|
||||||
parent.postMessage data, '*'
|
$('#error').textContent = data
|
||||||
|
|
||||||
|
$.globalEval ->
|
||||||
|
data = document.getElementById('error').textContent
|
||||||
|
parent.postMessage data, '*'
|
||||||
|
|
||||||
|
###
|
||||||
|
http://code.google.com/p/chromium/issues/detail?id=20773
|
||||||
|
Let content scripts see other frames (instead of them being undefined)
|
||||||
|
|
||||||
|
To access the parent, we have to break out of the sandbox and evaluate
|
||||||
|
in the global context.
|
||||||
|
###
|
||||||
|
|
||||||
sysMessage: (e) ->
|
sysMessage: (e) ->
|
||||||
data = JSON.parse e.data
|
data = JSON.parse e.data
|
||||||
@ -1219,28 +1225,13 @@ qr =
|
|||||||
x = $.xhr "http://sys.4chan.org/#{board}/post", qr.foo, formData
|
x = $.xhr "http://sys.4chan.org/#{board}/post", qr.foo, formData
|
||||||
|
|
||||||
sys: ->
|
sys: ->
|
||||||
$.bind window, 'message', qr.sysMessage
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
if recaptcha = $ '#recaptcha_response_field' #post reporting
|
if recaptcha = $ '#recaptcha_response_field' #post reporting
|
||||||
$.bind recaptcha, 'keydown', Recaptcha.listener
|
$.bind recaptcha, 'keydown', Recaptcha.listener
|
||||||
return
|
return
|
||||||
|
|
||||||
###
|
$.bind window, 'message', qr.sysMessage
|
||||||
http://code.google.com/p/chromium/issues/detail?id=20773
|
error = $.el 'span', id: 'error'
|
||||||
Let content scripts see other frames (instead of them being undefined)
|
$.append d.body, error
|
||||||
|
|
||||||
To access the parent, we have to break out of the sandbox and evaluate
|
|
||||||
in the global context.
|
|
||||||
###
|
|
||||||
$.globalEval ->
|
|
||||||
if node = document.querySelector('table font b')?.firstChild
|
|
||||||
{textContent, href} = node
|
|
||||||
data = JSON.stringify {textContent, href}
|
|
||||||
else
|
|
||||||
data = ''
|
|
||||||
parent.postMessage data, '*'
|
|
||||||
|
|
||||||
c = $('b')?.lastChild
|
c = $('b')?.lastChild
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user