mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-24 08:09:13 -05:00
46 lines
No EOL
1.2 KiB
Text
46 lines
No EOL
1.2 KiB
Text
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<%= stylesheet_link_tag 'embed' %>
|
|
|
|
<script>
|
|
(function() {
|
|
|
|
function postUp(msg) {
|
|
if (parent) {
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
};
|
|
|
|
})();
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<%= yield %>
|
|
</body>
|
|
</html> |