var numobj = "", origText = '请输入您的评论',voteaumurl = '//duote.runjiapp.com/newscomment/Voteup?pc=0'; var newsComment = { isvote : [], param : {}, istimeout : [], timer : [], init : function(){ _self = this; $("input[name='c.cmtbtn']").bind('click',function(e){ _self.valid(); }); }, timeout : function(key,t,times){ var _self = this; if(times == 'undefined'|| !times) times = 1; if (t){ this.istimeout[key] = false; clearTimeout(this.timer[key]); common.cookie(key,'',-2); } else { this.istimeout[key] = true common.cookie(key,new Date().getTime(), 0.02) this.timer[key] = setTimeout(function(){ _self.timeout(key,1)},times*1000*60) } }, valid : function(t){ if (this.istimeout['myposttime_'+CURRENT_SOFTID] || common.cookie('myposttime_'+CURRENT_SOFTID)!='' && common.cookie('myposttime_'+CURRENT_SOFTID)!='undefined' ){ common.afteranimate({elem:$('div.commentsub'),html:'请您休息一分钟再发表评论!',massage:'error',after:'append'}); return false; } var content = $.trim($("#J-commTextarea").val()),len = content.length; if (!common.isUndefined(origText)){ if (content == origText){ common.afteranimate({elem:$('div.commentsub'),html:'评论内容长度为5~500个字!',massage:'error',after:'append'}); return false; } } if (/^([0-9 \r\n]+)$/.test(content)){ common.afteranimate({elem:$('div.commentsub'),html:'一连串数字是什么意思呢,还是说点实在的吧!',massage:'error',after:'append'}); return false; } if (len<5 || len>500){ common.afteranimate({elem:$('div.commentsub'),html:'评论内容长度为5~500个字!',massage:'error',after:'append'}); return false; } var $form = $('#J-commTextarea').parents('form'); if ($form.find("input[name='c.cmtbtn']").hasClass('pubing')) return false; $form.find("input[name='c.cmtbtn']").text('发布中..').addClass('pubing'); $.ajax({ type: 'post', dataType: 'text', url: $form.attr('action')+'&zxId='+CURRENT_SOFTID, data: $form.serialize(), success: function(data) { $form.find("input[name='c.cmtbtn']").text('评论').removeClass('pubing'); data = common.getjson(data); if (data.code ==0 ) { _self.timeout('myposttime_'+CURRENT_SOFTID); common.afteranimate({elem:$('div.commentsub'),html:'您的评论已提交,待小编审核后显示 - -',massage:'success',after:'append'}); $("#J-commTextarea").val(''); } else { if (data.code) { alert(data.msg); } } } }); return true; } };