mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
33 lines
No EOL
1.5 KiB
HTML
33 lines
No EOL
1.5 KiB
HTML
<html xmanifest="manifest.appcache">
|
|
<title>itty bitty</title>
|
|
<meta name="viewport" content="width=device-width">
|
|
<style type="text/css">
|
|
#edit { position:absolute; z-index:100;font-family:sans-serif;text-decoration:none;position:absolute;top:20px;right:20px; color:black; display:none; }
|
|
iframe { border:none;position:absolute;top:0;left:0;width:100%;height:100% }
|
|
</style>
|
|
<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');
|
|
var editLink = "/edit#" + hash
|
|
link.onclick = function() {
|
|
location.href = editLink
|
|
}
|
|
link.style.display = "block";
|
|
var style = "PG1ldGEgY2hhcnNldD0idXRmLTgiPjxtZXRhIG5hbWU9InZpZXdwb3J0IiBjb250ZW50PSJ3aWR0aD1kZXZpY2Utd2lkdGgiPjxiYXNlIHRhcmdldD0iX3RvcCI+PHN0eWxlIHR5cGU9InRleHQvY3NzIj5ib2R5e21hcmdpbjowIGF1dG87cGFkZGluZzoxMnZtaW4gMTB2bWluO21heC13aWR0aDozNWVtO2xpbmUtaGVpZ2h0OjEuNWVtO2ZvbnQtZmFtaWx5OiAtYXBwbGUtc3lzdGVtLEJsaW5rTWFjU3lzdGVtRm9udCxzYW5zLXNlcmlmO3dvcmQtd3JhcDogYnJlYWstd29yZDt9PC9zdHlsZT4g"
|
|
hash = style + hash.substring(1)
|
|
}
|
|
if (!hash.startsWith("data:")) hash = 'data:text/html;charset=utf-8;base64,' + hash;
|
|
// location.href = hash
|
|
var iframe = document.getElementById('iframe');
|
|
iframe.src = hash;
|
|
document.body.appendChild(iframe);
|
|
}
|
|
} else {
|
|
location.href = "/edit"
|
|
}
|
|
</script>
|
|
<iframe id="iframe"></iframe><button id="edit">Edit</button>
|
|
</html> |