summaryrefslogtreecommitdiff
path: root/play.js
diff options
context:
space:
mode:
authoriainp5 <iain.pearce.ip@gmail.com>2024-12-10 20:27:19 +0000
committeriainp5 <iain.pearce.ip@gmail.com>2024-12-10 20:27:19 +0000
commitc41b9834c835555c8a595ae88af630da2e357537 (patch)
tree009f3c9cdcc87d8b41bab739015f6669cced34c0 /play.js
parentf8d5e9c44d178897da6d1748661f2169ce77e6aa (diff)
download1989-dawn-of-freedom-c41b9834c835555c8a595ae88af630da2e357537.tar.gz
Add icons
Diffstat (limited to 'play.js')
-rw-r--r--play.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/play.js b/play.js
index 0135fd3..a68ee3c 100644
--- a/play.js
+++ b/play.js
@@ -860,6 +860,22 @@ function sub_die(match) {
return die[match] || match
}
+function sub_icon(match) {
+ console.log('sub_icon called, match', match)
+ return ICONS[match] || match
+}
+
+function sub_arrow(match) {
+ return '<span>&#8594</span>'
+}
+
+const ICONS = {
+ '£CC': '<span class="icon com_c"></span>',
+ '£CU': '<span class="icon com_nc"></span>',
+ '£DC': '<span class="icon dem_c"></span>',
+ '£DU': '<span class="icon dem_nc"></span>',
+}
+
const die = {
D1: '<span class="die white d1"></span>',
D2: '<span class="die white d2"></span>',
@@ -885,7 +901,7 @@ function on_log(text, ix) {
p.className = "i"
}
-
+ console.log('text', text)
text = text.replace(/_/g, " ")
text = text.replace(/C(\d+)/g, sub_card_name)
@@ -893,6 +909,8 @@ function on_log(text, ix) {
text = text.replace(/V(\d+)/g, sub_power_card_value)
text = text.replace(/%(\d+)/g, sub_space_name)
text = text.replace(/D[1-6]/g, sub_die)
+ text = text.replace(/£[CD][CU]\b/g, sub_icon)
+ text = text.replace(/.to/g, sub_arrow)
if (text.match(/^\.h1/)) {
text = text.substring(4)