fix(blog): styles of comment
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2023-02-01 21:30:36 +08:00
parent 847a34519d
commit e323e7367e
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 54 additions and 161 deletions

View File

@ -204,31 +204,33 @@ $comments_pag = new Paginator([
?> ?>
<div id="comment-<?= $comment['id'] ?>" class="list-group-item"> <div id="comment-<?= $comment['id'] ?>" class="list-group-item">
<div class="d-flex"> <div class="d-flex">
<div class="comtposterbox mr-3 flex-shrink-0"> <div class="mr-3 flex-shrink-0">
<a href="<?= HTML::url('/user/' . $poster['username']) ?>" class="d-none d-sm-block text-decoration-none"> <a href="<?= HTML::url('/user/' . $poster['username']) ?>" class="d-none d-sm-block text-decoration-none">
<img class="media-object img-rounded" src="<?= $asrc ?>" alt="avatar" /> <img class="media-object img-rounded" src="<?= $asrc ?>" alt="Avatar of <?= $poster['username'] ?>" width="64" height="64" />
</a> </a>
</div> </div>
<div id="comment-body-<?= $comment['id'] ?>" class="comtbox flex-grow-1 ms-3"> <div id="comment-body-<?= $comment['id'] ?>" class="flex-grow-1 ms-3">
<div class="row"> <div class="row justify-content-between flex-wrap">
<div class="col-sm-6"><?= UOJUser::getLink($poster['username']) ?></div> <div class="col-auto">
<div class="col-sm-6 text-end"><?= ClickZans::getBlock('BC', $comment['id'], $comment['zan']) ?></div> <?= UOJUser::getLink($poster['username']) ?>
</div>
<div class="col-auto">
<?= ClickZans::getBlock('BC', $comment['id'], $comment['zan']) ?>
</div>
</div> </div>
<div class="comtbox1"><?= $comment['content'] ?></div> <div class="comment-content my-2"><?= $comment['content'] ?></div>
<ul class="list-inline mb-0 text-end"> <ul class="list-inline mb-0 text-end">
<li> <li class="list-inline-item small text-muted">
<small class="text-muted"> <?= $comment['post_time'] ?>
<?= $comment['post_time'] ?>
</small>
</li> </li>
<li> <li class="list-inline-item">
<a class="text-decoration-none" id="reply-to-<?= $comment['id'] ?>" href="#"> <a class="text-decoration-none" id="reply-to-<?= $comment['id'] ?>" href="#">
回复 回复
</a> </a>
</li> </li>
</ul> </ul>
<?php if ($replies) : ?> <?php if ($replies) : ?>
<div id="replies-<?= $comment['id'] ?>" class="comtbox5"></div> <div id="replies-<?= $comment['id'] ?>" class="rounded bg-secondary bg-opacity-10 border"></div>
<?php endif ?> <?php endif ?>
<script type="text/javascript"> <script type="text/javascript">
showCommentReplies('<?= $comment['id'] ?>', <?= $replies_json ?>); showCommentReplies('<?= $comment['id'] ?>', <?= $replies_json ?>);

View File

@ -1,5 +1,7 @@
/* S2OJ Bootstrap 5 Theme */ /* S2OJ Bootstrap 5 Theme */
/* - Global Reset - */
body { body {
overflow-y: scroll; overflow-y: scroll;
} }
@ -12,6 +14,8 @@ a {
text-decoration: none; text-decoration: none;
} }
/* Content */
.uoj-pre { .uoj-pre {
padding: 1em; padding: 1em;
} }
@ -30,6 +34,8 @@ a {
font-weight: normal; font-weight: normal;
} }
/* Headings */
h1, h1,
.h1 { .h1 {
/* font-size: 2.5rem; */ /* font-size: 2.5rem; */
@ -65,33 +71,15 @@ h6,
font-size: 1rem; font-size: 1rem;
} }
.form-group { /* Difficulty */
margin-bottom: 1rem;
}
.form-inline .form-control {
display: inline-block;
width: auto;
vertical-align: middle;
}
.form-row {
display: flex;
flex-wrap: wrap;
margin-right: -5px;
margin-left: -5px;
}
.form-row > .col {
padding-left: 5px;
padding-right: 5px;
}
.uoj-difficulty { .uoj-difficulty {
font-size: 0.9em; font-size: 0.9em;
font-weight: bold; font-weight: bold;
} }
/* Table */
.uoj-table > tbody > tr:last-child, .uoj-table > tbody > tr:last-child,
.uoj-table > tbody > tr:last-child > td { .uoj-table > tbody > tr:last-child > td {
border-bottom-color: transparent; border-bottom-color: transparent;
@ -112,6 +100,8 @@ h6,
border-right-color: transparent; border-right-color: transparent;
} }
/* Click zan */
.uoj-click-zan-block { .uoj-click-zan-block {
display: inline-block; display: inline-block;
min-width: 100px; min-width: 100px;
@ -149,6 +139,8 @@ h6,
color: red; color: red;
} }
/* Submission details */
.uoj-submission-result-item { .uoj-submission-result-item {
cursor: pointer; cursor: pointer;
} }
@ -177,6 +169,8 @@ h6,
color: #ff4f4f; color: #ff4f4f;
} }
/* Markdown */
.markdown-body h1 { .markdown-body h1 {
font-size: 2em; font-size: 2em;
margin-bottom: 1rem; margin-bottom: 1rem;
@ -238,61 +232,29 @@ h6,
margin-bottom: 1em; margin-bottom: 1em;
} }
/* PDF */
.pdf-page-canvas { .pdf-page-canvas {
width: 100% !important; width: 100% !important;
} }
form.uoj-bs4-form-inline { /* Form */
display: inline-block;
margin-right: 0.3em;
}
form.uoj-bs4-form-narrow label.col-sm-2 {
max-width: 100% !important;
padding: 0 !important;
}
form.uoj-bs4-form-narrow div.col-sm-3 {
max-width: 100% !important;
padding: 0 !important;
}
form.form-horizontal { form.form-horizontal {
margin-bottom: 8px; margin-bottom: 8px;
} }
form.uoj-bs4-form-compressed { .form-group {
margin: 12px 0; margin-bottom: 1rem;
} }
form.uoj-bs4-form-compressed div.form-group { .form-inline .form-control {
display: inline-block; display: inline-block;
width: 24em; width: auto;
vertical-align: middle;
} }
form.uoj-bs4-form-compressed div.form-group label.col-sm-2 { /* User accepted problems list */
display: inline-block;
max-width: 100%;
width: 6em;
padding: 0;
}
form.uoj-bs4-form-compressed div.form-group div.col-sm-3 {
display: inline-block;
max-width: 100%;
width: 16em;
}
form.uoj-bs4-form-compressed div.text-center,
form.uoj-bs4-form-compressed div.text-compressed,
form.uoj-bs4-form-compressed button {
display: inline-block;
}
form.uoj-bs4-form-compressed button {
position: relative;
top: -6px;
}
@media (max-width: 767px) { @media (max-width: 767px) {
.uoj-ac-problems-list li { .uoj-ac-problems-list li {
@ -322,91 +284,14 @@ form.uoj-bs4-form-compressed button {
/* Comments */ /* Comments */
.comt { .comment-content {
}
.comtposterbox {
text-align: center;
}
.comtbox {
width: 100%;
}
.comtbox1 {
white-space: pre-wrap; white-space: pre-wrap;
word-break: break-all; word-break: break-all;
min-height: 80px;
margin-top: 10px;
margin-bottom: 10px;
}
.comtbox2 {
text-align: right;
}
.comtbox3 {
display: inline-block;
margin-right: 5px;
}
.comtbox4 {
display: inline-block;
}
.comtbox5 {
background-image: linear-gradient(to bottom, #f5f5f5 0, #fafafa 100%);
background-repeat: repeat-x;
border-color: #dcdcdc;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05),
0 1px 0 rgba(255, 255, 255, 0.1);
padding: 9px;
border-radius: 3px;
min-height: 20px; min-height: 50px;
margin-bottom: 20px;
border: 1px solid #e3e3e3;
margin-top: 10px;
} }
.comtbox6 {
white-space: pre-wrap;
word-break: break-all;
}
.comtbox7 {
background-image: linear-gradient(to bottom, #f5f5f5 0%, #fafafa 100%);
background-repeat: repeat-x;
border-color: #dcdcdc;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05),
0 1px 0 rgba(255, 255, 255, 0.1);
border-radius: 3px;
margin-left: 50px; /* Standing table */
margin-top: 10px;
margin-bottom: 2px;
padding-left: 10px;
padding-right: 10px;
padding-top: 10px;
white-space: nowrap;
padding-bottom: 10px;
border: 1px solid #e3e3e3;
text-align: left;
}
.comtbox8 {
background-image: linear-gradient(to bottom, #ffffff 100%, #fafafa 0%);
background-repeat: repeat-x;
border-color: #dcdcdc;
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05),
0 1px 0 rgba(255, 255, 255, 0.1);
border-radius: 3px;
margin-left: 50px;
margin-top: 10px;
margin-bottom: 2px;
padding-left: 10px;
padding-right: 10px;
padding-top: 10px;
white-space: nowrap;
padding-bottom: 10px;
border: 1px solid #e3e3e3;
text-align: left;
}
.uoj-standings-table tr td:first-child, .uoj-standings-table tr td:first-child,
.uoj-standings-table tr th:first-child { .uoj-standings-table tr th:first-child {
@ -464,15 +349,21 @@ form.uoj-bs4-form-compressed button {
} }
} }
/* Fix CodeMirror */
.CodeMirror-linenumber { .CodeMirror-linenumber {
font-size: 14px !important; font-size: 14px !important;
} }
/* Back button */
.uoj-back-btn { .uoj-back-btn {
--bs-btn-hover-bg: #d3d4d570; --bs-btn-hover-bg: #d3d4d570;
--bs-btn-hover-border-color: transparent; --bs-btn-hover-border-color: transparent;
} }
/* Remote Content */
.remote-content center > img + span { .remote-content center > img + span {
display: block; display: block;
font-size: 90%; font-size: 90%;

View File

@ -1030,13 +1030,13 @@ function showCommentReplies(id, replies) {
function(reply) { function(reply) {
return $('<tr id="' + 'comment-' + reply.id + '" />').append( return $('<tr id="' + 'comment-' + reply.id + '" />').append(
$('<td />').append( $('<td />').append(
$('<div class="comtbox6">' + getUserLink(reply.poster, reply.poster_realname, reply.poster_username_color) + '' + reply.content + '</div>') $('<div class="comment-content">' + getUserLink(reply.poster, reply.poster_realname, reply.poster_username_color) + '' + reply.content + '</div>')
).append( ).append(
$('<ul class="' + (isBootstrap5Page ? 'text-end mb-0' : 'text-right bot-buffer-no') + ' list-inline" />').append( $('<ul class="text-end mb-0 list-inline" />').append(
'<li>' + '<small class="text-muted">' + reply.post_time + '</small>' + '</li>' '<li class="list-inline-item small text-muted">' + reply.post_time + '</li>'
).append( ).append(
$('<li />').append( $('<li class="list-inline-item" />').append(
$('<a class=" ' + (isBootstrap5Page ? ' text-decoration-none ' : '') + ' " href="#">回复</a>').click(function (e) { $('<a href="#">回复</a>').click(function (e) {
e.preventDefault(); e.preventDefault();
toggleFormReply(reply.id, '回复 @' + reply.poster + ''); toggleFormReply(reply.id, '回复 @' + reply.poster + '');
}) })
@ -1045,7 +1045,7 @@ function showCommentReplies(id, replies) {
) )
).uoj_highlight(); ).uoj_highlight();
}, { }, {
table_classes: ['table', 'table-condensed'], table_classes: ['table'],
page_len: 5, page_len: 5,
prevent_focus_on_click: true prevent_focus_on_click: true
} }