itty-bitty/index.html
Nicholas Jitkoff 0aa1fee631 Cleanup
2018-05-25 17:47:09 -07:00

27 lines
No EOL
1.4 KiB
HTML

<html xmanifest="manifest.appcache">
<title>itty bitty</title>
<meta name="viewport" content="width=device-width">
<script type="text/javascript">
var hash = window.location.hash.substring(1)
if (hash.length) {
window.onload = function() {
if (hash.startsWith('!')) {
var link = document.getElementById('edit');
link.onclick = function() { location.href = "/edit#" + hash }
link.style.display = "block";
var preamble = "PG1ldGEgY2hhcnNldD0idXRmLTgiPjxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgiPjxiYXNlIHRhcmdldD0iX3RvcCI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj5ib2R5e21hcmdpbjowIGF1dG87cGFkZGluZzoxMnZtaW4gMTB2bWluO21heC13aWR0aDozNWVtO2xpbmUtaGVpZ2h0OjEuNWVtO2ZvbnQtZmFtaWx5OiAtYXBwbGUtc3lzdGVtLEJsaW5rTWFjU3lzdGVtRm9udCxzYW5zLXNlcmlmO3dvcmQtd3JhcDogYnJlYWstd29yZDt9PC9zdHlsZT4g"
hash = preamble + hash.substring(1)
}
if (!hash.startsWith("data:")) hash = 'data:text/html;charset=utf-8;base64,' + hash;
// location.href = hash // Redirect to data URI in supported browsers
var iframe = document.getElementById('iframe');
iframe.src = hash;
document.body.appendChild(iframe);
}
} else {
location.href = "/edit"
}
</script>
<iframe id="iframe" style="border:none;position:absolute;top:0;left:0;width:100%;height:100%"></iframe>
<button id="edit" style="position:absolute;z-index:100;position:absolute;top:20px;right:20px;display:none;">Edit</button>
</html>