mirror of
https://git.eta.st/eta/rsp6-decoder.git
synced 2024-12-24 09:04:39 +00:00
fix some web stuff
This commit is contained in:
parent
4924b13893
commit
e06ba28b42
@ -7,6 +7,7 @@
|
||||
<link rel="stylesheet" href="./govuk.css"/>
|
||||
</head>
|
||||
<body class="govuk-template__body">
|
||||
<script src="./bootstrap.js"></script>
|
||||
<a href="#main-content" class="govuk-skip-link">Skip to main content</a>
|
||||
<header class="govuk-header" role="banner">
|
||||
<div class="govuk-header__container govuk-width-container" style="border-bottom: 10px solid #1d70b8;">
|
||||
@ -155,6 +156,5 @@
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="./bootstrap.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,3 +1,8 @@
|
||||
// To do before release:
|
||||
// - fix double scan bug
|
||||
// - reservations!!
|
||||
// - minification
|
||||
|
||||
console.log("[+] Wow, JavaScript!");
|
||||
import * as wasm from "rsp6-decoder";
|
||||
import { BrowserAztecCodeReader } from '@zxing/library';
|
||||
@ -6,8 +11,13 @@ let stations = require("./stations.json");
|
||||
let fares = require("./fares.json");
|
||||
window.stations = stations;
|
||||
window.fares = fares;
|
||||
let loaded = false;
|
||||
|
||||
window.addEventListener('load', function () {
|
||||
function onload() {
|
||||
if (loaded) {
|
||||
return;
|
||||
}
|
||||
loaded = true;
|
||||
console.log("[+] initialising wasm");
|
||||
window.wasm = wasm;
|
||||
window.wasm.init();
|
||||
@ -188,7 +198,7 @@ window.addEventListener('load', function () {
|
||||
error_banner.style.display = "none";
|
||||
handleTicket(result);
|
||||
}).catch((err) => {
|
||||
error("Scanner failed", "Couldn't start the camera.<br/><pre>" + err + "</pre>");
|
||||
error("Scanner failed", "Looks like the barcode scanner failed in some way. If this keeps happening, try reloading the page or using one of the alternative options.<br/><pre>" + err + "</pre>");
|
||||
console.error(err);
|
||||
});
|
||||
video_div.style.display = "block";
|
||||
@ -242,5 +252,12 @@ window.addEventListener('load', function () {
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
if (document.readyState == 'complete') {
|
||||
console.log("[+] Loaded already!");
|
||||
onload();
|
||||
}
|
||||
else {
|
||||
window.addEventListener('load', onload);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user