Files
remark42/web/iframe.html
T
2018-05-06 14:35:32 +03:00

41 lines
1.0 KiB
HTML

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>remark42</title>
<base target="_blank">
<link rel="stylesheet" href="remark.css">
<style>
html, body {
margin: 0;
padding: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
</style>
</head>
<body>
<div id="remark42"></div>
<script>
var lastHeight = 0;
setInterval(function() {
if (document.body.offsetHeight !== lastHeight) {
lastHeight = document.body.offsetHeight;
window.parent.postMessage(JSON.stringify({ remarkIframeHeight: lastHeight }), '*');
}
}, 200);
window.addEventListener('message', updateHash);
function updateHash(event) {
try {
const data = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;
location.hash = data.hash;
} catch (e) {}
}
</script>
<script type="text/javascript" src="remark.js"></script>
</body>
</html>