点击广告查看隐藏内容....
0.成品图
1.修改comment.php文件,添加如下代码,文件路径:usr/themes/Joe-master/public
第一段,新增在顶部
第二段,新增在中间位置
<form style="display: none;" id="comment_form_operation" action="" method="post"></form>
<span class="reply comment_operation" style="margin-left: 5px;">
<svg t="1626580891087" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2242" width="15" height="15"><path d="M512 64c247.424 0 448 200.576 448 448S759.424 960 512 960 64 759.424 64 512 264.576 64 512 64z m0 64c-212.077 0-384 171.923-384 384s171.923 384 384 384 384-171.923 384-384-171.923-384-384-384z m201.827 182.173c12.372 12.371 12.496 32.353 0.372 44.877l-0.372 0.377L557.255 512l156.572 156.573c12.497 12.496 12.497 32.758 0 45.254-12.371 12.372-32.353 12.496-44.877 0.372l-0.377-0.372L512 557.255 355.427 713.827c-12.496 12.497-32.758 12.497-45.254 0-12.372-12.371-12.496-32.353-0.372-44.877l0.372-0.377L466.745 512 310.173 355.427c-12.497-12.496-12.497-32.758 0-45.254 12.248-12.249 31.954-12.492 44.5-0.732l0.377 0.36 0.377 0.372L512 466.745l156.573-156.572c12.496-12.497 32.758-12.497 45.254 0z" p-id="2243"></path></svg>
<span class="comment_btn_operation" data-type="delete" data-coid="<?php $comments->coid(); ?>">删除</span>
</span>
<span class="reply comment_operation" style="margin-left: 5px;">
<svg t="1626531257182" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7832" width="15" height="15"><path d="M781.28 851.36a58.56 58.56 0 0 1-58.56 58.56H301.28a58.72 58.72 0 0 1-58.56-58.56V230.4h538.56z m-421.6-725.92a11.84 11.84 0 0 1 12-12h281.28a11.84 11.84 0 0 1 12 12V160H359.68zM956.8 160H734.72v-34.56a81.76 81.76 0 0 0-81.76-81.76H371.68a82.08 82.08 0 0 0-81.76 81.76V160H67.2a35.36 35.36 0 0 0 0 70.56h105.12v620.8a128.96 128.96 0 0 0 128.96 128.96h421.44a128.96 128.96 0 0 0 128.96-128.96V230.4H956.8a35.2 35.2 0 0 0 35.2-35.2 34.56 34.56 0 0 0-35.2-35.2zM512 804.16a35.2 35.2 0 0 0 35.2-35.36V393.92a35.2 35.2 0 1 0-70.4 0V768.8a35.2 35.2 0 0 0 35.2 35.36m-164.32 0a35.36 35.36 0 0 0 35.36-35.36V393.92a35.36 35.36 0 1 0-70.56 0V768.8a36.32 36.32 0 0 0 35.2 35.36m328.64 0a35.36 35.36 0 0 0 35.2-35.36V393.92a35.36 35.36 0 1 0-70.56 0V768.8a35.36 35.36 0 0 0 35.36 35.36" p-id="7833"></path></svg>
<span class="comment_btn_operation" data-type="spam" data-coid="<?php $comments->coid(); ?>">垃圾</span>
</span>
{/tabs-pane}
{tabs-pane label="代码位置截图"}
{/tabs-pane}
第三段,新增在底部
<script>
document.addEventListener('DOMContentLoaded', () => {
var groupInfo = '<?php echo $groupUserInfo ?>';
if(groupInfo != 'administrator') {
$(".comment_operation").css("display", "none");
}
var comments4Reception = '<?php $this->options->Comments4Reception() ?>';
if(!comments4Reception || comments4Reception == 'off') {
$(".comment_operation").css("display", "none");
}
});
// 前台编辑评论
$('.comment_btn_operation').click(function() {
var type = $(this).data('type');
var coid = $(this).data('coid');
$('#comment_form_operation').append('<input type="hidden" name="type" value="' + type + '" />');
$('#comment_form_operation').append('<input type="hidden" name="coid" value="' + coid + '" />');
$('#comment_form_operation').submit();
});
</script>
{/tabs-pane}
{tabs-pane label="代码位置截图"}
{/tabs-pane}
2.修改usr/themes/Joe-master/public/custom.php文件,如果没有则修改usr/themes/Joe-master/functions.php
// 前台审核评论
$Comments4Reception = new Typecho_Widget_Helper_Form_Element_Select(
'Comments4Reception',
array('off' => '关闭(默认)', 'on' => '开启'),
'off',
'是否开启前台评论审核功能',
'介绍:开启后,文章底部评论区域显示删除和垃圾按钮,可以对该条评论做删除等操作'
);
$Comments4Reception->setAttribute('class', 'joe_content joe_custom'); // 如果后台不发显示设置,则将joe_custom替换为 joe_other
$form->addInput($Comments4Reception);
{/tabs-pane}
{tabs-pane label="代码位置截图"}
{/tabs-pane}
全量文件下载地址:
本文共 196 个字数,平均阅读时长 ≈ 1分钟
点击广告查看隐藏内容....
看看
厉害了。可以可以
666前来膜拜大佬