mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
read embed state info from data attribute
This commit is contained in:
committed by
Sam
parent
6eb0b310fe
commit
e874afaf31
@@ -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]"),
|
||||
|
||||
Reference in New Issue
Block a user