Skip to content

Commit

Permalink
Updated blocksi-embed.js
Browse files Browse the repository at this point in the history
  • Loading branch information
coder0107git committed Sep 12, 2024
1 parent f5d4108 commit e53e25d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/blocksi-embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ containerElem.innerHTML = `<style>
}
html, body, iframe {
color-scheme: dark light;
visibility: visible;
width: 100vw !important;
height: 100vh !important;
Expand All @@ -50,10 +51,13 @@ containerElem.innerHTML = `<style>
<iframe></iframe>`;

document.body.replaceChildren(...containerElem.childNodes);
const iframe = document.querySelector("iframe");

function loadHTML() {
console.info("[Blocksi Embed]: Loading HTML")
document.querySelector("iframe").srcdoc = fromB64(location.hash.slice(1));

iframe.srcdoc = fromB64(location.hash.slice(1));
iframe.contentDocument.documentElement.style.colorScheme = "dark light";
}

window.onhashchange = loadHTML;
Expand Down

0 comments on commit e53e25d

Please sign in to comment.