FIX: Links in the iframe should all be target=_blank

This commit is contained in:
Robin Ward 2014-03-20 10:57:18 -04:00
parent 764ba152d1
commit 375719edfb

View File

@ -31,10 +31,18 @@
// Send a post message with our loaded height // Send a post message with our loaded height
postUp({type: 'discourse-resize', height: document['body'].offsetHeight}); postUp({type: 'discourse-resize', height: document['body'].offsetHeight});
var postLinks = document.querySelectorAll("a[data-link-to-post]"); var postLinks = document.querySelectorAll("a[data-link-to-post]"),
for (var i=0; i<postLinks.length; i++) { i;
for (i=0; i<postLinks.length; i++) {
postLinks[i].onclick = clickPostLink; postLinks[i].onclick = clickPostLink;
} }
// 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";
}
}; };
})(); })();
@ -43,4 +51,4 @@
<body> <body>
<%= yield %> <%= yield %>
</body> </body>
</html> </html>