mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-23 11:16:59 -04:00
[HTML] Fix up replies
This commit is contained in:
parent
39a33538fe
commit
51acffc92e
5 changed files with 110 additions and 36 deletions
|
@ -93,7 +93,7 @@ img {
|
||||||
filter: blur(44px);
|
filter: blur(44px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.spoiler--hidden .spoiler-image:after {
|
.spoiler--hidden .spoiler-image:after {
|
||||||
content: "SPOILER";
|
content: "SPOILER";
|
||||||
color: #dcddde;
|
color: #dcddde;
|
||||||
background-color: rgba(0, 0, 0, 0.6);
|
background-color: rgba(0, 0, 0, 0.6);
|
||||||
|
@ -102,15 +102,11 @@ img {
|
||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translate(-50%, -50%);
|
transform: translate(-50%, -50%);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
/* padding: 0.5em 0.7em; */
|
|
||||||
padding: 100%;
|
padding: 100%;
|
||||||
/* This ruins those beutifully rounded buttons, but it's needed to prevent a FireFox bug with video and audio elemnts. */
|
|
||||||
/* The bug is that you can click trough the spoiler layer and play the video or audio, I could not identify the cause. */
|
|
||||||
/* I leave this here, in case someone is brave enough to venture in to madness that is undocumented browser behaviour. */
|
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
letter-spacing: 0.05em;
|
letter-spacing: 0.05em;
|
||||||
font-size: 0.9em;
|
font-size: 0.9em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.spoiler--hidden:hover .spoiler-image:after {
|
.spoiler--hidden:hover .spoiler-image:after {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
@ -221,27 +217,46 @@ img {
|
||||||
}
|
}
|
||||||
|
|
||||||
.chatlog__reference {
|
.chatlog__reference {
|
||||||
|
display: flex;
|
||||||
grid-column: 2;
|
grid-column: 2;
|
||||||
margin-left: 1.2em;
|
margin-left: 1.2em;
|
||||||
font-size: smaller;
|
margin-bottom: 0.25em;
|
||||||
|
font-size: 0.875em;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chatlog__reference-avatar {
|
.chatlog__reference-avatar {
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
width: 16px;
|
width: 16px;
|
||||||
vertical-align: middle;
|
margin-right: 0.25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chatlog__reference-name {
|
.chatlog__reference-name {
|
||||||
font-weight: 500;
|
margin-right: 0.25em;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chatlog__reference-content {
|
.chatlog__reference-link {
|
||||||
margin-left: .2em;
|
flex-grow: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatlog__reference-link:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatlog__reference-content > * {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatlog__reference-edited-timestamp {
|
||||||
|
margin-left: 0.25em;
|
||||||
|
font-size: 0.8em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chatlog__author-avatar-container {
|
.chatlog__author-avatar-container {
|
||||||
|
|
|
@ -54,6 +54,18 @@ a {
|
||||||
color: #b5b6b8;
|
color: #b5b6b8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chatlog__reference-link {
|
||||||
|
color: #b5b6b8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatlog__reference-link:hover {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatlog__reference-edited-timestamp {
|
||||||
|
color: rgba(255, 255, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
.chatlog__author-name {
|
.chatlog__author-name {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,18 @@ a {
|
||||||
color: #5f5f60;
|
color: #5f5f60;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chatlog__reference-link {
|
||||||
|
color: #5f5f60;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatlog__reference-link:hover {
|
||||||
|
color: #2f3136;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chatlog__reference-edited-timestamp {
|
||||||
|
color: #747f8d;
|
||||||
|
}
|
||||||
|
|
||||||
.chatlog__author-name {
|
.chatlog__author-name {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #2f3136;
|
color: #2f3136;
|
||||||
|
|
|
@ -14,13 +14,34 @@
|
||||||
ValueTask<string> ResolveUrlAsync(string url) => Model.ExportContext.ResolveMediaUrlAsync(url);
|
ValueTask<string> ResolveUrlAsync(string url) => Model.ExportContext.ResolveMediaUrlAsync(url);
|
||||||
|
|
||||||
var userMember = Model.ExportContext.TryGetMember(Model.MessageGroup.Author.Id);
|
var userMember = Model.ExportContext.TryGetMember(Model.MessageGroup.Author.Id);
|
||||||
|
|
||||||
var userColor = Model.ExportContext.TryGetUserColor(Model.MessageGroup.Author.Id);
|
var userColor = Model.ExportContext.TryGetUserColor(Model.MessageGroup.Author.Id);
|
||||||
var userNick = Model.MessageGroup.Author.IsBot ? Model.MessageGroup.Author.Name : userMember?.Nick ?? Model.MessageGroup.Author.Name;
|
|
||||||
var referencedUserNick = Model.MessageGroup.Author.IsBot ? Model.MessageGroup.Author.Name : userMember?.Nick ?? Model.MessageGroup.Author.Name;
|
|
||||||
|
|
||||||
var userColorStyle = userColor != null
|
var userColorStyle = userColor != null
|
||||||
? $"color: rgb({userColor?.R},{userColor?.G},{userColor?.B})"
|
? $"color: rgb({userColor?.R},{userColor?.G},{userColor?.B})"
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
var userNick = Model.MessageGroup.Author.IsBot
|
||||||
|
? Model.MessageGroup.Author.Name
|
||||||
|
: userMember?.Nick ?? Model.MessageGroup.Author.Name;
|
||||||
|
|
||||||
|
var referencedUserMember = Model.MessageGroup.ReferencedMessage != null
|
||||||
|
? Model.ExportContext.TryGetMember(Model.MessageGroup.ReferencedMessage.Author.Id)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
var referencedUserColor = Model.MessageGroup.ReferencedMessage != null
|
||||||
|
? Model.ExportContext.TryGetUserColor(Model.MessageGroup.ReferencedMessage.Author.Id)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
var referencedUserColorStyle = referencedUserColor != null
|
||||||
|
? $"color: rgb({referencedUserColor?.R},{referencedUserColor?.G},{referencedUserColor?.B})"
|
||||||
|
: null;
|
||||||
|
|
||||||
|
var referencedUserNick = Model.MessageGroup.ReferencedMessage != null
|
||||||
|
? Model.MessageGroup.ReferencedMessage.Author.IsBot
|
||||||
|
? Model.MessageGroup.ReferencedMessage.Author.Name
|
||||||
|
: referencedUserMember?.Nick ?? Model.MessageGroup.ReferencedMessage.Author.Name
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="chatlog__message-group">
|
<div class="chatlog__message-group">
|
||||||
|
@ -32,15 +53,29 @@
|
||||||
@if (Model.MessageGroup.ReferencedMessage != null)
|
@if (Model.MessageGroup.ReferencedMessage != null)
|
||||||
{
|
{
|
||||||
<img class="chatlog__reference-avatar" src="@await ResolveUrlAsync(Model.MessageGroup.ReferencedMessage.Author.AvatarUrl)" alt="Avatar">
|
<img class="chatlog__reference-avatar" src="@await ResolveUrlAsync(Model.MessageGroup.ReferencedMessage.Author.AvatarUrl)" alt="Avatar">
|
||||||
<span class="chatlog__reference-name" title="@Model.MessageGroup.ReferencedMessage.Author.FullName" data-user-id="@Model.MessageGroup.ReferencedMessage.Author.Id">@Model.MessageGroup.ReferencedMessage.Author.FullName</span>
|
<span class="chatlog__reference-name" title="@Model.MessageGroup.ReferencedMessage.Author.FullName" style="@referencedUserColorStyle">@referencedUserNick</span>
|
||||||
|
<a class="chatlog__reference-link" href="#" onclick="scrollToMessage(event, '@Model.MessageGroup.ReferencedMessage.Id')">
|
||||||
<span class="chatlog__reference-content">
|
<span class="chatlog__reference-content">
|
||||||
|
@if (!string.IsNullOrWhiteSpace(Model.MessageGroup.ReferencedMessage.Content))
|
||||||
|
{
|
||||||
@Raw(FormatMarkdown(Model.MessageGroup.ReferencedMessage.Content))
|
@Raw(FormatMarkdown(Model.MessageGroup.ReferencedMessage.Content))
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<em>Click to see original message</em>
|
||||||
|
}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
@if (Model.MessageGroup.ReferencedMessage.EditedTimestamp != null)
|
||||||
|
{
|
||||||
|
<span class="chatlog__reference-edited-timestamp" title="@FormatDate(Model.MessageGroup.ReferencedMessage.EditedTimestamp.Value)">(edited)</span>
|
||||||
|
}
|
||||||
|
</a>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<span class="chatlog__reference-unknown">
|
<span class="chatlog__reference-unknown">
|
||||||
In reply to an unknown message
|
Original message was deleted.
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -258,19 +258,19 @@ namespace DiscordChatExporter.Domain.Exporting.Writers
|
||||||
|
|
||||||
// Mentions
|
// Mentions
|
||||||
_writer.WriteStartArray("mentions");
|
_writer.WriteStartArray("mentions");
|
||||||
|
|
||||||
foreach (var mention in message.MentionedUsers)
|
foreach (var mention in message.MentionedUsers)
|
||||||
await WriteMentionAsync(mention);
|
await WriteMentionAsync(mention);
|
||||||
|
|
||||||
_writer.WriteEndArray();
|
_writer.WriteEndArray();
|
||||||
|
|
||||||
// Reference
|
// Message reference
|
||||||
|
if (message.Reference != null)
|
||||||
if (message.Reference is not null)
|
|
||||||
{
|
{
|
||||||
_writer.WriteStartObject("reference");
|
_writer.WriteStartObject("reference");
|
||||||
_writer.WriteString("messageId", message.Reference.MessageId);
|
_writer.WriteString("messageId", message.Reference.MessageId?.ToString());
|
||||||
_writer.WriteString("channelId", message.Reference.ChannelId);
|
_writer.WriteString("channelId", message.Reference.ChannelId?.ToString());
|
||||||
_writer.WriteString("guildId", message.Reference.GuildId);
|
_writer.WriteString("guildId", message.Reference.GuildId?.ToString());
|
||||||
_writer.WriteEndObject();
|
_writer.WriteEndObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue