Typecho下实现一键评论打卡功能

2021-10-05T14:06:01.png

[scode type="yellow"]Handsome主题为例[/scode]
1、[scode type="share"]首先在后台-->设置外观-->开发者设置-->自定义JavaScript加入以下代码:[/scode]

Java
function addNumber(a) {
    var length = document.getElementById("comment").value.length;
    if(length> 0){
        document.getElementById("comment").focus()
        document.getElementById("comment").value += '\n' + a + new Date
    }else{
        document.getElementById("comment").focus()
        document.getElementById("comment").value += a + new Date
    }
}

2、[scode type="yellow"]打开主题目录的component/comments.php里面的136行 后面添加:[/scode]
2021-10-05T14:11:12.png

<?php $this->remember('text'); ?></textarea>

后面添加

<div class="OwO" style="display: inline;"></div><div class="OwO" style="display: inline;"><a href="javascript:addNumber('滴!访客卡!请上车的乘客系好安全带,现在是:')" class="OwO-logo"><i class="fontello fontello-user face"></i><span class="OwOlogotext">打卡</span></a></div>

3、[scode type="yellow"]在后台-->设置外观-->开发者设置-->自定义CSS加入以下代码:[/scode]

.secret_comment {
    top: 5px;
}
.OwO.OwO-open .OwO-body {
    display:table
}
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享