829bf3b11754fe9c045d1e95dcd8dca3ee3ad5da
1 // Load rules on variant page
2 Vue
.component('my-rules', {
4 return { content: "" };
6 template: `<div v-html="content" class="section-content"></div>`,
8 // AJAX request to get rules content (plain text, HTML)
9 ajax("/rules/" + variant
, "GET", response
=> {
10 let replaceByDiag
= (match
, p1
, p2
) => {
11 const args
= this.parseFen(p2
);
12 return getDiagram(args
);
14 this.content
= response
.replace(/(fen:)([^:]*):/g, replaceByDiag
);
19 const fenParts
= fen
.split(" ");
21 position: fenParts
[0],
23 orientation: fenParts
[2],