diff --git a/4chan_x.user.js b/4chan_x.user.js
index 5dd0c09ff..cf97ab4ef 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -1208,6 +1208,11 @@
g.callbacks.push(function(root) {
return $.on($('.quotejs + .quotejs', root), 'click', qr.quote);
});
+ $.add(d.body, $.el('iframe', {
+ id: 'iframe',
+ hidden: true,
+ src: 'http://sys.4chan.org/post'
+ }));
if (conf['Persistent QR']) {
qr.dialog();
if (conf['Auto Hide QR']) $.id('autohide').click();
@@ -1498,7 +1503,7 @@
}
});
qr.mimeTypes = mimeTypes.split(', ');
- qr.el = ui.dialog('qr', 'top:0;right:0;', "
");
+ qr.el = ui.dialog('qr', 'top:0;right:0;', "");
if (!g.REPLY) {
$.on($('select', qr.el), 'mousedown', function(e) {
return e.stopPropagation();
@@ -1612,8 +1617,10 @@
script = $.el('script', {
textContent: "window.addEventListener('message'," + code + ",false)"
});
- $.add(d.documentElement, script);
- return $.rm(script);
+ return $.ready(function() {
+ $.add(d.head, script);
+ return $.rm(script);
+ });
},
send: function(data) {
data.changeContext = true;
diff --git a/script.coffee b/script.coffee
index 82570fb50..4782c4a64 100644
--- a/script.coffee
+++ b/script.coffee
@@ -878,6 +878,10 @@ qr =
qr.spoiler = !!$ '#com_submit + label'
g.callbacks.push (root) ->
$.on $('.quotejs + .quotejs', root), 'click', qr.quote
+ $.add d.body, $.el 'iframe',
+ id: 'iframe'
+ hidden: true
+ src: 'http://sys.4chan.org/post'
if conf['Persistent QR']
qr.dialog()
$.id('autohide').click() if conf['Auto Hide QR']
@@ -1126,8 +1130,7 @@ qr =
-
-"
+"
unless g.REPLY
$.on $('select', qr.el), 'mousedown', (e) -> e.stopPropagation()
$.on $('#autohide', qr.el), 'click', qr.hide
@@ -1238,8 +1241,9 @@ qr =
parent.postMessage data, '*'
script = $.el 'script',
textContent: "window.addEventListener('message',#{code},false)"
- $.add d.documentElement, script
- $.rm script
+ $.ready ->
+ $.add d.head, script
+ $.rm script
send: (data) ->
data.changeContext = true
data.qr = true