assets/scripts.js: Initialize persistent state from data

Fixes JS errors when seeking past first choice with empty localStorage.
This commit is contained in:
Vladimir Panteleev 2019-07-28 21:25:31 +00:00
parent 9ea55f3c02
commit 9bf91b095b

View file

@ -34,6 +34,11 @@ var segmentGroups = bv.segmentGroups;
// Persistent state
var ls = window.localStorage || {};
if (!('initialized' in ls)) {
for (let k in bv.stateHistory)
ls["persistentState_" + k] = JSON.stringify(bv.stateHistory[k]);
ls['initialized'] = 't';
}
function msToString(ms) {
return new Date(ms).toUTCString().split(' ')[4];