All checks were successful
continuous-integration/drone/push Build is passing
100 lines
2.5 KiB
HTML
100 lines
2.5 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.generateCover(args);
|
|
if (result.error) {
|
|
throw result.error;
|
|
}
|
|
|
|
return new File([result], 'cover.pdf', {type: 'application/pdf'});
|
|
}
|
|
|
|
function makeSplitCover(args) {
|
|
const result = window.generateSplitCover(args);
|
|
if (result.error) {
|
|
throw result.error;
|
|
}
|
|
|
|
return Object.fromEntries(['front', 'back'].map((side) => [side, new File([result[side]], `${side}.pdf`, {type: 'application/pdf'})]));
|
|
}
|
|
|
|
function letsfuckinggo() {
|
|
const covers = makeSplitCover({
|
|
customer: document.getElementById('customer').value,
|
|
number: document.getElementById('number').value,
|
|
numberPrefix: document.getElementById('prefix').value,
|
|
hlColor: document.getElementById('color').value,
|
|
})
|
|
|
|
document.getElementById('front').src = window.URL.createObjectURL(covers.front);
|
|
document.getElementById('back').src = window.URL.createObjectURL(covers.back);
|
|
}
|
|
|
|
</script>
|
|
<style>
|
|
html, body {
|
|
height: 100%;
|
|
width: 100%;
|
|
}
|
|
|
|
.covers {
|
|
height: 100%;
|
|
width: 90%;
|
|
display: flex;
|
|
flex-direction: row;
|
|
}
|
|
|
|
.covers iframe {
|
|
flex-grow: 1;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div>
|
|
<label>
|
|
Customer:
|
|
<textarea id="customer"></textarea>
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label>
|
|
Prefix:
|
|
<input id="prefix" type="text" value="offerte">
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label>
|
|
Number:
|
|
<input id="number" type="text">
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<label>
|
|
Color:
|
|
<input id="color" type="color" value="#FF69B4">
|
|
</label>
|
|
</div>
|
|
<div>
|
|
<button onclick="letsfuckinggo()">Fuck it!</button>
|
|
</div>
|
|
<div class="covers">
|
|
<iframe id="front"></iframe>
|
|
<iframe id="back"></iframe>
|
|
</div>
|
|
|
|
<div class="download-links">
|
|
Download the CLI:
|
|
<a href="./dist/covergen.linux-amd64">Linux amd64</a>
|
|
<a href="./dist/covergen.darwin-amd64">Darwin amd64</a>
|
|
</div>
|
|
</body>
|
|
</html>
|