From 966b84ea71855e0e5f415f6e3a855f7997119731 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Wed, 25 Jan 2012 18:31:00 +0100 Subject: [PATCH] Reload the iframe on connection error. --- 4chan_x.user.js | 9 +++++++-- script.coffee | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index fad9cee6a..1880e357d 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1191,15 +1191,20 @@ qr = { init: function() { + var iframe; if (!$('form[name=post]')) return; g.callbacks.push(function(root) { return $.on($('.quotejs + .quotejs', root), 'click', qr.quote); }); - $.add(d.body, $.el('iframe', { + iframe = $.el('iframe', { id: 'iframe', hidden: true, src: 'http://sys.4chan.org/post' - })); + }); + $.on(iframe, 'error', function() { + return this.src = this.src; + }); + $.add(d.body, iframe); if (conf['Persistent QR']) { qr.dialog(); if (conf['Auto Hide QR']) qr.hide(); diff --git a/script.coffee b/script.coffee index fa76a1ea2..b31fae8c3 100644 --- a/script.coffee +++ b/script.coffee @@ -861,10 +861,12 @@ qr = return unless $ 'form[name=post]' g.callbacks.push (root) -> $.on $('.quotejs + .quotejs', root), 'click', qr.quote - $.add d.body, $.el 'iframe', + iframe = $.el 'iframe', id: 'iframe' hidden: true src: 'http://sys.4chan.org/post' + $.on iframe, 'error', -> @src = @src + $.add d.body, iframe if conf['Persistent QR'] qr.dialog() qr.hide() if conf['Auto Hide QR']