67 lines
1.4 KiB
JavaScript
Executable File
67 lines
1.4 KiB
JavaScript
Executable File
|
|
$(document).ready(function() {
|
|
|
|
// 复制
|
|
var clipboard = new ClipboardJS('.copy-permalink');
|
|
clipboard.on('success', function(e) {
|
|
ncPopupTips(!0, '复制成功');
|
|
e.clearSelection();
|
|
});
|
|
clipboard.on('error', function(e) {
|
|
ncPopupTips(1, '复制失败');
|
|
});
|
|
|
|
// 基本变量
|
|
$id = $("#article_id").val();
|
|
|
|
// 修复加载
|
|
$(".widget_nice_tag_cloud").load("/widget/toptags.html");
|
|
|
|
// 获取点赞数
|
|
$.ajax({
|
|
url: '/helper/like/get/'+$id,
|
|
type: 'GET',
|
|
data: {},
|
|
success: function(response) {
|
|
|
|
$(".like-count").html(response)
|
|
|
|
}
|
|
})
|
|
|
|
// 获取过去时间
|
|
$.ajax({
|
|
url: '/helper/timelost/'+$("#createdAt").val(),
|
|
type: 'GET',
|
|
data: {},
|
|
success: function(response) {
|
|
|
|
$("#timeLost").html(response)
|
|
|
|
},
|
|
error: function(xhr, status, error) {
|
|
|
|
}
|
|
})
|
|
|
|
// 点赞动作
|
|
$("[data-action='like']").click(function(){
|
|
|
|
$.ajax({
|
|
url: '/helper/like/up/'+$id,
|
|
type: 'GET',
|
|
data: {},
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
if (response.iCode == 1) {
|
|
$(".like-count").html(response.iLikeNow)
|
|
}
|
|
}
|
|
})
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|