Handle http/s for iframes depending on the normal post form's protocol.

This commit is contained in:
Nicolas Stepien 2012-03-26 01:27:36 +02:00
parent 64f8b86b45
commit 7ac8f016f3
2 changed files with 7 additions and 5 deletions

View File

@ -1226,7 +1226,7 @@
return setTimeout(this.asyncInit);
},
asyncInit: function() {
var form, iframe, link, loadChecking, script;
var form, iframe, link, loadChecking, script, src;
if (Conf['Hide Original Post Form']) {
link = $.el('h1', {
innerHTML: "<a href=javascript:;>" + (g.REPLY ? 'Quick Reply' : 'New Thread') + "</a>"
@ -1244,9 +1244,10 @@
ready: true
});
} else {
src = "http" + (/^https/.test(form.action) ? 's' : '') + "://sys.4chan.org/robots.txt";
iframe = $.el('iframe', {
id: 'iframe',
src: 'https://sys.4chan.org/robots.txt'
src: src
});
$.on(iframe, 'error', function() {
return this.src = this.src;
@ -1255,7 +1256,7 @@
if (!QR.status.ready) {
iframe.src = 'about:blank';
return setTimeout((function() {
return iframe.src = 'https://sys.4chan.org/robots.txt';
return iframe.src = src;
}), 100);
}
};

View File

@ -1023,15 +1023,16 @@ QR =
if /chrome/i.test navigator.userAgent
QR.status ready: true
else
src = "http#{if /^https/.test form.action then 's' else ''}://sys.4chan.org/robots.txt"
iframe = $.el 'iframe',
id: 'iframe'
src: 'https://sys.4chan.org/robots.txt'
src: src
$.on iframe, 'error', -> @src = @src
# Greasemonkey ghetto fix
loadChecking = (iframe) ->
unless QR.status.ready
iframe.src = 'about:blank'
setTimeout (-> iframe.src = 'https://sys.4chan.org/robots.txt'), 100
setTimeout (-> iframe.src = src), 100
$.on iframe, 'load', -> if @src isnt 'about:blank' then setTimeout loadChecking, 500, @
$.add d.head, iframe