Files
remark42/frontend/iframe.html
T
Pavel MineevandUmputun a309fc8fb0 Refactor preloader
* make it simple (use only one DOM element for preloader)
* remove useless test (it tests nothing)
* unify preloader import/export
2020-01-07 11:14:59 -06:00

133 lines
3.3 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>remark42</title>
<base target="_blank" />
<script>
if (window.location.search === '?selfClose') {
window.close();
}
</script>
<link rel="stylesheet" href="remark.css" />
<style>
html,
body {
margin: 0;
padding: 0;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@keyframes bouncing {
0%,
80%,
100% {
box-shadow: 0 10px 0 -10px;
}
40% {
box-shadow: 0 10px 0 0;
}
}
.preloader,
.preloader:before,
.preloader:after {
border-radius: 50%;
width: 10px;
height: 10px;
text-align: left;
animation-fill-mode: both;
animation: bouncing 1.8s infinite ease-in-out;
}
.preloader {
color: #fff;
position: relative;
transform: translate3d(0, -10px, 0);
animation-delay: -0.16s;
}
.preloader:before,
.preloader:after {
content: '';
position: absolute;
top: 0;
}
.preloader:before {
transform: translate3d(-15px, 0, 0);
animation-delay: -0.32s;
}
.preloader:after {
transform: translate3d(15px, 0, 0);
}
.preloader_view_iframe {
margin: 0 auto;
color: #888;
}
:focus:not(.focus-visible):not(.button) {
outline: none;
}
</style>
</head>
<body>
<div id="remark42">
<div class="preloader preloader_view_iframe"></div>
</div>
<script>
/* REMOVE-START */
if (window.parent !== window) {
try {
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
} catch (e) {}
}
/* REMOVE-END */
var lastHeight = 0;
setInterval(function() {
if (document.body.offsetHeight !== lastHeight && document.body.offsetHeight > 10) {
lastHeight = document.body.offsetHeight;
window.parent.postMessage(JSON.stringify({ remarkIframeHeight: lastHeight }), '*');
}
}, 200);
window.addEventListener('message', receiveMessages);
function receiveMessages(event) {
try {
const data = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;
const isItHash = data.hash && data.hash.indexOf('#') === 0;
if (isItHash) {
location.replace(data.hash);
}
if (data.title) {
document.title = data.title;
}
} catch (e) {}
}
var remark_config =
window.location.search.length < 2
? {}
: window.location.search
.substr(1)
.split('&')
.reduce(function(c, x) {
var splitted = x.split('=');
if (!splitted[1]) {
splitted[1] = '';
}
c[splitted[0]] = decodeURIComponent(splitted[1]);
return c;
}, {});
window.parent.postMessage(JSON.stringify({ inited: true }), '*');
</script>
<script type="text/javascript" src="remark.js"></script>
</body>
</html>