Fix embedded player iframe resizing under https

This commit is contained in:
Marcin Kulik 2014-01-18 15:35:24 +01:00
parent 9e5a7c8d22
commit 219d8f1c3f

View File

@ -1,10 +1,11 @@
// asciinema.org - embeddable player
(function() {
var apiUrl = "<%= request.protocol %><%= request.host_with_port %>";
var iframe;
function receiveSize(e) {
if (e.origin === document.location.protocol + "//<%= request.host_with_port %>") {
if (e.origin === apiUrl) {
var event = e.data[0];
var data = e.data[1];
if (event == 'asciicast:size' && data.id == <%= @asciicast.id %>) {
@ -50,7 +51,7 @@
insertAfter(script, container);
iframe = document.createElement('iframe');
iframe.src = "<%= request.protocol %><%= request.host_with_port %>/a/<%= @asciicast.id %>/bare" + params(container, script);
iframe.src = apiUrl + "/a/<%= @asciicast.id %>/bare" + params(container, script);
iframe.id = "asciicast-iframe-<%= @asciicast.id %>";
iframe.name = "asciicast-iframe-<%= @asciicast.id %>";
iframe.scrolling = "no";