/**评论组件***start********************************************************/ ;(function(){$.ns("DFZ.UNION");DFZ.UNION.CMNT_=new function(){var strLen=function(str){var l=escape(str),len;len=l.length-(l.length-l.replace(/\%u/g,"u").length)*4;l=l.replace(/\%u/g,"uu");len=len-(l.length-l.replace(/\%/g,"").length)*2;return len};var parse_str=function(str){if(str==undefined){return""}else{return str}};var _createCMNT=function(newsID){var html='

网友评论

发 表 |退出同步到我的微博 |注册

';return html};var postToWeibo=function(wbMsg){var nt=$.trim(wbMsg.title);var nl=location.href.replace(/\.html.*$/,'.html');var wc='我评论了新闻【'+nt+'】:'+wbMsg.content;wc=wc.substr(0,(279-nl.length)/2)+' '+nl;$.ajax({type:"get",dataType:"jsonp",url:"http:\/\/mblogv2.city.sina.com.cn/interface/tcommonv2/cookie_auth/postaction/get_token.php",data:{t:'jsonp',app_id:wbMsg.app_id,site_id:900},success:function(data){if(!(data&&data.error=="0")){alert(data.errmsg);return}$.ajax({type:"get",data:{content:wc,app_id:wbMsg.app_id,site_id:900,token:data.token},dataType:"jsonp",url:"http:\/\/mblogv2.city.sina.com.cn/interface/tcommonv2/cookie_auth/postaction/json_add_mblog.php"})}})};var setNewsList=function(channel,newsid){if(!channel||!newsid)return'';if(newsid.match(/comos-/)||newsid.match(/\d+-\d+-\d+/)){newsid=newsid+':0'}else{newsid=newsid+':1'}return channel+':'+newsid};this.Init=function(params){this.Info=$.extend({container:".discuss-form",channel:"sic",newsid:"841-422-221609",baseJS:"http:\/\/comment.sinajs.cn/cmnt_bbs_v5.js",V5_HOST:"http:\/\/comment5.news.sina.com.cn",CMNTPOST_WSGI:"/cmnt/submit",postCharset:"gb2312"},params,{});var info=sinaSSOController.getSinaCookie();this.Info.user=false;if(info&&info.nick){this.Info.user=info.nick};$(this.Info.container).html(_createCMNT(this.Info.newsid));if(!this.Info.user){$('textarea,.submit_comment',this.Info.container).bind('click',function(){DFZ.APP.DialogLogin.open()});return};var _this=this;$('textarea',this.Info.container).bind('click',function(){$('.info',_this.Info.container).hide()});$(".submit_comment",_this.Info.container).live('click',function(){var content=$('textarea',_this.Info.container).val();var is2mb=$('input[name=wb]:checked',_this.Info.container).size();var param={channel:_this.Info.channel,newsid:_this.Info.newsid,user:_this.Info.user,content:content,url:location.href,format:'js',charset:'',is2mb:is2mb};_this._SUBMIT(param)})};this._POST=function(param){if(!this.Info.user){DFZ.APP.DialogLogin.open();return};param.channel=$.trim(param.channel);param.newsid=$.trim(param.newsid);param.content=$.trim(param.content);if(param.channel==""||param.newsid==""){return false};if(param.content==''){alert("评论不能为空!");return};if(strLen(param.content)>6000){if(!confirm("帖子最多可以输入3000个汉字,您输入的内容超长。您可以点击\"取消\"按钮,删减部分内容后再重新提交。或者点击\"确定\"按钮,只发表前3000汉字的内容。"));return false};if(!document.getElementById('cmnt_post_span')){var cmnt_post_span=document.createElement("span");cmnt_post_span.setAttribute("id","cmnt_post_span");cmnt_post_span.setAttribute("style","display:none");document.body.insertBefore(cmnt_post_span,null)};var cmnt_host=parse_str(this.Info.V5_HOST);var wsgi=parse_str(this.Info.CMNTPOST_WSGI);var charset=parse_str(this.Info.postCharset)?" accept-charset='"+this.Info.postCharset+"'":"";document.getElementById('cmnt_post_span').innerHTML="
";document.cmnt_post_form.channel.value=param.channel;document.cmnt_post_form.newsid.value=param.newsid;document.cmnt_post_form.content.value=param.content;document.cmnt_post_form.user.value=parse_str(param.user);document.cmnt_post_form.url.value=parse_str(param.url);document.cmnt_post_form.format.value=parse_str(param.format);document.cmnt_post_form.charset.value=parse_str(param.charset);document.cmnt_post_form.submit();return true};this._SUBMIT=function(param){if(this._POST(param)){$('textarea',this.Info.container).val('').blur();$('.info',this.Info.container).show()};if(param.is2mb){postToWeibo({title:$('h1:first').text(),content:param.content,app_id:DFZ.CFG.appid})}};this.getCount=function(option,callback){var op=$.extend({channel:'fsh',newsId:['comos-anfzhnx8364005']},option||{});var newslist;if(typeof op.newsId=='string'){newslist=op.newsId}else{newslist=[];$(op.newsId).each(function(i,val){var item_=setNewsList(op.channel,val);item_&&newslist.push(item_)});newslist=newslist.join()};var ajax_sets={};ajax_sets.url="http:\/\/comment5.news.sina.com.cn/cmnt/count?format=js&newslist="+newslist;ajax_sets.dataType="script";ajax_sets.data={};ajax_sets.success=function(){var _data=data.result;if(_data.status.code!=0)return;callback&&callback(_data.count)};$.ajax(ajax_sets)}}})(); /**评论组件***End********************************************************/