Revert "working in firefox"

This reverts commit bc98665c69c1f8224784510b275a019c517f702b.
This commit is contained in:
James Campos 2011-08-15 22:13:36 -07:00
parent 827d1f0987
commit ca59d3c50f
2 changed files with 11 additions and 94 deletions

View File

@ -307,13 +307,12 @@
$.append(d.head, script);
return $.rm(script);
},
xhr: function(url, cb, body) {
var method, r;
method = body ? 'post' : 'get';
xhr: function(url, cb) {
var r;
r = new XMLHttpRequest();
r.onload = cb;
r.open(method, url, true);
r.send(body);
r.open('get', url, true);
r.send();
return r;
},
cache: function(url, cb) {
@ -1225,8 +1224,7 @@
qr.captchaTime = Date.now();
iframe = $.el('iframe', {
name: 'iframe',
hidden: true,
src: 'http://sys.4chan.org/post'
hidden: true
});
$.append(d.body, iframe);
return $('#recaptcha_response_field').id = '';
@ -1313,6 +1311,7 @@
message: function(e) {
var data, duration, fileCount;
Recaptcha.reload();
$('iframe[name=iframe]').src = 'about:blank';
fileCount = $('#files', qr.el).childElementCount;
data = e.data;
if (data) {
@ -1414,20 +1413,7 @@
return $('input[name=pwd]', qr.el).value = (m = c.match(/4chan_pass=([^;]+)/)) ? decodeURIComponent(m[1]) : $('input[name=pwd]').value;
},
submit: function(e) {
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;
var id, msg, op;
if (msg = qr.postInvalid()) {
e.preventDefault();
alert(msg);
@ -1459,38 +1445,8 @@
}
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() {
var c, duration, id, noko, recaptcha, sage, search, thread, url, watch, _, _ref, _ref2;
$.bind(window, 'message', qr.sysMessage);
return;
if (recaptcha = $('#recaptcha_response_field')) {
$.bind(recaptcha, 'keydown', Recaptcha.listener);
return;

View File

@ -213,12 +213,11 @@ $.extend $,
textContent: "(#{code})()"
$.append d.head, script
$.rm script
xhr: (url, cb, body) ->
method = if body then 'post' else 'get'
xhr: (url, cb) ->
r = new XMLHttpRequest()
r.onload = cb
r.open method, url, true
r.send(body)
r.open 'get', url, true
r.send()
r
cache: (url, cb) ->
if req = $.cache.requests[url]
@ -974,7 +973,6 @@ qr =
iframe = $.el 'iframe',
name: 'iframe'
hidden: true
src: 'http://sys.4chan.org/post'
$.append d.body, iframe
#hack - nuke id so it doesn't grab focus when reloading
@ -1070,6 +1068,7 @@ qr =
message: (e) ->
Recaptcha.reload()
$('iframe[name=iframe]').src = 'about:blank'
fileCount = $('#files', qr.el).childElementCount
{data} = e
@ -1161,18 +1160,6 @@ qr =
$('input[name=pwd]', qr.el).value = if m = c.match(/4chan_pass=([^;]+)/) then decodeURIComponent m[1] else $('input[name=pwd]').value
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()
e.preventDefault()
alert msg
@ -1196,33 +1183,7 @@ qr =
$('#autohide', qr.el).checked = true if conf['Auto Hide QR']
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: ->
$.bind window, 'message', qr.sysMessage
return
if recaptcha = $ '#recaptcha_response_field' #post reporting
$.bind recaptcha, 'keydown', Recaptcha.listener
return