halfway to moolah2

This commit is contained in:
Bel LaPointe
2023-10-27 21:28:31 -06:00
parent e36f08deba
commit dafac49126
4 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
<html>
<header>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.css">
<script>
function http(method, remote, callback, body) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == XMLHttpRequest.DONE) {
callback(xmlhttp.responseText, xmlhttp.status)
}
};
xmlhttp.open(method, remote, true);
if (typeof body == "undefined") {
body = null
}
xmlhttp.send(body);
}
function callback(responseBody, responseStatus) {
}
var f = String(window.location).split("/transactions")[1]
if (!f) {
f = "./moolah.dat"
}
function init() {
load(f)
}
function load(f) {
http("GET", "/api/transactions?f="+f, (body, status) => {
var d = JSON.parse(body)
console.log(status, d)
})
}
</script>
</header>
<body onload="init();">
<h2>Moolah2</h2>
<details>
<summary>Balance</summary>
<div id="bal">
</div>
</details>
<details open>
<div id="reg">
</div>
</details>
</body>
<footer>
</footer>
</html>