+ updateSettings: function(event) {
+ const propName =
+ event.target.id.substr(3).replace(/^\w/, c => c.toLowerCase())
+ localStorage[propName] = ["highlight","coords"].includes(propName)
+ ? event.target.checked
+ : event.target.value;
+ },
+ // Game is over, clear storage and put it in indexedDB
+ archiveGame: function() {
+ // TODO: ...
+ //clearStorage();
+ },
+ setDisplay: function() {
+ // Prevent set display if there is a running game
+ if (!!localStorage["variant"])
+ return;
+ if (!location.hash)
+ location.hash = "#room"; //default
+ const hashParts = location.hash.substr(1).split("?");
+ this.display = hashParts[0];
+ if (hashParts[0] == "problems" && !!hashParts[1])
+ {
+ // Show a specific problem
+ this.probId = hashParts[1].split("=")[1];
+ }
+ else if (hashParts[0] == "game" && !!hashParts[1])
+ {
+ // Show a specific game, maybe with a user ID
+ const params = hashParts[1].split("&").filter(h => h.split("=")[1]);
+ // TODO: Vue.set(...) probably required here
+ this.gameRef = {
+ id: params[0],
+ uid: params[1], //may be undefined
+ };
+ }