mirror of https://github.com/dirtbags/moth.git
33 lines
956 B
HTML
33 lines
956 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Points History</title>
|
|
<meta charset="UTF-8">
|
|
<script>
|
|
function init() {
|
|
|
|
function getParameterByName(name) {
|
|
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
|
|
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
|
|
results = regex.exec(location.search);
|
|
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
|
|
}
|
|
|
|
var pointsDiv = document.getElementById("pointslog");
|
|
var pointshistory = JSON.parse(localStorage.getItem("pointshistory"));
|
|
// get snapshot specified by query param or else most recent snapshot
|
|
var i = parseInt(getParameterByName("snapshot")) || pointshistory.length-1;
|
|
var snapshot = pointshistory[i];
|
|
pointsDiv.innerHTML = snapshot.map(function(entry){
|
|
return entry.join(" ");
|
|
}).join("<br>");
|
|
}
|
|
|
|
window.addEventListener("load", init);
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div id="pointslog"></div>
|
|
</body>
|
|
</html>
|