2013-12-31 13:37:43 -06:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<%= stylesheet_link_tag 'embed' %>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
(function() {
|
2014-01-03 13:45:22 -06:00
|
|
|
|
|
|
|
function postUp(msg) {
|
2013-12-31 13:37:43 -06:00
|
|
|
if (parent) {
|
2014-01-03 13:45:22 -06:00
|
|
|
parent.postMessage(msg, '<%= request.referer %>');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function clickPostLink(e) {
|
|
|
|
var postId = e.target.getAttribute('data-link-to-post');
|
|
|
|
if (postId) {
|
|
|
|
var postElement = document.getElementById('post-' + postId);
|
|
|
|
if (postElement) {
|
|
|
|
var rect = postElement.getBoundingClientRect();
|
|
|
|
if (rect && rect.top) {
|
|
|
|
postUp({type: 'discourse-scroll', top: rect.top});
|
|
|
|
e.preventDefault();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2013-12-31 13:37:43 -06:00
|
|
|
}
|
|
|
|
}
|
2014-01-03 13:45:22 -06:00
|
|
|
|
|
|
|
window.onload = function() {
|
|
|
|
// Send a post message with our loaded height
|
|
|
|
postUp({type: 'discourse-resize', height: document['body'].offsetHeight});
|
|
|
|
|
|
|
|
var postLinks = document.querySelectorAll("a[data-link-to-post]");
|
|
|
|
for (var i=0; i<postLinks.length; i++) {
|
|
|
|
postLinks[i].onclick = clickPostLink;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-12-31 13:37:43 -06:00
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<%= yield %>
|
|
|
|
</body>
|
|
|
|
</html>
|