summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-12-31 17:47:38 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-08 16:36:48 +0100
commitd818566e2e80b4cbb4eab80c95229e317bf9332d (patch)
tree89308a56e860e6306196c5907ceec312206b8f2c /play.js
parent4a3d059599d88ddfea44c9d57f0db5aeba1e3780 (diff)
downloadtable-battles-d818566e2e80b4cbb4eab80c95229e317bf9332d.tar.gz
WIP paintings and wikipedia links
Diffstat (limited to 'play.js')
-rw-r--r--play.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/play.js b/play.js
index 9fed183..c853573 100644
--- a/play.js
+++ b/play.js
@@ -511,6 +511,14 @@ function on_log(text) {
if (text.match(/^\.h1 /)) {
text = text.substring(4)
p.className = "h1"
+ let w = null
+ for (let s of data.scenarios)
+ if (s.name === text)
+ w = s.wikipedia
+ if (w) {
+ p.innerHTML = `<a href="${w}">${text}</a>`
+ return p
+ }
}
else if (text.match(/^\.h2 /)) {
text = text.substring(4)
@@ -540,6 +548,11 @@ function on_log(text) {
text = text.substring(1)
p.className = "i1"
}
+ else if (text.match(/^.img /)) {
+ p = document.createElement("img")
+ p.src = "paintings/" + text.substring(5) + ".jpg"
+ return p
+ }
text = text.replace(/\bC\d+\b/g, sub_card)
text = text.replace(/\b[DPRBK]\d\b/g, sub_icon)