asciinema.org/app/views/asciicasts/embed.html.slim
2017-06-16 10:34:18 +02:00

34 lines
1016 B
Plaintext

= player page.asciicast, page.playback_options
p.powered
' Powered by
a href=root_url target="_top" asciinema
javascript:
var player = document.getElementById('player');
player.addEventListener('attached', function() {
var target = parent.postMessage ? parent : (parent.document.postMessage ? parent.document : undefined);
if (typeof target != "undefined" && window !== window.parent) {
var w = player.getElementsByClassName('asciinema-player')[0].offsetWidth;
var h = Math.max(document.body.scrollHeight, document.body.offsetHeight);
target.postMessage(['asciicast:size', { width: w, height: h }], '*');
}
function onMessage(e) {
if (e.data == 'asciicast:play' || e.data[0] == 'asciicast:play') {
player.play();
}
// reveal.js support
if (e.data == 'slide:start') {
player.play();
} else if (e.data == 'slide:stop') {
player.pause();
}
}
window.addEventListener("message", onMessage, false);
});