From c0b6808daab53262fff02fee5d1d5fcebf5f22d4 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 29 Nov 2024 13:38:06 +0100 Subject: Add margins to headers in log automatically (without needing log_br). --- play.css | 2 ++ play.js | 12 ++++++------ rules.js | 13 ++----------- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/play.css b/play.css index 1de0d40..e164ffb 100644 --- a/play.css +++ b/play.css @@ -43,6 +43,8 @@ body.Communist header.your_turn { background-color: hsl(355, 70%, 75%); } #log .h2.dem { background-color: hsl(206, 85%, 80%); } #log .h2.com { background-color: hsl(355, 70%, 80%); } +#log .h1, #log .h2, #log .h3 { margin: 6px 0; } + #log div { padding-left: 20px; text-indent: -12px; } #log div.i { padding-left: 32px; text-indent: -12px; } #log div.ii { padding-left: 44px; text-indent: -12px; } diff --git a/play.js b/play.js index 1db1cb4..dfb9afe 100644 --- a/play.js +++ b/play.js @@ -878,15 +878,15 @@ function on_log(text) { if (text.match(/^\.h1/)) { text = text.substring(4) p.className = "h1" - } else if (text.match(/^\.h2d/)) { - text = text.substring(5) - p.className = "h2 dem" - } else if (text.match(/^\.h2c/)) { - text = text.substring(5) - p.className = "h2 com" } else if (text.match(/^\.h2/)) { text = text.substring(4) p.className = "h2" + } else if (text.match(/^\.d/)) { + text = "Democrat" + p.className = "h2 dem" + } else if (text.match(/^\.c/)) { + text = "Communist" + p.className = "h2 com" } else if (text.match(/^\.h3/)) { text = text.substring(4) p.className = "h3" diff --git a/rules.js b/rules.js index b245f35..11545ff 100644 --- a/rules.js +++ b/rules.js @@ -3800,7 +3800,6 @@ function new_turn() { if (game.summary.length > 0) { log('No longer in effect:') pop_summary_i() - log_br() } delete game.stasi_card delete game.stand_fast @@ -4135,19 +4134,14 @@ function logi(msg) { } function log_h1(msg) { - log_br() log(".h1 " + msg) - log_br() } function log_h2(msg) { - log_br() log(".h2 " + msg) - log_br() } function log_h3(msg) { - log_br() log(".h3 " + msg) } @@ -4162,12 +4156,10 @@ function log_msg_gap(msg) { } function log_side() { - log_br() if (game.active === DEM) - log(".h2d " + game.active) + log(".d") else - log(".h2c " + game.active) - log_br() + log(".c") } // ============= SUMMARY FUNCTIONS ============= @@ -4220,7 +4212,6 @@ function pop_summary_i() { function do_log_summary() { if (game.summary.length > 0) { pop_summary() - log_br() } } -- cgit v1.2.3