这是本文档旧的修订版!
this.plugin.on("userinfo.output", "system", function() { this.$("#inpName").val(this.userinfo.username); this.$("#inpEmail").val(this.userinfo.mail); this.$("#inpHomePage").val(this.userinfo.homepage); }); this.plugin.on("userinfo.savefromhtml", "system", function() { this.userinfo.username = this.$("#inpName").val(); this.userinfo.mail = this.$("#inpEmail").val(); this.userinfo.homepage = this.$("#inpHomePage").val(); this.userinfo.save(); }); this.plugin.on("userinfo.save", "system", function() { this.cookie.set("name", this.userinfo.username); this.cookie.set("email", this.userinfo.mail); this.cookie.set("homepage", this.userinfo.homepage); }); this.plugin.on("comment.verifydata", "system", function(error, formData) { var regExList = { // [canBeEmpty, errorCode, RegExp] "name": [false, 72, /^[\.\_A-Za-z0-9\u4e00-\u9fa5]+$/ig], "email": [true, 29, /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/ig], "content": [false, 46, /./] }; for (var item in regExList) { var object = regExList[item]; if (((!object[0] && formData[item] === "")) || (!(object[2].test(formData[item])) && formData[item] !== '')) { error.code = object[1]; error.msg = this.options.lang.error[error.code]; return error; } } var objSubmit = $("#inpId").parent("form").find(":submit"); objSubmit.data("orig", objSubmit.val()).val("Waiting...").attr("disabled", "disabled").addClass("loading"); }); this.plugin.on("comment.posterror", "system", function(error, formData) { var objSubmit = $("#inpId").parent("form").find(":submit"); objSubmit.removeClass("loading").removeAttr("disabled"); if (objSubmit.data("orig")) { objSubmit.val(objSubmit.data("orig")); } }); this.plugin.on("comment.postsuccess", "system", function(formData, retString, textStatus, jqXhr) { var objSubmit = $("#inpId").parent("form").find(":submit"); objSubmit.removeClass("loading").removeAttr("disabled").val(objSubmit.data("orig")); var data = $.parseJSON(retString); if (data.err.code !== 0) { alert(data.err.msg); throw "ERROR - " + data.err.msg; } if (formData.replyid == "0") { this.$(data.data.html).insertAfter("#AjaxCommentBegin"); } else { this.$(data.data.html).insertAfter("#AjaxComment" + formData.replyid); } location.hash = "#" + data.data.ID; this.$("#txaArticle").val(""); this.userinfo.saveFromHtml(); }); this.plugin.on("comment.get", "system", function(postid, page) { var self = this; this.$.get(this.options.bloghost + "zb_system/cmd.php?act=getcmt&postid=" + postid + "&page=" + page, function(data, textStatus, jqXhr) { self.plugin.emit("comment.got", [postid, page], data, textStatus, jqXhr); }); }); this.plugin.on("comment.got", "system", function(formData, data, textStatus, jqXhr) { this.$('#AjaxCommentBegin').nextUntil('#AjaxCommentEnd').remove(); this.$('#AjaxCommentBegin').after(data); }); this.plugin.on("comment.reply", "system", function(id) { var me = this; this.$("#inpRevID").val(id); this.$("#cancel-reply").show().bind("click", function() { me.$("#inpRevID").val(0); me.$(this).hide(); window.location.hash = "#comment"; return false; }); window.location.hash = "#comment"; });