summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
Diffstat (limited to 'play.js')
-rw-r--r--play.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/play.js b/play.js
index 62566fc..2e61505 100644
--- a/play.js
+++ b/play.js
@@ -346,6 +346,13 @@ function sub_space_name(match, p1, offset, string) {
return n
}
+const IMG_RC = '<img class="c" src="pieces/red_cube.svg">'
+const IMG_BC = '<img class="c" src="pieces/blue_cube.svg">'
+const IMG_RD = '<img class="d" src="pieces/red_disc.svg">'
+const IMG_BD = '<img class="d" src="pieces/blue_disc.svg">'
+const IMG_RM = '<img class="m" src="pieces/red_cylinder.svg">'
+const IMG_BM = '<img class="m" src="pieces/blue_cylinder.svg">'
+
function on_log(text) {
let p = document.createElement("div")
@@ -360,6 +367,13 @@ function on_log(text) {
text = text.replace(/C(\d+)/g, sub_card_name)
text = text.replace(/S(\d+)/g, sub_space_name)
+ text = text.replace(/\bRC\b/g, IMG_RC)
+ text = text.replace(/\bBC\b/g, IMG_BC)
+ text = text.replace(/\bRD\b/g, IMG_RD)
+ text = text.replace(/\bBD\b/g, IMG_BD)
+ text = text.replace(/\bRM\b/g, IMG_RM)
+ text = text.replace(/\bBM\b/g, IMG_BM)
+
if (text.match(/^\.h1/)) {
text = text.substring(4)
p.className = 'h1'
@@ -377,7 +391,17 @@ function on_log(text) {
if (text.match(/^\.h3/)) {
text = text.substring(4)
- p.className = 'h3'
+ p.className = 'h3'
+ }
+
+ if (text.match(/^\.h4/)) {
+ text = text.substring(4)
+ p.className = 'h4'
+ }
+
+ if (text.match(/^.hr$/)) {
+ p.className = "hr";
+ text = "";
}
p.innerHTML = text