srv/src/opengist-embed.html
2023-05-31 14:52:38 -05:00

17 lines
782 B
HTML

<body>
<script>
const href = window.location.href.replace('embed/', '');
const file = window.location.hash;
const iframe = document.createElement('iframe');
iframe.setAttribute('style', 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; border: none; outline: none;');
iframe.onload = () => {
const files = iframe.contentDocument.querySelectorAll('div.grid > div');
const fileDiv = Array.from(files).find(f => f.querySelector('span' + file) !== undefined);
fileDiv.setAttribute('style', 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: white;');
iframe.contentDocument.body.setAttribute('style', 'overflow: hidden;')
}
iframe.src = href;
document.body.append(iframe);
</script>
</body>