mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-07 10:30:37 +00:00
[HTML] Clean up a bit
This commit is contained in:
@@ -59,7 +59,7 @@ namespace DiscordChatExporter.Core.Rendering.Logic
|
||||
|
||||
// Spoiler
|
||||
if (formattedNode.Formatting == TextFormatting.Spoiler)
|
||||
return $"<span class=\"spoiler spoiler--hidden\"><span class=\"spoiler-text\">{innerHtml}</span></span>";
|
||||
return $"<span class=\"spoiler spoiler--hidden\" onclick=\"showSpoiler(event, this)\"><span class=\"spoiler-text\">{innerHtml}</span></span>";
|
||||
|
||||
// Quote
|
||||
if (formattedNode.Formatting == TextFormatting.Quote)
|
||||
@@ -117,7 +117,8 @@ namespace DiscordChatExporter.Core.Rendering.Logic
|
||||
{
|
||||
var role = context.MentionableRoles.FirstOrDefault(r => r.Id == mentionNode.Id) ??
|
||||
Role.CreateDeletedRole(mentionNode.Id);
|
||||
string style = "";
|
||||
|
||||
var style = "";
|
||||
if (role.Color != Color.Black)
|
||||
style = $"style=\"color: {role.ColorAsHex}; background-color: rgba({role.ColorAsRgb}, 0.1); font-weight: 400;\"";
|
||||
|
||||
|
||||
@@ -54,60 +54,53 @@ img {
|
||||
}
|
||||
|
||||
.spoiler {
|
||||
border-radius: 3px;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
.spoiler--hidden {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.spoiler-text {
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.spoiler--hidden .spoiler-text {
|
||||
opacity: 0;
|
||||
color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.spoiler-image {
|
||||
margin-top: 0.3em;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0.5px 0.5px 1px 1px rgba(0,0,0,.1);
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
width: fit-content;
|
||||
overflow: hidden;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.spoiler-image:hover .spoiler-warning {
|
||||
color: #fff;
|
||||
background-color: rgba(0,0,0,.9);
|
||||
.spoiler--hidden .spoiler-image {
|
||||
box-shadow: 0px 0px 1px 1px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.spoiler-warning {
|
||||
.spoiler--hidden .spoiler-image img {
|
||||
filter: blur(44px);
|
||||
}
|
||||
|
||||
.spoiler--hidden .spoiler-image:after {
|
||||
content: "SPOILER";
|
||||
color: #dcddde;
|
||||
background-color: rgba(0,0,0,.6);
|
||||
|
||||
background-color: rgba(0, 0, 0, 0.6);
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%,-50%);
|
||||
text-transform: uppercase;
|
||||
display: flex;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-direction: normal;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
transform: translate(-50%, -50%);
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
z-index: 1;
|
||||
padding: 8px 12px;
|
||||
padding: 0.5em 0.7em;
|
||||
border-radius: 20px;
|
||||
letter-spacing: .5px;
|
||||
font-size: 15px;
|
||||
user-select: none;
|
||||
letter-spacing: 0.05em;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
.spoiler-image-wrapper {
|
||||
margin-top: -0.3em;
|
||||
filter: blur(44px);
|
||||
pointer-events: none;
|
||||
.spoiler--hidden:hover .spoiler-image:after {
|
||||
color: #fff;
|
||||
background-color: rgba(0, 0, 0, 0.9);
|
||||
}
|
||||
|
||||
.quote {
|
||||
@@ -248,8 +241,13 @@ img {
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.chatlog__attachment-thumbnail {
|
||||
.chatlog__attachment {
|
||||
margin-top: 0.3em;
|
||||
}
|
||||
|
||||
.chatlog__attachment-thumbnail {
|
||||
display: block;
|
||||
max-width: 45vw;
|
||||
max-height: 500px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
@@ -9,16 +9,16 @@ a {
|
||||
color: #0096cf;
|
||||
}
|
||||
|
||||
.spoiler {
|
||||
.spoiler-text {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.spoiler--hidden {
|
||||
.spoiler--hidden .spoiler-text {
|
||||
background-color: #202225;
|
||||
}
|
||||
|
||||
.spoiler--hidden:hover {
|
||||
background-color: rgba(32,34,37,.8);
|
||||
.spoiler--hidden:hover .spoiler-text {
|
||||
background-color: rgba(32, 34, 37, 0.8);
|
||||
}
|
||||
|
||||
.quote {
|
||||
|
||||
@@ -45,24 +45,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
// unhiding text spoilers on click
|
||||
document.addEventListener('click', (e) => {
|
||||
var spoilerTag = e.target.closest('.spoiler--hidden');
|
||||
if (!spoilerTag) {
|
||||
return;
|
||||
function showSpoiler(event, element) {
|
||||
if (element && element.classList.contains('spoiler--hidden')) {
|
||||
event.preventDefault();
|
||||
element.classList.remove('spoiler--hidden');
|
||||
}
|
||||
spoilerTag.classList.remove('spoiler--hidden');
|
||||
});
|
||||
|
||||
// unhiding image spoilers on click
|
||||
document.addEventListener('click', (e) => {
|
||||
var spoilerImage = e.target.closest('.spoiler-image');
|
||||
if (!spoilerImage) {
|
||||
return;
|
||||
}
|
||||
var image = spoilerImage.querySelector('a');
|
||||
spoilerImage.replaceWith(image);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -10,16 +10,16 @@ a {
|
||||
color: #00b0f4;
|
||||
}
|
||||
|
||||
.spoiler {
|
||||
.spoiler-text {
|
||||
background-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.spoiler--hidden {
|
||||
.spoiler--hidden .spoiler-text {
|
||||
background-color: #b9bbbe;
|
||||
}
|
||||
|
||||
.spoiler--hidden:hover {
|
||||
background-color: rgba(185,187,190,.8);
|
||||
.spoiler--hidden:hover .spoiler-text {
|
||||
background-color: rgba(185, 187, 190, 0.8);
|
||||
}
|
||||
|
||||
.quote {
|
||||
|
||||
@@ -34,24 +34,23 @@
|
||||
<div class="chatlog__attachment">
|
||||
{{ # Spoiler image }}
|
||||
{{~ if attachment.IsSpoiler ~}}
|
||||
<div class="spoiler spoiler--hidden" onclick="showSpoiler(event, this)">
|
||||
<div class="spoiler-image">
|
||||
<div class="spoiler-warning">Spoiler</div>
|
||||
<div class="spoiler-image-wrapper">
|
||||
<a href="{{ attachment.Url }}">
|
||||
<img class="chatlog__attachment-thumbnail" src="{{ attachment.Url }}" alt="Attachment" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{{~ else ~}}
|
||||
<a href="{{ attachment.Url }}">
|
||||
{{ # Non-spoiler image }}
|
||||
{{~ if attachment.IsImage ~}}
|
||||
<a href="{{ attachment.Url }}">
|
||||
<img class="chatlog__attachment-thumbnail" src="{{ attachment.Url }}" alt="Attachment" />
|
||||
{{~ # Non-image ~}}
|
||||
{{~ else ~}}
|
||||
Attachment: {{ attachment.FileName }} ({{ attachment.FileSize }})
|
||||
{{~ end ~}}
|
||||
</a>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{{~ else ~}}
|
||||
<a href="{{ attachment.Url }}">
|
||||
{{ # Non-spoiler image }}
|
||||
{{~ if attachment.IsImage ~}}
|
||||
<img class="chatlog__attachment-thumbnail" src="{{ attachment.Url }}" alt="Attachment" />
|
||||
{{~ # Non-image ~}}
|
||||
{{~ else ~}}
|
||||
Attachment: {{ attachment.FileName }} ({{ attachment.FileSize }})
|
||||
{{~ end ~}}
|
||||
</a>
|
||||
{{~ end ~}}
|
||||
</div>
|
||||
{{~ end ~}}
|
||||
|
||||
Reference in New Issue
Block a user