- challOrWatch: function(sid) {
- if (this.people[sid].pages.some(p => p == "/")) {
- // Available, in Hall
- this.newchallenge.to = this.people[sid].name;
- document.getElementById("modalPeople").checked = false;
- window.doClick("modalNewgame");
- } else {
- // In some game, maybe playing maybe not: show a random one
- let gids = [];
- this.people[sid].pages.forEach(p => {
- const matchGid = p.match(/[a-zA-Z0-9]+$/);
- if (matchGid) gids.push(matchGid[0]);
- });
- const gid = gids[Math.floor(Math.random() * gids.length)];
- const game = this.games.find(g => g.id == gid);
- if (game) this.showGame(game);
- else this.$router.push("/game/" + gid); //game vs. me
- }
+ watchGame: function(sid) {
+ // In some game, maybe playing maybe not: show a random one
+ let gids = [];
+ this.people[sid].pages.forEach(p => {
+ const matchGid = p.match(/[a-zA-Z0-9]+$/);
+ if (matchGid) gids.push(matchGid[0]);
+ });
+ const gid = gids[Math.floor(Math.random() * gids.length)];
+ const game = this.games.find(g => g.id == gid);
+ if (game) this.showGame(game);
+ else this.$router.push("/game/" + gid); //game vs. me