fix: 回复用 span+JS事件绑定(取代a标签href冲突)
This commit is contained in:
+13
-1
@@ -27,7 +27,7 @@ if (post_password_required()) return;
|
|||||||
</div>
|
</div>
|
||||||
<div class="comment-item__text"><?php echo esc_html($c->comment_content); ?></div>
|
<div class="comment-item__text"><?php echo esc_html($c->comment_content); ?></div>
|
||||||
<div class="comment-item__reply">
|
<div class="comment-item__reply">
|
||||||
<a href="#respond" onclick="document.getElementById('comment_parent').value='<?php echo $c->comment_ID; ?>';document.getElementById('comment').focus()">回复</a>
|
<span class="reply-link" data-comment-id="<?php echo $c->comment_ID; ?>" tabindex="0">回复</span>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
@@ -79,4 +79,16 @@ if (post_password_required()) return;
|
|||||||
</script>
|
</script>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.querySelectorAll('.reply-link').forEach(function(el) {
|
||||||
|
el.addEventListener('click', function() {
|
||||||
|
var cid = this.getAttribute('data-comment-id');
|
||||||
|
document.getElementById('comment_parent').value = cid;
|
||||||
|
var textarea = document.getElementById('comment');
|
||||||
|
if (textarea) textarea.focus();
|
||||||
|
});
|
||||||
|
el.style.cursor = 'pointer';
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Theme Name: 空笺未寄
|
Theme Name: 空笺未寄
|
||||||
Version: 0.16.6
|
Version: 0.16.7
|
||||||
Requires at least: 6.0
|
Requires at least: 6.0
|
||||||
Requires PHP: 7.4
|
Requires PHP: 7.4
|
||||||
License: MIT
|
License: MIT
|
||||||
@@ -613,6 +613,7 @@ echo "done"
|
|||||||
.comment-item__time { font-size:11px; color:var(--ink-lighter); }
|
.comment-item__time { font-size:11px; color:var(--ink-lighter); }
|
||||||
.comment-item__text { font-size:14px; color:var(--ink-light); line-height:1.7; }
|
.comment-item__text { font-size:14px; color:var(--ink-light); line-height:1.7; }
|
||||||
.comment-item__reply { font-size:12px; }
|
.comment-item__reply { font-size:12px; }
|
||||||
.comment-item__reply a { color:var(--cinnabar); text-decoration:none; }
|
.comment-item__reply a, .comment-item__reply .reply-link { color:var(--cinnabar); text-decoration:none; }
|
||||||
|
.comment-item__reply .reply-link:hover, .comment-item__reply a:hover { text-decoration:underline; }
|
||||||
.comment-item--reply { margin-left:18px; padding:6px 0 6px 10px; border-bottom:1px dashed var(--border-light); border-left:1px dashed var(--border-light); }
|
.comment-item--reply { margin-left:18px; padding:6px 0 6px 10px; border-bottom:1px dashed var(--border-light); border-left:1px dashed var(--border-light); }
|
||||||
.comment-item--reply:last-child { border-bottom:none; }
|
.comment-item--reply:last-child { border-bottom:none; }
|
||||||
|
|||||||
Reference in New Issue
Block a user