A platform for community discussion. Free, open, simple.
read embed state info from data attribute
Christoph Holtermanne874afaf3180
diff --git a/app/views/layouts/embed.html.erb b/app/views/layouts/embed.html.erbindex cb1feab05a6..870b1656726 100644--- a/app/views/layouts/embed.html.erb+++ b/app/views/layouts/embed.html.erb@@ -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 statepostUp({type: 'discourse-resize', height: document['body'].offsetHeight, state: state});var postLinks = document.querySelectorAll("a[data-link-to-post]"),