Essay-article Click like and don't like emoticons immediately will be +1

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.