Files
talk/views/article.ejs
T
2017-01-25 17:44:21 -05:00

71 lines
2.5 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>
<title><%= title %></title>
</head>
<body>
<main>
<h1><%= title %></h1>
<p><%= body %></p>
<p><a href="/admin">Admin</a> - <a href="/assets">All Assets</a></p>
<div id='coralStreamEmbed'></div>
</main>
<script type='text/javascript' src='<%= basePath %>/pym.v1.min.js'></script>
<script>
var ready = false;
// default to using the window.location
var url = window.location.protocol + '//' + window.location.host + window.location.pathname;
// if a url is passed into the template prefer it to the current url
<%if (asset_url.length > 0) { %>
url = '<%= asset_url %>';
<%}%>
var pymParent = new pym.Parent('coralStreamEmbed', '/embed/stream?asset_url=' + encodeURIComponent(url), {title: 'Talk Comments', id:'coralStreamIframe', name: 'coralStreamIframe', asset_url: url});
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);
// default to using the window.location
var url = window.location.hash;
// if a url is passed into the template prefer it to the current url
<%if (asset_url.length > 0) { %>
url = '<%= asset_url %>';
<%}%>
pymParent.sendMessage('DOMContentLoaded', url);
}
}, 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 () {
ready = true;
});
</script>
</body>
</html>