summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2023-09-28 19:19:15 +0200
committerTor Andersson <tor@ccxvii.net>2023-10-01 16:11:22 +0200
commit0da3cc2279295813214950eed623fd188db9067f (patch)
treed5d521030d66ca06f5cfa199690184bd1beeac68 /play.js
parente269aa6ec52c2aeb102eb816d90ead0a999191e3 (diff)
downloadwaterloo-campaign-1815-0da3cc2279295813214950eed623fd188db9067f.tar.gz
Improve log messages.
Diffstat (limited to 'play.js')
-rw-r--r--play.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/play.js b/play.js
index b0228af..dd6984b 100644
--- a/play.js
+++ b/play.js
@@ -472,7 +472,7 @@ function on_click_piece_tip(id) {
ui.pieces[id].scrollIntoView({ block:"center", inline:"center", behavior:"smooth" })
}
-const DICE = {
+const DICE_TEXT = {
D0: '[0]',
D1: '[1]',
D2: '[2]',
@@ -482,6 +482,16 @@ const DICE = {
D6: '[6]',
}
+const DICE = {
+ D0: '<span class="dice d0"></span>',
+ D1: '<span class="dice d1"></span>',
+ D2: '<span class="dice d2"></span>',
+ D3: '<span class="dice d3"></span>',
+ D4: '<span class="dice d4"></span>',
+ D5: '<span class="dice d5"></span>',
+ D6: '<span class="dice d6"></span>',
+}
+
function sub_dice(match) {
return DICE[match]
}
@@ -493,7 +503,7 @@ function sub_hex(match, p1) {
n = x + " (" + n + ")"
else
n = x
- return `<span class="hextip" onmouseenter="on_focus_hex_tip(${x})" onmouseleave="on_blur_hex_tip(${x})" onclick="on_click_hex_tip(${x})">${n}</span>`
+ return `<span class="tip" onmouseenter="on_focus_hex_tip(${x})" onmouseleave="on_blur_hex_tip(${x})" onclick="on_click_hex_tip(${x})">${n}</span>`
}
function sub_piece(match, p1) {
@@ -525,8 +535,8 @@ function on_log(text) {
text = text.replace(/P(\d+)/g, sub_piece)
text = text.replace(/\bD\d\b/g, sub_dice)
- text = text.replace(/French/g, '<span class="french">French</span>')
- text = text.replace(/Coalition/g, '<span class="anglo">Coalition</span>')
+ text = text.replace(/^French/g, '<span class="french">French</span>')
+ text = text.replace(/^Coalition/g, '<span class="anglo">Coalition</span>')
if (text.match(/^\.h1 /)) {
text = text.substring(4)