Files
talk/views/embed-stream.ejs
T
2017-01-24 16:04:03 -05:00

49 lines
1.6 KiB
Plaintext

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<title>Talk - Coral Admin</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.2.1/material.indigo-pink.min.css">
<link rel="stylesheet" href="<%= basePath %>/default.css">
<style media="screen">
body, #root {
width: 100%;
height: 100%;
min-height: 600px;
margin: 0;
background: #fff;
}
</style>
</head>
<body>
<div id='coralStreamEmbed'></div>
<script type='text/javascript' src='<%= basePath %>/pym.v1.min.js'></script>
<script>
var ready = false;
var pymParent = new pym.Parent('coralStreamEmbed', '/embed/stream', {title: 'Talk Comments'});
pymParent.onMessage('height', function(height) {document.querySelector('#coralStreamEmbed iframe').height = height + 'px'});
pymParent.onMessage('childReady', function () {
var interval = setInterval(function () {
if (ready) {
window.clearInterval(interval);
pymParent.sendMessage('DOMContentLoaded', window.location.hash);
}
}, 100);
}
pymParent.onMessage('navigate', function (url) {
window.open(url, '_blank').focus();
})
);
// wait till images and other iframes are loaded before scrolling the page.
// or do we want to be more aggressive and scroll when we hit DOM ready?
document.addEventListener('DOMContentLoaded', function (e) {
ready = true;
});
</script>
</body>
</html>