Files
talk/views/embed-stream.ejs
T
Riley Davis ef172cabfc Scroll to comment (#92)
* host pym locally

* host pym. fix some permalink styles

* get url from parent document

* reset copy dialog timeout

* use pym.parentUrl instead of depending on the parent document

* use a simpler method to find the url

* add some horrible setInterval code

* add some awesome polling

* merge master

* bail out of comment look up after 10 seconds

* re-update permalink attrs

* re-add my listeners to article.ejs

* allow for overriding the talk db name in an environment var
2016-11-29 17:19:56 -05:00

45 lines
1.5 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);
});
// 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>