moth/www/restore.html

33 lines
956 B
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<title>Points History</title>
2017-02-06 10:14:23 -07:00
<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>