JS Object
CMS.UPF = function (base, Feelingcountid, Origvalue, Upid, type) {
var UpDown = $.cookie ("_cms_up_" + Feelingcountid);
if (UpDown) {//The current cookie exists, it has been published, does not exist and is not published
Alert ("-_-!, you have published Oh ~ ~");
return false;
}
$.cookie ("_cms_up_" + Feelingcountid, "1");
$.get (base + "/feelingcount_up.jspx", {//Database +1
"Feelingcountid": Feelingcountid,
' Type ': type
}, function (data) {
var = origvalue + 1;
var top = 70-high;
$ ("#moodc" + upid). HTML (high);
if (high<70) {
$ ("#moodh" + upid). CSS ("height", high);
$ ("#moodh" + upid). CSS ("Margin-top", top);
}else{
$ ("#moodh" + upid). CSS ("height", high);
$ ("#moodh" + upid). CSS ("Margin-top", 10);
}
});
return true;
};
Page load Find library, happy number of current article
$.ajax ({
Type: "Post",
URL: "${base}/feelingcount_list.jspx",
Data: "Id=${content.id}",
DataType: "Text",
ContentType: "application/x-www-form-urlencoded; Charset=utf-8 ",
Success:function (JSON) {
JSON = decodeURI (JSON); JS decoding
JSON = eval ("(" +json+ ")"); Convert to JSON object
$ (JSON). Each (function (index) {
var val = Json[index];
if (val.dic_id = = 16) {//Click the number of hits in the current article +1; if the number of clicks in the library is added successfully, then +1
$ (". Like_unlike"). Append ("<a onclick=\" CMS.UPF (' ${base} ', "
+val.content_id+ "," +val.click_count+ "," +val.id+ "," +val.dic_id+ "); \" Class=\ "like\" ><span> like <em id=\ " Moodc "+val.id+" \ ">"
+val.click_count+ "</em></span></a>"
);
}else if (val.dic_id = = 17) {
$ (". Like_unlike"). Append ("<a onclick=\" CMS.UPF (' ${base} ', "
+val.content_id+ "," +val.click_count+ "," +val.id+ "," +val.dic_id+ "); \" Class=\ "unlike\" ><span> don't like <em ID =\ "moodc" +val.id+ "\" > "
+val.click_count+ "</em></span></a>"
);
}
});
},
Error:function (JSON) {
}
});
Html
<!--mood State--
<div class= "Like_unlike" >
<div class= "CLR" ></div>
</div>
Essay-article Click like and don't like emoticons immediately will be +1