// ascii.io - embeddable player (function() { function receiveSize(e) { if (e.origin === document.location.protocol + "//<%= request.host %>") { var event = e.data[0]; var data = e.data[1]; if (event == 'asciicast:size' && data.id == <%= @asciicast.id %>) { var player = document.getElementById("asciicast-iframe-<%= @asciicast.id %>"); if (player) { player.style.width = data.width; player.style.height = data.height; } } } } function insertAfter(referenceNode, newNode) { referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); } window.addEventListener("message", receiveSize, false); var scriptTag = document.getElementById("asciicast-<%= @asciicast.id %>"); if (scriptTag) { var container = document.createElement('div'); container.className = 'asciicast'; container.style.display = 'block'; container.style.float = 'none'; container.style.overflow = 'hidden'; container.innerHTML = ''; insertAfter(scriptTag, container); } })();