53 lines
1.2 KiB
HTML
53 lines
1.2 KiB
HTML
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<script src="wasm_exec.js"></script>
|
|
<script>
|
|
const go = new Go();
|
|
WebAssembly.instantiateStreaming(fetch("covergen.wasm"), go.importObject).then((result) => {
|
|
go.run(result.instance);
|
|
});
|
|
|
|
function makeCover(args) {
|
|
const result = window.covergen(args);
|
|
if (result.error) {
|
|
throw result.error;
|
|
}
|
|
|
|
return new File([result], 'cover.pdf', {type: 'application/pdf'});
|
|
}
|
|
|
|
function letsfuckinggo() {
|
|
document.getElementById('cover').src = window.URL.createObjectURL(makeCover({
|
|
customer: document.getElementById('customer').value,
|
|
number: document.getElementById('number').value,
|
|
}));
|
|
}
|
|
|
|
</script>
|
|
<style>
|
|
html, body, #cover {
|
|
height: 100%;
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div>
|
|
<label>
|
|
Customer:
|
|
<textarea id="customer"></textarea>
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label>
|
|
Number:
|
|
<input id="number" type="text">
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<button onclick="letsfuckinggo()">Fuck it!</button>
|
|
</div>
|
|
<iframe id="cover"></iframe>
|
|
</body>
|
|
</html> |