emit resize message in iframes

This commit is contained in:
HookedBehemoth 2022-06-19 23:39:06 +02:00
parent 5e827c91aa
commit 06679c6f64
2 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1,9 @@
window.addEventListener('load', (event) => {
window.parent.postMessage(["resizeIframe",
{
"url": document.baseURI,
"w": document.body.offsetWidth,
"h": document.body.offsetHeight
}
], "*");
})

View File

@ -374,5 +374,6 @@ proc renderTweetEmbed*(tweet: Tweet; path: string; prefs: Prefs; cfg: Config; re
body:
tdiv(class="tweet-embed"):
renderTweet(tweet, prefs, path, mainTweet=true)
script(src="/js/iframeResize.js", `defer`="")
result = doctype & $node