@@ -329,7 +356,7 @@ $comments_pag = new Paginator([
$('.uoj-blog-hide-comment-btn').each(function() {
$(this).click(function(event) {
var comment_id = $(this).data('comment-id');
-
+
event.preventDefault();
toggleModalHideComment(comment_id, $('#comment-content-' + comment_id).html());
});
diff --git a/web/app/models/UOJMarkdown.php b/web/app/models/UOJMarkdown.php
index 8592721..d917d5e 100644
--- a/web/app/models/UOJMarkdown.php
+++ b/web/app/models/UOJMarkdown.php
@@ -62,7 +62,7 @@ class UOJMarkdown extends ParsedownMath {
$mentioned_user = UOJUser::query($matches[1]);
if ($mentioned_user) {
- $color = '#0d6efd';
+ $color = 'blue';
if ($this->options['username_with_color']) {
$color = UOJUser::getUserColor($mentioned_user);
@@ -74,7 +74,7 @@ class UOJMarkdown extends ParsedownMath {
'name' => 'span',
'text' => '@' . $mentioned_user['username'],
'attributes' => [
- 'class' => 'uoj-username',
+ 'class' => "uoj-username uoj-username-{$color}",
'data-realname' => UOJUser::getRealname($mentioned_user),
'data-color' => $color,
],
diff --git a/web/css/uoj-bs5.css b/web/css/uoj-bs5.css
index 6bca375..4474193 100644
--- a/web/css/uoj-bs5.css
+++ b/web/css/uoj-bs5.css
@@ -395,9 +395,6 @@ form.form-horizontal {
/* Comments */
.comment-content {
- white-space: pre-wrap;
- word-break: break-all;
-
min-height: 50px;
}
diff --git a/web/js/uoj.js b/web/js/uoj.js
index 191e091..520f0ba 100644
--- a/web/js/uoj.js
+++ b/web/js/uoj.js
@@ -176,6 +176,10 @@ $.fn.uoj_honor = function() {
});
}
+function getClickZanBlock(type, id, cnt, val) {
+ return '
';
+}
+
function showErrorHelp(name, err) {
if (err) {
$('#div-' + name).addClass('has-validation has-error');
@@ -291,6 +295,11 @@ $.fn.click_zan_block = function() {
var type = $(this).data('type');
var val = parseInt($(this).data('val'));
var cnt = parseInt($(this).data('cnt'));
+ var rendered = $(this).attr('data-click-zan-rendered');
+
+ if (rendered == 'true') {
+ return;
+ }
if (isNaN(cnt)) {
return;
}
@@ -330,8 +339,9 @@ $.fn.click_zan_block = function() {
var display_cnt = cnt > 0 ? '+' + cnt : cnt;
if (cnt < 0) display_cnt = '-?';
-
+
$(this)
+ .attr('data-click-zan-rendered', 'true')
.append(up_node)
.append(down_node)
.append($('
[' + display_cnt + ']'));
@@ -1707,25 +1717,41 @@ function showCommentReplies(id, replies) {
function(reply) {
return $('').append(
$('
| ').append(
- $('')
- ).append(
- $('
').append(
- '
' + reply.post_time + ''
+ $('
').append(
+ $('
').append(
+ $('
').append(
+ $('
').attr('src', reply.poster_avatar)
+ ).attr('href', uojHome + '/user/' + reply.poster)
+ )
).append(
- user_can_hide_comment
- ? $('
').append(
- $('
').data('comment-id', reply.id).text('隐藏').click(function(event) {
- event.preventDefault();
- toggleModalHideComment(reply.id, reply.content);
- })
+ $('
').append(
+ $('
').append(
+ $('
').append(getUserLink(reply.poster, reply.poster_realname, reply.poster_username_color))
+ ).append(
+ $('
').append(reply.click_zan_block)
+ )
+ ).append(
+ $('
').attr('id', 'comment-content-' + reply.id).html(reply.content)
+ ).append(
+ $('
').append(
+ '
' + reply.post_time + ''
+ ).append(
+ user_can_hide_comment
+ ? $('
').append(
+ $('
').data('comment-id', reply.id).text('隐藏').click(function(event) {
+ event.preventDefault();
+ toggleModalHideComment(reply.id, reply.content);
+ })
+ )
+ : ''
+ ).append(
+ $('
').append(
+ $('
回复').click(function (e) {
+ e.preventDefault();
+ toggleFormReply(reply.id, '回复 @' + reply.poster + ':');
+ })
+ )
)
- : ''
- ).append(
- $('
').append(
- $('
回复').click(function (e) {
- e.preventDefault();
- toggleFormReply(reply.id, '回复 @' + reply.poster + ':');
- })
)
)
)