From 5209b12d448a91a00099594f0c4badef2927361f Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 16 Jul 2018 20:54:47 +0300 Subject: [PATCH 1/2] Fix MOTD display to actually only trim new lines --- client/js/render.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/js/render.js b/client/js/render.js index 3fd6cec6..ddde4400 100644 --- a/client/js/render.js +++ b/client/js/render.js @@ -112,7 +112,10 @@ function buildChatMessage(msg) { } // Remove empty lines around the MOTD (but not within it) - msg.text = lines.join("\n").trim(); + msg.text = lines + .map((line) => line.trimEnd()) + .join("\n") + .replace(/^[\r\n]+|[\r\n]+$/g, ""); } const renderedMessage = $(templates[template](msg)); From ee4c8d78d34cb05370023e7ef3f48074792bd5c6 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Mon, 16 Jul 2018 20:59:45 +0300 Subject: [PATCH 2/2] Use monospace font on MOTDs and set an icon --- client/css/style.css | 13 +++++++++++++ client/themes/morning.css | 1 + 2 files changed, 14 insertions(+) diff --git a/client/css/style.css b/client/css/style.css index e65cc1ae..ba45183e 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -109,6 +109,7 @@ button { code, pre, +#chat .msg.motd .text, .irc-monospace, textarea#user-specified-css-input { font-family: Consolas, Menlo, Monaco, "Lucida Console", "DejaVu Sans Mono", "Courier New", monospace; @@ -248,6 +249,7 @@ kbd { #chat .quit .from::before, #chat .topic .from::before, #chat .mode .from::before, +#chat .motd .from::before, #chat .ctcp .from::before, #chat .ctcp_request .from::before, #chat .whois .from::before, @@ -365,6 +367,10 @@ kbd { color: #2ecc40; } +#chat .motd .from::before { + content: "\f02e"; /* https://fontawesome.com/icons/bookmark?style=solid */ +} + #chat .ctcp .from::before, #chat .ctcp_request .from::before { content: "\f15c"; /* https://fontawesome.com/icons/file-alt?style=solid */ @@ -1335,6 +1341,13 @@ background on hover (unless active) */ display: none !important; } +#chat .msg.motd .text { + background: #f6f6f6; + display: inline-block; + border-radius: 4px; + padding: 6px; +} + #chat .condensed .content, #chat .away .content, #chat .back .content, diff --git a/client/themes/morning.css b/client/themes/morning.css index 0ce68f90..2cdf150f 100644 --- a/client/themes/morning.css +++ b/client/themes/morning.css @@ -158,6 +158,7 @@ color: #b7c5d1; } +#chat .msg.motd .text, code, .irc-monospace { background: #28333d;