2013-12-31 14:37:43 -05:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<%= stylesheet_link_tag 'embed' %>
|
2014-03-20 14:34:51 -04:00
|
|
|
<%= javascript_include_tag 'break_string' %>
|
2013-12-31 14:37:43 -05:00
|
|
|
|
|
|
|
<script>
|
|
|
|
(function() {
|
2014-01-03 14:45:22 -05:00
|
|
|
|
|
|
|
function postUp(msg) {
|
2013-12-31 14:37:43 -05:00
|
|
|
if (parent) {
|
2014-01-03 14:45:22 -05: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 14:37:43 -05:00
|
|
|
}
|
|
|
|
}
|
2014-01-03 14:45:22 -05:00
|
|
|
|
|
|
|
window.onload = function() {
|
|
|
|
// Send a post message with our loaded height
|
|
|
|
postUp({type: 'discourse-resize', height: document['body'].offsetHeight});
|
|
|
|
|
2014-03-20 10:57:18 -04:00
|
|
|
var postLinks = document.querySelectorAll("a[data-link-to-post]"),
|
|
|
|
i;
|
|
|
|
|
|
|
|
for (i=0; i<postLinks.length; i++) {
|
2014-01-03 14:45:22 -05:00
|
|
|
postLinks[i].onclick = clickPostLink;
|
|
|
|
}
|
2014-03-20 10:57:18 -04:00
|
|
|
|
|
|
|
// Make sure all links in the iframe point to _blank
|
|
|
|
var cookedLinks = document.querySelectorAll('.cooked a');
|
|
|
|
for (i=0; i<cookedLinks.length; i++) {
|
|
|
|
cookedLinks[i].target = "_blank";
|
|
|
|
}
|
2014-03-20 14:34:51 -04:00
|
|
|
|
|
|
|
// Adjust all names
|
2014-03-20 16:04:50 -04:00
|
|
|
var names = document.querySelectorAll('.username a');
|
2014-03-20 14:34:51 -04:00
|
|
|
for (i=0; i<names.length; i++) {
|
|
|
|
var username = names[i].innerHTML;
|
|
|
|
if (username) {
|
|
|
|
names[i].innerHTML = new BreakString(username).break();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-03 14:45:22 -05:00
|
|
|
};
|
|
|
|
|
2013-12-31 14:37:43 -05:00
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<%= yield %>
|
|
|
|
</body>
|
2014-03-20 10:57:18 -04:00
|
|
|
</html>
|