writer.js
1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
var $ = require("jquery");
require("../plugin/comment");
require("../plugin/login");
exports.init = function() {
var cidNum = $(".editor-comment-content").attr("cid");
$(".comment_button").on("click", function() {
if ($(".comment-area").find(".comment-textarea").size() > 0) {
if ($(".editor-comment-content").css("display") == "none") {
$(".editor-comment-content").show();
} else {
$(".editor-comment-content").hide();
}
} else {
$(".comment-area").comment({
cid: cidNum,
thirdLogin: true,
isEdit: true
});
$(".editor-comment-content").show();
}
});
exports.updateLogin = function() {
$(".comment-area").login("updateLoginState");
$(".comment-area").comment("publishComment");
}
var id = {
id: cidNum
};
$.ajax({
type: 'GET',
url: YohoConfig.mainUrl + '/writer/default/comment',
data: id,
dataType: 'json',
success: function(response) {
var data = response.data;
if (data.total) {
$(".comment-num").text(data.total);
}
}
})
}