|
|
@@ -17,30 +17,24 @@
|
|
|
/>
|
|
|
<script>
|
|
|
(function () {
|
|
|
- function applyEmbedModeFromHash() {
|
|
|
- var isEmbed =
|
|
|
+ function syncEmbedClassFromHash() {
|
|
|
+ const isEmbed =
|
|
|
(window.location.hash || "").indexOf("#embed") !== -1;
|
|
|
- if (!isEmbed) return;
|
|
|
|
|
|
- var container = document.querySelector(
|
|
|
- ".view-home .container",
|
|
|
- );
|
|
|
- if (!container) return;
|
|
|
-
|
|
|
- document.body.innerHTML = "";
|
|
|
- document.body.appendChild(container);
|
|
|
+ // Toggle a class on <body>. CSS handles the layout changes.
|
|
|
+ document.body.classList.toggle("embed", isEmbed);
|
|
|
}
|
|
|
|
|
|
if (document.readyState === "loading") {
|
|
|
document.addEventListener(
|
|
|
"DOMContentLoaded",
|
|
|
- applyEmbedModeFromHash,
|
|
|
+ syncEmbedClassFromHash,
|
|
|
);
|
|
|
} else {
|
|
|
- applyEmbedModeFromHash();
|
|
|
+ syncEmbedClassFromHash();
|
|
|
}
|
|
|
|
|
|
- window.addEventListener("hashchange", applyEmbedModeFromHash);
|
|
|
+ window.addEventListener("hashchange", syncEmbedClassFromHash);
|
|
|
})();
|
|
|
</script>
|
|
|
</head>
|