43 lines
1.1 KiB
Plaintext
43 lines
1.1 KiB
Plaintext
<div class="player"></div>
|
|
|
|
<p class="processing-info" style="display: none">
|
|
This recording is being pre-processed at the moment. It will open automatically in a few seconds.
|
|
</p>
|
|
|
|
<script>
|
|
$(function() {
|
|
var model = new Asciinema.Asciicast(<%= asciicast.to_json.gsub('</', '<\/').html_safe %>);
|
|
|
|
function createPlayer() {
|
|
asciinema.CreatePlayer(
|
|
$('.player')[0],
|
|
model.get('width'), model.get('height'),
|
|
model.get('stdout_frames_url'),
|
|
model.get('duration'),
|
|
{
|
|
snapshot: model.get('snapshot'),
|
|
speed: <%= options.speed %>,
|
|
autoPlay: <%= options.autoplay %>,
|
|
loop: <%= options.loop %>,
|
|
fontSize: '<%= options.size %>',
|
|
theme: '<%= h options.theme %>'
|
|
}
|
|
);
|
|
}
|
|
|
|
function tryCreatePlayer() {
|
|
if (model.get('stdout_frames_url')) {
|
|
$('.processing-info').remove();
|
|
createPlayer();
|
|
} else {
|
|
$('.processing-info').show();
|
|
setTimeout(function() {
|
|
model.fetch({ success: tryCreatePlayer });
|
|
}, 2000);
|
|
}
|
|
}
|
|
|
|
tryCreatePlayer();
|
|
});
|
|
</script>
|