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