working in firefox
This commit is contained in:
parent
32bce42201
commit
bc98665c69
@ -308,12 +308,13 @@
|
|||||||
$.append(d.head, script);
|
$.append(d.head, script);
|
||||||
return $.rm(script);
|
return $.rm(script);
|
||||||
},
|
},
|
||||||
xhr: function(url, cb) {
|
xhr: function(url, cb, body) {
|
||||||
var r;
|
var method, r;
|
||||||
|
method = body ? 'post' : 'get';
|
||||||
r = new XMLHttpRequest();
|
r = new XMLHttpRequest();
|
||||||
r.onload = cb;
|
r.onload = cb;
|
||||||
r.open('get', url, true);
|
r.open(method, url, true);
|
||||||
r.send();
|
r.send(body);
|
||||||
return r;
|
return r;
|
||||||
},
|
},
|
||||||
cache: function(url, cb) {
|
cache: function(url, cb) {
|
||||||
@ -1225,7 +1226,8 @@
|
|||||||
qr.captchaTime = Date.now();
|
qr.captchaTime = Date.now();
|
||||||
iframe = $.el('iframe', {
|
iframe = $.el('iframe', {
|
||||||
name: 'iframe',
|
name: 'iframe',
|
||||||
hidden: true
|
hidden: true,
|
||||||
|
src: 'http://sys.4chan.org/post'
|
||||||
});
|
});
|
||||||
$.append(d.body, iframe);
|
$.append(d.body, iframe);
|
||||||
return $('#recaptcha_response_field').id = '';
|
return $('#recaptcha_response_field').id = '';
|
||||||
@ -1312,7 +1314,6 @@
|
|||||||
message: function(e) {
|
message: function(e) {
|
||||||
var data, duration, fileCount;
|
var data, duration, fileCount;
|
||||||
Recaptcha.reload();
|
Recaptcha.reload();
|
||||||
$('iframe[name=iframe]').src = 'about:blank';
|
|
||||||
fileCount = $('#files', qr.el).childElementCount;
|
fileCount = $('#files', qr.el).childElementCount;
|
||||||
data = e.data;
|
data = e.data;
|
||||||
if (data) {
|
if (data) {
|
||||||
@ -1414,7 +1415,20 @@
|
|||||||
return $('input[name=pwd]', qr.el).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
|
return $('input[name=pwd]', qr.el).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
|
||||||
},
|
},
|
||||||
submit: function(e) {
|
submit: function(e) {
|
||||||
var id, msg, op;
|
var data, el, id, msg, op, _i, _len, _ref;
|
||||||
|
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();
|
e.preventDefault();
|
||||||
alert(msg);
|
alert(msg);
|
||||||
@ -1446,8 +1460,38 @@
|
|||||||
}
|
}
|
||||||
return qr.sage = /sage/i.test($('input[name=email]', this).value);
|
return qr.sage = /sage/i.test($('input[name=email]', this).value);
|
||||||
},
|
},
|
||||||
|
foo: function() {
|
||||||
|
var body, data, href, node, textContent, _ref;
|
||||||
|
body = $.el('body', {
|
||||||
|
innerHTML: this.responseText
|
||||||
|
});
|
||||||
|
if (node = (_ref = $('table font b', body)) != null ? _ref.firstChild : void 0) {
|
||||||
|
textContent = node.textContent, href = node.href;
|
||||||
|
data = JSON.stringify({
|
||||||
|
textContent: textContent,
|
||||||
|
href: href
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
data = '';
|
||||||
|
}
|
||||||
|
return parent.postMessage(data, '*');
|
||||||
|
},
|
||||||
|
sysMessage: function(e) {
|
||||||
|
var board, data, formData, key, val, x;
|
||||||
|
data = JSON.parse(e.data);
|
||||||
|
board = data.board;
|
||||||
|
delete data.board;
|
||||||
|
formData = new FormData();
|
||||||
|
for (key in data) {
|
||||||
|
val = data[key];
|
||||||
|
formData.append(key, val);
|
||||||
|
}
|
||||||
|
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, 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;
|
||||||
|
|||||||
@ -213,11 +213,12 @@ $.extend $,
|
|||||||
textContent: "(#{code})()"
|
textContent: "(#{code})()"
|
||||||
$.append d.head, script
|
$.append d.head, script
|
||||||
$.rm script
|
$.rm script
|
||||||
xhr: (url, cb) ->
|
xhr: (url, cb, body) ->
|
||||||
|
method = if body then 'post' else 'get'
|
||||||
r = new XMLHttpRequest()
|
r = new XMLHttpRequest()
|
||||||
r.onload = cb
|
r.onload = cb
|
||||||
r.open 'get', url, true
|
r.open method, url, true
|
||||||
r.send()
|
r.send(body)
|
||||||
r
|
r
|
||||||
cache: (url, cb) ->
|
cache: (url, cb) ->
|
||||||
if req = $.cache.requests[url]
|
if req = $.cache.requests[url]
|
||||||
@ -973,6 +974,7 @@ qr =
|
|||||||
iframe = $.el 'iframe',
|
iframe = $.el 'iframe',
|
||||||
name: 'iframe'
|
name: 'iframe'
|
||||||
hidden: true
|
hidden: true
|
||||||
|
src: 'http://sys.4chan.org/post'
|
||||||
$.append d.body, iframe
|
$.append d.body, iframe
|
||||||
|
|
||||||
#hack - nuke id so it doesn't grab focus when reloading
|
#hack - nuke id so it doesn't grab focus when reloading
|
||||||
@ -1068,7 +1070,6 @@ qr =
|
|||||||
|
|
||||||
message: (e) ->
|
message: (e) ->
|
||||||
Recaptcha.reload()
|
Recaptcha.reload()
|
||||||
$('iframe[name=iframe]').src = 'about:blank'
|
|
||||||
fileCount = $('#files', qr.el).childElementCount
|
fileCount = $('#files', qr.el).childElementCount
|
||||||
|
|
||||||
{data} = e
|
{data} = e
|
||||||
@ -1160,6 +1161,18 @@ qr =
|
|||||||
$('input[name=pwd]', qr.el).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
|
$('input[name=pwd]', qr.el).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
|
||||||
|
|
||||||
submit: (e) ->
|
submit: (e) ->
|
||||||
|
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()
|
e.preventDefault()
|
||||||
alert msg
|
alert msg
|
||||||
@ -1183,7 +1196,33 @@ qr =
|
|||||||
$('#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
|
||||||
|
|
||||||
|
foo: ->
|
||||||
|
body = $.el 'body',
|
||||||
|
innerHTML: @responseText
|
||||||
|
|
||||||
|
if node = $('table font b', body)?.firstChild
|
||||||
|
{textContent, href} = node
|
||||||
|
data = JSON.stringify {textContent, href}
|
||||||
|
else
|
||||||
|
data = ''
|
||||||
|
parent.postMessage data, '*'
|
||||||
|
|
||||||
|
sysMessage: (e) ->
|
||||||
|
data = JSON.parse e.data
|
||||||
|
{board} = data
|
||||||
|
delete data.board
|
||||||
|
|
||||||
|
formData = new FormData()
|
||||||
|
for key, val of data
|
||||||
|
formData.append key, val
|
||||||
|
|
||||||
|
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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user