Start work on saving graph controls

This commit is contained in:
Cryptkeeper 2016-02-01 05:20:25 -06:00
parent 37fdf25eae
commit c4177abaaf
2 changed files with 22 additions and 0 deletions

@ -460,9 +460,13 @@ $(document).ready(function() {
delete hiddenGraphData[serverIp];
}
// Redraw the graph
historyPlot.setData(convertGraphData(displayedGraphData));
historyPlot.setupGrid();
historyPlot.draw();
// Update our localStorage
saveGraphControls();
});
});

@ -2,6 +2,24 @@ var MISSING_FAVICON_BASE64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAA
var tooltip = $('#tooltip');
function saveGraphControls(displayedServers) {
if (typeof(localStorage) !== undefined) {
var json = JSON.stringify(displayedServers);
localStorage.setItem('displayedServers', json);
}
}
function loadGraphControls() {
if (typeof(localStorage) !== undefined) {
var item = localStorage.getItem('displayedServers');
if (item) {
return JSON.parse(item);
}
}
}
function getTimestamp(ms, timeOnly) {
var date = new Date(0);