diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-12-31 17:47:38 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2024-01-08 16:36:48 +0100 |
commit | d818566e2e80b4cbb4eab80c95229e317bf9332d (patch) | |
tree | 89308a56e860e6306196c5907ceec312206b8f2c /play.js | |
parent | 4a3d059599d88ddfea44c9d57f0db5aeba1e3780 (diff) | |
download | table-battles-d818566e2e80b4cbb4eab80c95229e317bf9332d.tar.gz |
WIP paintings and wikipedia links
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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) |