Fix error/success checking for Firefox. WHY do you people still use this garbage.

Apparently, I cannot message the object once again, unless I recreate it for who the hell knows what reason.
Fuck that shit.
This commit is contained in:
Nicolas Stepien 2012-01-24 12:15:35 +01:00
parent 8a4cdb7d09
commit 64a3e4284a
2 changed files with 22 additions and 8 deletions

View File

@ -1624,18 +1624,27 @@
init: function() {
var code;
code = function(e) {
var data, host;
var data, host, i, o, u;
data = e.data;
if (!data.changeContext) return;
delete data.changeContext;
host = location.hostname;
o = {};
for (i in data) {
u = data[i];
o[i] = u;
}
if (host === 'boards.4chan.org') {
return document.getElementById('iframe').contentWindow.postMessage(data, '*');
return document.getElementById('iframe').contentWindow.postMessage(o, '*');
} else if (host === 'sys.4chan.org') {
return parent.postMessage(data, '*');
return parent.postMessage(o, '*');
}
};
return window.location = "javascript:window.addEventListener('message'," + code + ",false)";
if (engine === 'gecko') {
return $.on(window, 'message', code);
} else {
return window.location = "javascript:window.addEventListener('message'," + code + ",false)";
}
},
send: function(data) {
data.changeContext = true;

View File

@ -100,7 +100,6 @@ config =
'Auto Update': [true, 'Automatically fetch new posts']
'Interval': 30
# XXX Chrome can't into {log} = console
# XXX GreaseMonkey can't into console.log.bind
log = console.log.bind? console
@ -1248,12 +1247,18 @@ qr =
return unless data.changeContext
delete data.changeContext
host = location.hostname
o = {}
for i, u of data
o[i] = u
if host is 'boards.4chan.org'
document.getElementById('iframe').contentWindow.postMessage data, '*'
document.getElementById('iframe').contentWindow.postMessage o, '*'
else if host is 'sys.4chan.org'
parent.postMessage data, '*'
parent.postMessage o, '*'
# do not wait for 4chan to load
window.location = "javascript:window.addEventListener('message',#{code},false)"
if engine is 'gecko'
$.on window, 'message', code
else
window.location = "javascript:window.addEventListener('message',#{code},false)"
send: (data) ->
data.changeContext = true
data.qr = true