Merge pull request #3962 from thelounge/xpaw/help-info-blocks

Implement generic monospace blocks for INFO and HELP numerics
This commit is contained in:
Pavel Djundik 2020-07-27 11:02:14 +03:00 committed by GitHub
commit 5a1963647e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
@ -2826,7 +2838,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);