70 lines
2.5 KiB
HTML
70 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<title>Inhabitor - The Habitat Inspector</title>
|
|
<style type="text/css">
|
|
body {
|
|
margin:40px auto;
|
|
line-height:1.6;
|
|
font-size:18px;
|
|
color:#444;
|
|
padding:0 10px
|
|
}
|
|
h1,h2,h3 {
|
|
line-height:1.2
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1 id="filename"></h1>
|
|
<div id="animations">
|
|
<h2>Animations</h2>
|
|
</div>
|
|
<div id="states">
|
|
<h2>States</h1>
|
|
</div>
|
|
<div id="cels">
|
|
<h2>Cels</h1>
|
|
</div>
|
|
<div id="data">
|
|
<h2>Data</h1>
|
|
</div>
|
|
<div id="errors"></div>
|
|
<a href="index.html">Back</a>
|
|
<script type="module">
|
|
import { decodeProp } from "./codec.js"
|
|
import { docBuilder, decodeBinary, showAll, textNode, propAnimationShower, celmaskShower, celShower } from "./show.js"
|
|
|
|
const propFilter = (key, value) => {
|
|
if (key != "bitmap" && key != "data" && key != "canvas") {
|
|
return value
|
|
}
|
|
}
|
|
const dumpProp = (prop, container) => {
|
|
container.appendChild(textNode(JSON.stringify(prop, propFilter, 2), "pre"))
|
|
}
|
|
|
|
const onload = async () => {
|
|
const q = new URLSearchParams(window.location.search)
|
|
const filename = q.get("f")
|
|
document.getElementById("filename").innerText = filename
|
|
const doc = docBuilder({ errorContainer: document.getElementById("errors") })
|
|
try {
|
|
const prop = await decodeBinary(filename, decodeProp)
|
|
dumpProp(prop, document.getElementById("data"))
|
|
if (prop.error) {
|
|
doc.showError(prop.error, filename)
|
|
} else {
|
|
showAll(doc, document.getElementById("animations"), filename, prop.animations, propAnimationShower(prop))
|
|
showAll(doc, document.getElementById("states"), filename, prop.celmasks, celmaskShower(prop))
|
|
showAll(doc, document.getElementById("cels"), filename, prop.cels, celShower())
|
|
}
|
|
} catch (e) {
|
|
showError(e, filename)
|
|
}
|
|
}
|
|
onload()
|
|
</script>
|
|
</body>
|
|
</html> |