X-Git-Url: https://git.auder.net/css/rpsls.css?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=fa42e8367acda162e9ab60362b8dccd06ac64966;hb=f1e9798d91b10b7d30265305f5c26e3985669ef9;hp=829e5b7dbf0a71eccbc8330590f0209077e55f5e;hpb=42a9284896b9cf9a579d32b7cf77dfc1f5786472;p=vchess.git diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index 829e5b7d..fa42e836 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -227,7 +227,7 @@ export default { vid: parseInt(localStorage.getItem("vid")) || 0, to: "", //name of challenged player (if any) cadence: localStorage.getItem("cadence") || "", - randomness: parseInt(localStorage.getItem("randomness")) || 2, + randomness: parseInt(localStorage.getItem("challRandomness")) || 2, // VariantRules object, stored to not interfere with // diagrams of targetted challenges: V: null, @@ -394,8 +394,31 @@ export default { dispCorr || localStorage.getItem("type-challenges") || "live"; const showGtype = dispCorr || localStorage.getItem("type-games") || "live"; - this.setDisplay("c", showCtype); - this.setDisplay("g", showGtype); + this.setDisplay('c', showCtype); + this.setDisplay('g', showGtype); + // Attempt to show something (at least a few correspondance challenges): + setTimeout( + () => { + const types = ["corr", "live"]; + for (let i of [0,1]) { + if ( + this.gdisplay == types[i] && + this.games.length > 0 && + this.games.every(g => g.type == types[1-i]) + ) { + this.setDisplay('g', types[1-i]); + } + if ( + this.cdisplay == types[i] && + this.challenges.length > 0 && + this.challenges.every(c => c.type == types[1-i]) + ) { + this.setDisplay('c', types[1-i]); + } + } + }, + 1500 + ); }, beforeDestroy: function() { document.removeEventListener('visibilitychange', this.visibilityChange); @@ -845,8 +868,7 @@ export default { const vModule = await import("@/variants/" + vname + ".js"); this.newchallenge.V = vModule.VariantRules; this.newchallenge.vname = vname; - if (!!cb) - cb(); + if (!!cb) cb(); }, trySetNewchallDiag: function() { if (!this.newchallenge.fen) { @@ -872,7 +894,7 @@ export default { this.newchallenge.vid = pchall.vid; this.newchallenge.cadence = pchall.cadence; this.newchallenge.randomness = pchall.randomness; - this.issueNewChallenge(); + this.loadNewchallVariant(this.issueNewChallenge); }, issueNewChallenge: async function() { if (!!(this.newchallenge.cadence.match(/^[0-9]+$/))) @@ -970,7 +992,7 @@ export default { // Remember cadence + vid for quicker further challenges: localStorage.setItem("cadence", chall.cadence); localStorage.setItem("vid", chall.vid); - localStorage.setItem("randomness", chall.randomness); + localStorage.setItem("challRandomness", chall.randomness); document.getElementById("modalNewgame").checked = false; // Show the challenge if not on current display if (