Like 赞
对喜欢的内容点赞。/ Like good content.
1.每篇文章只能点赞一次;
2.不能给自己的文章点赞;
3.限制了重复点赞再取消、再点赞行为;
4.文章作者获得总的赞数量;
2021.01.02
替换图标;
read.htm 页面使用钩子
钩子【1】 read_plugin_body.htm
自制模板添加
<span class="text-center mx-1">
<!-- id="thread-like" tid="<?php echo $thread['tid'];?>" 必须保留 -->
<a id="thread-like" class="h5" rel="nofollow" tid="<?php echo $thread['tid'];?>" href="javascript:void(0);">
<!-- <i class="icon-thumbs-o-up"></i> 未点赞可换成自己的图片 -->
<i class="icon-thumbs-o-up"></i>
</a>
<!-- id="thread-likes" 必须保留 -->
<span id="thread-likes" class="ml-1 small">
<?php echo $thread['well_likes'];?>
</span>
</span>
钩子【2】read_js.htm
自制模板添加
<script>
var uid = '<?php echo $uid;?>';
var tid = '<?php echo $tid;?>';
/* <i class="icon-thumbs"></i> 已点赞可换成自己的图片 */
var liked = '<i class="icon-thumbs-up"></i>';
/* <i class="icon-thumbs-o"></i> 未点赞可换成自己的图片 */
var unliked = '<i class="icon-thumbs-o-up"></i>';
if (uid) {
$.xpost(xn.url('my-like'), {'type': 2, 'tid':tid}, function (code, data) {
if (0 == code) $('#thread-like').html(liked);
});
}
var body = $('body');
body.on('click', 'a#thread-like', function () {
if (uid) {
var tid = $(this).attr('tid');
$.xpost(xn.url('my-like'), {'type': 0, 'tid': tid}, function (code, message) {
var threadlikes = $('#thread-likes');
var likes = xn.intval(threadlikes.html());
if (0 == code) {
$('#thread-like').html(liked);
threadlikes.html(likes 1);
} else if (1 == code) {
$('#thread-like').html(unliked);
threadlikes.html(likes - 1);
} else {
$.alert(message);
}
});
} else {
$.ajax_modal(xn.url('user-login'), 'Login', 'md');
}
return false;
});
</script>
user.htm 页面使用钩子 user_common_count_register_before.htm
自行制作模板添加代码
<span class="mx-1">
<span class="mr-1">
<?php echo lang('well_like_get');?>
</span>
<!-- 得到赞 -->
<?php echo $_user['well_get_likes'];?>
</span>
常见问题FAQ
- 免费下载或者VIP会员专享资源能否直接商用?
- 提示下载完但解压或打开不了?
- 找不到素材资源介绍文章里的示例图片??
- 钛宇宙
邮箱:loblog@126.com