X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FMyGames.vue;h=5d19e7d70980a7694fe01286dcb29ad7c86807be;hb=1aaae6ce703d43ccf4328da9b6b4dca4ed67289a;hp=e0914f67c1ed63f07e9afdcca5bf295baaa34606;hpb=db1f1f9adb920605c7a16b060a7737e54636ee08;p=vchess.git diff --git a/client/src/views/MyGames.vue b/client/src/views/MyGames.vue index e0914f67..5d19e7d7 100644 --- a/client/src/views/MyGames.vue +++ b/client/src/views/MyGames.vue @@ -23,6 +23,8 @@ main import { store } from "@/store"; import { GameStorage } from "@/utils/gameStorage"; import { ajax } from "@/utils/ajax"; +import params from "@/parameters"; +import { getRandString } from "@/utils/alea"; import GameList from "@/components/GameList.vue"; export default { name: "my-my-games", @@ -41,6 +43,10 @@ export default { }, created: function() { GameStorage.getAll(true, localGames => { + + +console.log(localGames); + localGames.forEach(g => (g.type = this.classifyObject(g))); this.liveGames = localGames; }); @@ -67,12 +73,16 @@ export default { const showType = localStorage.getItem("type-myGames") || "live"; this.setDisplay(showType); }, + beforeDestroy: function() { + this.conn.send(JSON.stringify({code: "disconnect"})); + }, methods: { setDisplay: function(type, e) { this.display = type; localStorage.setItem("type-myGames", type); let elt = e ? e.target : document.getElementById(type + "Games"); elt.classList.add("active"); + elt.classList.remove("somethingnew"); //in case of if (elt.previousElementSibling) elt.previousElementSibling.classList.remove("active"); else elt.nextElementSibling.classList.remove("active"); @@ -94,6 +104,14 @@ export default { // NOTE: new move itself is not received, because it wouldn't be used. let g = games.find(g => g.id == data.gid); this.$set(g, "movesCount", g.movesCount + 1); + if ( + (g.type == "live" && this.display == "corr") || + (g.type == "corr" && this.display == "live") + ) { + document + .getElementById(g.type + "Games") + .classList.add("somethingnew"); + } } }, socketCloseListener: function() { @@ -114,4 +132,7 @@ export default { table.game-list max-height: 100% + +.somethingnew + background-color: #c5fefe !important