Files
talk/views/article.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

57 lines
2.2 KiB
Plaintext

<html>
<head>
<meta property="og:title" content="<%= title %>" />
<meta property="og:description" content="A description of this article." />
<meta property="article:author" content="A. J. Ournalist" />
<meta property="og:type" content="article">
<meta property="og:image" content="https://coralproject.net/images/splash-md.jpg">
<meta property="article:published" itemprop="datePublished" content="2016-11-16T11:46:06-05:00" />
<meta property="article:modified" itemprop="dateModified" content="2016-11-16T12:09:44-05:00" />
<meta property="article:section" itemprop="articleSection" content="The Section!" />
<style>
main {
margin-left:auto;
margin-right:auto;
width:500px;
}
</style>
</head>
<body>
<main>
<h1><%= title %></h1>
<p>
Lorem ipsum dolor sponge amet, consectetur adipiscing clam.
Ut lobortis sollicitudin pillar a ornare. Curabitur dignissim
vestibulum cay non rhoncus. Cras laoreet ante vel nunc hendrerit,
shelf imperdiet neque egestas. Suspendisse aliquet iaculis fermentum.
Talk volutpat, tellus posuere laoreet consequat, mi lacus laoreet massa,
sed vehicula mauris velit non lectus. Integer non trust nec neque congue
faucibus porttitor sit amet elkhorn.
</p>
<p><a href="/admin">Visit the moderation console</a></p>
<div id='coralStreamEmbed'></div>
</main>
<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 () {
ready = true;
});
</script>
</body>
</html>