Implement generic monospace blocks for INFO and MOTD numerics

Fixes #3961
This commit is contained in:
Pavel Djundik 2020-06-29 10:51:17 +03:00
parent 0ac1fcb471
commit 63a420ac21
9 changed files with 69 additions and 12 deletions

View file

@ -6,6 +6,7 @@
{self: message.self, highlight: message.highlight, 'previous-source': isPreviousSource},
]"
:data-type="message.type"
:data-command="message.command"
:data-from="message.from && message.from.nick"
>
<span :aria-label="messageTimeLocale" class="time tooltipped tooltipped-e"

View file

@ -8,7 +8,7 @@
import ParsedMessage from "../ParsedMessage.vue";
export default {
name: "MessageTypeMOTD",
name: "MessageTypeMonospaceBlock",
components: {
ParsedMessage,
},

View file

@ -144,7 +144,7 @@ button {
code,
pre,
#chat .msg[data-type="motd"] .text,
#chat .msg[data-type="monospace_block"] .text,
.irc-monospace,
textarea#user-specified-css-input {
font-family: Consolas, Menlo, Monaco, "Lucida Console", "DejaVu Sans Mono", "Courier New", monospace;
@ -303,7 +303,9 @@ p {
#chat .msg[data-type="topic"] .from::before,
#chat .msg[data-type="mode_channel"] .from::before,
#chat .msg[data-type="mode"] .from::before,
#chat .msg[data-type="motd"] .from::before,
#chat .msg[data-command="motd"] .from::before,
#chat .msg[data-command="help"] .from::before,
#chat .msg[data-command="info"] .from::before,
#chat .msg[data-type="ctcp"] .from::before,
#chat .msg[data-type="ctcp_request"] .from::before,
#chat .msg[data-type="whois"] .from::before,
@ -427,11 +429,21 @@ p {
color: #2ecc40;
}
#chat .msg[data-type="motd"] .from::before {
#chat .msg[data-command="motd"] .from::before {
content: "\f02e"; /* https://fontawesome.com/icons/bookmark?style=solid */
color: var(--body-color-muted);
}
#chat .msg[data-command="help"] .from::before {
content: "\f059"; /* https://fontawesome.com/icons/question-circle?style=solid */
color: var(--body-color-muted);
}
#chat .msg[data-command="info"] .from::before {
content: "\f05a"; /* https://fontawesome.com/icons/info-circle?style=solid */
color: var(--body-color-muted);
}
#chat .msg[data-type="ctcp"] .from::before,
#chat .msg[data-type="ctcp_request"] .from::before {
content: "\f15c"; /* https://fontawesome.com/icons/file-alt?style=solid */
@ -1454,11 +1466,11 @@ textarea.input {
width: 50px;
}
#chat.hide-motd .msg[data-type="motd"] {
#chat.hide-motd .msg[data-command="motd"] {
display: none !important;
}
#chat .msg[data-type="motd"] .text {
#chat .msg[data-type="monospace_block"] .text {
background: #f6f6f6;
display: inline-block;
border-radius: 4px;
@ -2818,7 +2830,7 @@ part/quit messages where we don't load previews (adds a blank line otherwise) */
.header .topic,
#chat .msg[data-type="action"] .content,
#chat .msg[data-type="message"] .content,
#chat .msg[data-type="motd"] .content,
#chat .msg[data-type="monospace_block"] .content,
#chat .msg[data-type="notice"] .content,
#chat .ctcp-message,
#chat .part-reason,

View file

@ -124,7 +124,7 @@ body {
color: #f92772;
}
#chat .msg[data-type="motd"] .text,
#chat .msg[data-type="monospace_block"] .text,
code,
.irc-monospace {
background: #28333d;

View file

@ -28,6 +28,8 @@ const events = [
"ctcp",
"chghost",
"error",
"help",
"info",
"invite",
"join",
"kick",

View file

@ -43,7 +43,7 @@ class Msg {
}
return (
this.type !== Msg.Type.MOTD &&
this.type !== Msg.Type.MONOSPACE_BLOCK &&
this.type !== Msg.Type.ERROR &&
this.type !== Msg.Type.TOPIC_SET_BY &&
this.type !== Msg.Type.MODE_CHANNEL &&
@ -66,7 +66,7 @@ Msg.Type = {
MESSAGE: "message",
MODE: "mode",
MODE_CHANNEL: "mode_channel",
MOTD: "motd",
MONOSPACE_BLOCK: "monospace_block",
NICK: "nick",
NOTICE: "notice",
PART: "part",

View file

@ -0,0 +1,20 @@
"use strict";
const Msg = require("../../models/msg");
module.exports = function (irc, network) {
const client = this;
irc.on("help", function (data) {
const lobby = network.channels[0];
if (data.help) {
const msg = new Msg({
type: Msg.Type.MONOSPACE_BLOCK,
command: "help",
text: data.help,
});
lobby.pushMessage(client, msg);
}
});
};

View file

@ -0,0 +1,20 @@
"use strict";
const Msg = require("../../models/msg");
module.exports = function (irc, network) {
const client = this;
irc.on("info", function (data) {
const lobby = network.channels[0];
if (data.info) {
const msg = new Msg({
type: Msg.Type.MONOSPACE_BLOCK,
command: "info",
text: data.info,
});
lobby.pushMessage(client, msg);
}
});
};

View file

@ -10,7 +10,8 @@ module.exports = function (irc, network) {
if (data.motd) {
const msg = new Msg({
type: Msg.Type.MOTD,
type: Msg.Type.MONOSPACE_BLOCK,
command: "motd",
text: data.motd,
});
lobby.pushMessage(client, msg);
@ -18,7 +19,8 @@ module.exports = function (irc, network) {
if (data.error) {
const msg = new Msg({
type: Msg.Type.MOTD,
type: Msg.Type.MONOSPACE_BLOCK,
command: "motd",
text: data.error,
});
lobby.pushMessage(client, msg);