mirror of https://github.com/espruino/BangleApps
Create interface.html
parent
9b5bda19c5
commit
ba90251724
|
@ -0,0 +1,50 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="../../css/spectre.min.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="data"></div>
|
||||||
|
<button class="btn btn-default" id="btnSave">Save</button>
|
||||||
|
<button class="btn btn-default" id="btnLoad">Load</button>
|
||||||
|
|
||||||
|
<script src="../../core/lib/interface.js"></script>
|
||||||
|
<script>
|
||||||
|
var dataElement = document.getElementById("data");
|
||||||
|
var csvData = "";
|
||||||
|
|
||||||
|
function getData() {
|
||||||
|
// show loading window
|
||||||
|
Util.showModal("Loading...");
|
||||||
|
// get the data
|
||||||
|
dataElement.innerHTML = "";
|
||||||
|
Util.readStorageFile(`authentiwatch.tokens.csv`,data=>{
|
||||||
|
csvData = data.trim();
|
||||||
|
// remove window
|
||||||
|
Util.hideModal();
|
||||||
|
// If no data, report it and exit
|
||||||
|
if (data.length==0) {
|
||||||
|
dataElement.innerHTML = "<b>No data found</b>";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Otherwise parse the data and output it as a table
|
||||||
|
dataElement.innerHTML = data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// You can call a utility function to save the data
|
||||||
|
document.getElementById("btnSave").addEventListener("click", function() {
|
||||||
|
Util.saveCSV("gpsdata", csvData);
|
||||||
|
});
|
||||||
|
// Or you can also delete the file
|
||||||
|
document.getElementById("btnLoad").addEventListener("click", function() {
|
||||||
|
Util.showModal("Loading...");
|
||||||
|
Util.
|
||||||
|
});
|
||||||
|
// Called when app starts
|
||||||
|
function onInit() {
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue