X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=public%2Fjavascripts%2Fcomponents%2Frules.js;h=e9df1ecc0c0a1699d5d00c32beb4b8b8fb5c5a9f;hb=582df3497b0f91dd4b645386a059eac9e98da1bb;hp=829bf3b11754fe9c045d1e95dcd8dca3ee3ad5da;hpb=7931e479adf93c87771ded1892a0873af72ae46d;p=vchess.git diff --git a/public/javascripts/components/rules.js b/public/javascripts/components/rules.js index 829bf3b1..e9df1ecc 100644 --- a/public/javascripts/components/rules.js +++ b/public/javascripts/components/rules.js @@ -1,12 +1,38 @@ // Load rules on variant page Vue.component('my-rules', { + props: ["settings"], data: function() { - return { content: "" }; + return { + content: "", + display: "rules", + mode: "computer", + mycolor: "w", + allowMovelist: true, + fen: "", + }; }, - template: `
`, + + // TODO: third button "see a sample game" (comp VS comp) + + template: ` +
+
+ + +
+
+ + +
+ `, mounted: function() { // AJAX request to get rules content (plain text, HTML) - ajax("/rules/" + variant, "GET", response => { + ajax("/rules/" + variant.name, "GET", response => { let replaceByDiag = (match, p1, p2) => { const args = this.parseFen(p2); return getDiagram(args); @@ -21,7 +47,12 @@ Vue.component('my-rules', { position: fenParts[0], marks: fenParts[1], orientation: fenParts[2], + shadow: fenParts[3], }; }, + startComputerGame: function() { + this.fen = V.GenRandInitFen(); + this.display = "computer"; + }, }, })