X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Frules.js;fp=public%2Fjavascripts%2Fcomponents%2Frules.js;h=0000000000000000000000000000000000000000;hb=625022fdcf750f0aff8fcd699f7e9b89730e1d10;hp=0f27d5327177c9f18d664869a6b024ea09dc6c37;hpb=b955c65b942d09d24b5c3bed0d755d4f2f8f71f1;p=vchess.git diff --git a/public/javascripts/components/rules.js b/public/javascripts/components/rules.js deleted file mode 100644 index 0f27d532..00000000 --- a/public/javascripts/components/rules.js +++ /dev/null @@ -1,80 +0,0 @@ -// Load rules on variant page -Vue.component('my-rules', { - props: ["settings"], - data: function() { - return { - content: "", - display: "rules", - mode: "computer", - subMode: "", //'auto' for game CPU vs CPU - gameInProgress: false, - mycolor: "w", - allowMovelist: true, - fen: "", - }; - }, - template: ` -
-
- - - - -
-
- - -
- `, - mounted: function() { - // AJAX request to get rules content (plain text, HTML) - ajax("/rules/" + variant.name, "GET", response => { - let replaceByDiag = (match, p1, p2) => { - const args = this.parseFen(p2); - return getDiagram(args); - }; - this.content = response.replace(/(fen:)([^:]*):/g, replaceByDiag); - }); - }, - methods: { - parseFen(fen) { - const fenParts = fen.split(" "); - return { - position: fenParts[0], - marks: fenParts[1], - orientation: fenParts[2], - shadow: fenParts[3], - }; - }, - startGame: function() { - if (this.gameInProgress) - return; - this.gameInProgress = true; - this.mode = "computer"; - this.display = "computer"; - this.fen = V.GenRandInitFen(); - }, - stopGame: function() { - this.gameInProgress = false; - this.mode = "analyze"; - }, - playAgainstComputer: function() { - this.subMode = ""; - this.startGame(); - }, - watchComputerGame: function() { - this.subMode = "auto"; - this.startGame(); - }, - }, -})