Update spec.js

This commit is contained in:
netop:// ウェッブ 2019-01-25 10:38:07 -06:00 committed by GitHub
parent 41fb2d0179
commit 94108e122b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,20 +12,22 @@ import html from "choo/html";
export default state => { export default state => {
state.hideFooter = true; state.hideFooter = true;
return html` return html`
<div style="width: 100%; height: calc(100vh - 67px)"> <!-- 67px = height of nav. this avoids second scrollbar --> <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> <iframe id="spec" style="width: 100%; height: 100%;"></iframe>
</div> </div>
<script> <script>
const specDomain = "https://spec.lbry.io"; const specDomain = "https://spec.lbry.io";
const spec = document.getElementById("spec"); const spec = document.getElementById("spec");
spec.src = specDomain + window.location.hash; spec.src = specDomain + window.location.hash;
window.addEventListener("message", event => { window.addEventListener("message", event => {
if (event.origin != specDomain || event.source != spec.contentWindow) { // security if (event.origin !== specDomain || event.source !== spec.contentWindow) // security
return; return;
}
const url = window.location.href.substr(0, window.location.href.lastIndexOf('#')); const url = window.location.href.substr(0, window.location.href.lastIndexOf("#"));
history.replaceState(null, null, url + "#" + event.data); history.replaceState(null, null, url + "#" + event.data);
}); });
</script> </script>