X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fclient_OLD%2Fjavascripts%2Fvariant.js;fp=client%2Fclient_OLD%2Fjavascripts%2Fvariant.js;h=0000000000000000000000000000000000000000;hb=8d61fc4ab7373b4a576f3f9108cdf7768ae27096;hp=c45de0ac6c3cd5a815cccb74cec57d1a347d4f83;hpb=760865ac92508676c0047b84c5ba3e12d41d7c20;p=vchess.git diff --git a/client/client_OLD/javascripts/variant.js b/client/client_OLD/javascripts/variant.js deleted file mode 100644 index c45de0ac..00000000 --- a/client/client_OLD/javascripts/variant.js +++ /dev/null @@ -1,70 +0,0 @@ -new Vue({ - el: "#VueElement", - data: { - display: "", //default to main hall; see "created()" function - gameRef: undefined, //...for now - probId: undefined, - conn: null, - mode: "analyze", - allowChat: false, - allowMovelist: true, - // Settings initialized with values from localStorage - settings: { - bcolor: localStorage["bcolor"] || "lichess", - sound: parseInt(localStorage["sound"]) || 2, - hints: parseInt(localStorage["hints"]) || 1, - coords: !!eval(localStorage["coords"]), - highlight: !!eval(localStorage["highlight"]), - sqSize: parseInt(localStorage["sqSize"]), - }, - }, - created: function() { - window.onhashchange = this.setDisplay; - if (!!localStorage["variant"]) - location.hash = "#game?id=" + localStorage["gameId"]; - else - this.setDisplay(); - // Our ID, always set (DB id if registered, collision-free random string otherwise) - this.myid = user.id || localStorage["myid"] || "anon-" + getRandString(); - this.conn = new WebSocket(socketUrl + "/?sid=" + this.myid + "&page=" + variant.id); - const socketCloseListener = () => { - this.conn = new WebSocket(socketUrl + "/?sid=" + this.myid + "&page=" + variant.id); - } - this.conn.onclose = socketCloseListener; - }, - methods: { - // 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 - }; - } - // Close menu on small screens: - let menuToggle = document.getElementById("drawer-control"); - if (!!menuToggle) - menuToggle.checked = false; - }, - }, -});