read embed state info from data attribute

This commit is contained in:
Christoph Holtermann
2017-11-15 18:59:46 +01:00
committed by Sam
parent 6eb0b310fe
commit e874afaf31

View File

@@ -37,12 +37,15 @@
}
}
window.onload = function() {
var state = "loading";
if (document.querySelectorAll("span.replies").length > 0) {
state = "loaded";
}
// Send a post message with our loaded height and state
window.onload = function() {
// get state info from data attribute
var header = document.querySelector('header');
var state = 'unknown';
if (header) {
var state = header.getAttribute('data-embed-state');
}
// Send a post message with our loaded height and state
postUp({type: 'discourse-resize', height: document['body'].offsetHeight, state: state});
var postLinks = document.querySelectorAll("a[data-link-to-post]"),