1 // Load rules on variant page
2 Vue
.component('my-rules', {
4 return { content: "" };
7 <div class="col-sm-12 col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
8 <div v-html="content" class="section-content"></div>
12 // AJAX request to get rules content (plain text, HTML)
13 ajax("/rules/" + variant
, "GET", response
=> {
14 let replaceByDiag
= (match
, p1
, p2
) => {
15 const args
= this.parseFen(p2
);
16 return getDiagram(args
);
18 this.content
= response
.replace(/(fen:)([^:]*):/g, replaceByDiag
);
23 const fenParts
= fen
.split(" ");
25 position: fenParts
[0],
27 orientation: fenParts
[2],