diff options
Diffstat (limited to 'play.js')
-rw-r--r-- | play.js | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -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>→</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) |