diff options
| author | ohmyga <40896676+ohmyga233@users.noreply.github.com> | 2020-02-26 23:23:01 +0800 |
|---|---|---|
| committer | ohmyga <40896676+ohmyga233@users.noreply.github.com> | 2020-02-26 23:23:01 +0800 |
| commit | c08f72691da5f1af30c699e44536b7367a98ce1a (patch) | |
| tree | cba5b664a3eb03bf6cd5bb2a26d9355b0f2cb75b /includes | |
| parent | 0b979b03e426ba5d9646a5c83c8967c74011cc38 (diff) | |
👍 使评论支持 AJAX 提交
Diffstat (limited to 'includes')
| -rw-r--r-- | includes/comments.php | 8 | ||||
| -rw-r--r-- | includes/footer.php | 1 | ||||
| -rw-r--r-- | includes/head.php | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/includes/comments.php b/includes/comments.php index cc53bc1..5bed2d5 100644 --- a/includes/comments.php +++ b/includes/comments.php @@ -9,7 +9,7 @@ }
$commentLevelClass = $comments->_levels > 0 ? ' comment-child' : ' comment-parent'; //评论层数大于0为子级,否则是父级
?>
-<div id="li-<?php $comments->theId(); ?>" class="comment-body<?php
+<div id="<?php $comments->theId(); ?>" class="comment-body<?php
if ($comments->_levels > 0) {
echo ' comment-child';
$comments->levelsAlt(' comment-level-odd', ' comment-level-even');
@@ -49,7 +49,7 @@ echo $commentClass; <?php if($this->fields->commentShow == 0)://如果显示评论列表 ?>
<?php if ($comments->have())://如果有评论 则显示 ?>
<div class="comment-container">
- <h3 class="comment-title" id="response"><?php $this->commentsNum(_t('暂无评论'), _t('仅有一条评论'), _t('已有 %d 条评论')); ?></h3>
+ <h3 class="comment-title" id="response"><?php $this->commentsNum(_t('暂无评论'), _t('已有 1 条评论'), _t('已有 %d 条评论')); ?></h3>
<?php $comments->listComments(array(
'before' => '<div class="comment-list">',
'after' => '</div>',
@@ -69,7 +69,7 @@ echo $commentClass; <div class="comment-form">
<!-- 判断设置是否允许对当前文章进行评论 -->
<?php if($this->allow('comment')): ?>
- <div id="<?php $this->respondId(); ?>" class="respond">
+ <div id="<?php $this->respondId(); ?>" class="respond comment-box-id" data-commentUrl="<?php $this->commentUrl() ?>">
<div class="cancel-comment-reply">
<?php $comments->cancelReply(); ?>
</div>
@@ -95,7 +95,7 @@ echo $commentClass; </p>
<p class="comment-submit-box">
<div title="OwO" class="OwO"></div>
- <button type="submit" class="comment-submit submit"><?php _e('评论'); ?></button>
+ <button type="submit" onclick="return MiraclesComment.submitComment();" class="comment-submit submit"><?php _e('评论'); ?></button>
</p>
</form>
</div>
diff --git a/includes/footer.php b/includes/footer.php index 6157c8b..265585c 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -33,6 +33,7 @@ beforePjax = function() {NProgress.start();}; afterPjax = function() {owoLoad();<?php $this->options->pjax_complete(); ?>};<?php endif; ?></script> <!-- Script that must be after--> + <script src="<?php Utils::indexTheme('assets/js/comment.ajax.js'); ?>"></script> <script src="<?php Utils::indexTheme('assets/js/miracles.min.js'); ?>"></script> <!-- BuildTime --> <script> diff --git a/includes/head.php b/includes/head.php index 1876285..84738cd 100644 --- a/includes/head.php +++ b/includes/head.php @@ -37,7 +37,7 @@ <meta name="twitter:card" content="summary" /> <meta name="twitter:image" content<?php echo $banner; ?>" /> <link rel="icon" type="image/png" href="<?php Utils::indexTheme('favicon.ico'); ?>" /> - <?php $this->header('description=&'); ?> + <?php $this->header('description=&commentReply='); ?> <?php $this->options->headerEcho(); ?> <!-- css --> <?php |
