lbry.tech/app/views/spec.js

36 lines
879 B
JavaScript
Raw Normal View History

"use strict";
// I M P O R T
import html from "choo/html";
// E X P O R T
export default state => {
state.hideFooter = true;
2019-01-25 17:38:07 +01:00
return html`
2019-01-25 17:38:07 +01:00
<div style="width: 100%; height: calc(100vh - 67px)"> <!-- 67px = height of nav. this avoids second scrollbar -->
<iframe id="spec" style="width: 100%; height: 100%;"></iframe>
</div>
2019-01-25 17:38:07 +01:00
<script>
const specDomain = "https://spec.lbry.io";
const spec = document.getElementById("spec");
spec.src = specDomain + window.location.hash;
window.addEventListener("message", event => {
2019-01-25 17:38:07 +01:00
if (event.origin !== specDomain || event.source !== spec.contentWindow) // security
return;
2019-01-25 17:38:07 +01:00
const url = window.location.href.substr(0, window.location.href.lastIndexOf("#"));
history.replaceState(null, null, url + "#" + event.data);
});
</script>
`;
};