?? core3.js
字號:
if(this._oOptions.iVisitorId!=0)_sUserName=this._oOptions.sVisitorNickname;else_sUserName="網易博友"+this._getLastIPPart(this._oOptions.sVisitorIP);var _oData={parentId:this._sParentId,editorId:this._sParentId,hostId:this._oOptions.iHostId,allowComment:this._oOptions.iAllowComment,needCheckLogin:this._oOptions.bNeedCheckLogin,needCheckRight:this._oOptions.bNeedCheckRight,disabled:this._bStatusNotLogin||this._bStatusNoRight,notLogin:this._bStatusNotLogin,noCommentRight:this._bStatusNoRight,canClose:this._oOptions.bCanClose,userName:_sUserName,hasCancelBtn:this._oOptions.bHasCancelBtn,containerObjName:this._oOptions.sObjName,fnOpenCommentEffect:this._oOptions.sLoginRedirect,visitorAvatar:this._oOptions.sVisitorAvatar,hostName:this._oOptions.sHostName,visitorRank:UD.visitorRank,visitorId:this._oOptions.iVisitorId,visitorName:this._oOptions.sVisitorName,visitorNickname:this._oOptions.sVisitorNickname,editorMaxLen:this._oOptions.iEditorMaxLen,defaultVisitorAvatarUrl:this._sDefaultVisitorAvatarUrl,visitorAvatarDefault:_bVisitorAvatarDefault,isHomeModule:this._oOptions.isHomeModule};var _sPubresult=jst_global_comment_pub.processUseCache(_oData);$(this._sCmPubElemId).innerHTML=_sPubresult;},_setHtmlEditor:function(bDisable){if(UD.visitorRank>=0){var _bFriend=false;if(UD.visitorRank>=Const.Rank.Friend)_bFriend=true;this.htmleditor=new NECtrl.AdvancedEditor(this._sParentId,"edt"+this._sParentId,{sEditorSrc:"/blank.html",iWidth:this._oOptions.iEditorWidth,iHeight:this._oOptions.iEditorHeight,iMaxLen:this._oOptions.iEditorMaxLen,bSimpleEditor:true,bFriend:_bFriend,sObjName:this._oOptions.sObjName+".htmleditor"});}else{this.htmleditor=new NetEase.PlainEditor(this._sParentId,"edt"+this._sParentId,{disabled:bDisable,width:this._oOptions.iEditorWidth,height:this._oOptions.iEditorHeight,maxlen:this._oOptions.iEditorMaxLen});if(!bDisable)this._showValidCodeImg(this._sParentId);}},_computePageNumber:function(){this._iTotalPageNumber=parseInt(this._iTotalCommentCount/this._oOptions.iPageSize)+((this._iTotalCommentCount%this._oOptions.iPageSize!=0)?1:0);},moveToPage:function(iPageIndex,noScroll){if(this._oOptions.fnMoreData!=null){if(iPageIndex<=0)alert("頁碼不能小于等于0");this._iCurrPageIndex=iPageIndex;this._oOptions.fnMoreData(this._sParentId,this._oOptions.iPageSize,(iPageIndex-1)*this._oOptions.iPageSize,this._postPageComment.bind(this));if(noScroll==true){new Effect.ScrollTo("comShowHeader_"+this._sParentId,{duration:0.0});}}},_postPageComment:function(oCommentArray){this._oCommentArray=oCommentArray;this._setCommentShowArea();},closeComments:function(sParentId){if(this._oOptions.fnCloseComments!=null){this._oOptions.fnCloseComments(sParentId);}if(this._oOptions.fnCloseCommentDiv!=null){this._oOptions.fnCloseCommentDiv(sParentId);}},_disablePubBtn:function(sParentId,bDisable){var _oPubbtn=$("$$_pubbtn"+sParentId);if(bDisable){_oPubbtn.disabled=true;this._disabledFun=_oPubbtn.onclick;_oPubbtn.onclick="";}else{if(this._disabledFun!=null)_oPubbtn.onclick=this._disabledFun;_oPubbtn.disabled=false;this._disabledFun=null;}},addComment:function(sParentId){this._disablePubBtn(sParentId,true);var _oUserName=$("username"+sParentId);var _sUsrname=Trim(_oUserName.value);if(_sUsrname==''){showInfo("$$_comsubmithint"+this._sParentId,"請輸入昵稱","info");this._disablePubBtn(sParentId,false);return false;}if(UD.visitorRank<=-100){var _sValCode=$("valcode"+sParentId);if(_sValCode==null){showInfo("$$_comsubmithint"+this._sParentId,"請輸入評論","info");this._disablePubBtn(sParentId,false);return false;}else{if($("valcode"+sParentId).value==""){showInfo("$$_comsubmithint"+this._sParentId,"請輸入驗證碼","info");this._disablePubBtn(sParentId,false);return false;}else if($("valcode"+sParentId).value.length!=4){showInfo("$$_comsubmithint"+this._sParentId,"驗證碼為4位","info");this._disablePubBtn(sParentId,false);return false;}}}var _sContent=this.htmleditor.getContent();if(isEmptyContent(_sContent)){showInfo("$$_comsubmithint"+this._sParentId,"請輸入評論","info");this._disablePubBtn(sParentId,false);return false;}if(this.htmleditor.IsExceedMaxLen()){showInfo("$$_comsubmithint"+this._sParentId,"輸入內容超過最大字數"+this._oOptions.iEditorMaxLen+",請重新編輯后提交","info");this._disablePubBtn(sParentId,false);return false;}if(this.sReplayData!=null){_sContent=this.sReplayData+_sContent;}var _oNewComment=new Object();_oNewComment.parentId=this._sParentId;_oNewComment.publisherId=this._oOptions.iVisitorId;_oNewComment.publisherName=this._oOptions.sVisitorName;_oNewComment.content=_sContent;_oNewComment.publishTime=new Date();_oNewComment.publisherNickname=_oUserName.value;_oNewComment.ip=this._oOptions.sVisitorIP;_oNewComment.publisherEmail="";_oNewComment.publisherUrl="";_oNewComment.publisherAvatarUrl=this._oOptions.sVisitorAvatar;if(this._oOptions.fnAddComment!=null){if(this._oOptions.oAddCommentParams!=null){this._oOptions.oAddCommentParams.valcodeid=sParentId;}this._oOptions.fnAddComment(_oNewComment,this._oOptions.oAddCommentParams,this._postAddComment.bind(this,sParentId));}else{this._disablePubBtn(sParentId,false);}},_postAddComment:function(sParentId,oNewComment){if(UD.visitorRank<0){if(oNewComment!=null){this.hideValidCodeImg(sParentId);}else{this._genValidCodeImg(sParentId,false);}}if(oNewComment==null){dwrlog('評論添加失敗','error');this._disablePubBtn(sParentId,false);return;}if(oNewComment.spam>0){alert("你在短時間內發布了過多的評論,評論受限。");dwrlog('評論添加失敗','error');this._disablePubBtn(sParentId,false);this.htmleditor.emptyContent();return;}this.htmleditor.emptyContent();this._iTotalCommentCount+=1;this._computePageNumber();if(this._iCurrPageIndex!=1){this.moveToPage(1,false);}else{var _oNewArray=[];_oNewArray.push(oNewComment);for(var i=0;i<this._oCommentArray.length;i++){_oNewArray.push(this._oCommentArray[i]);}while(_oNewArray.length>this._oOptions.iPageSize){_oNewArray.pop();}this._oCommentArray=_oNewArray;this._setCommentShowArea();}this.sReplayData=null;dwrlog('評論添加成功','ok');this._disablePubBtn(sParentId,false);if(this._oOptions.fnAfterAddComment!=null){this._oOptions.fnAfterAddComment(oNewComment,this._oOptions.oAfterAddCommentParams);}},deleteComment:function(sCommentId){if(this._oOptions.fnDelComment!=null){this._oOptions.fnDelComment(sCommentId,this._oOptions.oDelCommentParams,this._postDelComment.bind(this));}},_postDelComment:function(bSucc,sCommentId){if(!bSucc)return;this._iTotalCommentCount-=1;this._computePageNumber();if(this._iCurrPageIndex>1&&this._oCommentArray.length<=1)this._iCurrPageIndex--;this.moveToPage(this._iCurrPageIndex,false);dwrlog('評論刪除成功','ok');if(this._oOptions.fnAfterDelComment!=null){this._oOptions.fnAfterDelComment(this._oOptions.oAfterDelCommentParams);}},_initEditor:function(){if(!this._bStatusNoRight){if(UD.visitorRank>=0){var _oHtmlEditor=$("designEditor"+this._sParentId);if(_oHtmlEditor!=null){var _iWidth=$("designEditorDiv"+this._sParentId).offsetWidth;if(_iWidth>0){_oHtmlEditor.style.width=_iWidth+"px";}}}else{var _oPlainEditor=$("plainEditor"+this._sParentId);if(_oPlainEditor!=null){var _iWidth=$("plainDiv"+this._sParentId).offsetWidth;if(_iWidth>4){if(IEVer==6)_oPlainEditor.style.width=(_iWidth-2)+"px";else_oPlainEditor.style.width=(_iWidth-4)+"px";}}}}},switchDefaultName:function(oCheckbox,sInputId,sDisabledCss){if(oCheckbox.checked){appendCss(sInputId,sDisabledCss);disable(sInputId);if(this._oOptions.iVisitorId!=0)$(sInputId).value=this._oOptions.sVisitorNickname;else$(sInputId).value="網易博友"+this._getLastIPPart(this._oOptions.sVisitorIP);}else{removeLastCss(sInputId,sDisabledCss);enable(sInputId);}},_getLastIPPart:function(sIP){var _iIndex=sIP.lastIndexOf('.');if(_iIndex>0)return sIP.substr(_iIndex+1);elsereturn"";},switchCommentPub:function(sParentId){var comPubMain=$("comPubMain_"+sParentId);if(comPubMain.style.display=='none'){this._blindDownComments(comPubMain,this._initEditor.bind(this));}else{this._blindUpComments(comPubMain);}},_showValidCodeImg:function(sParentId){var _oPlaineditor=this.htmleditor.editor;if(_oPlaineditor!=null){if(isIE){_oPlaineditor.attachEvent("onfocus",function(){this._genValidCodeImg(sParentId,true);}.bind(this));}else{_oPlaineditor.addEventListener("focus",function(){this._genValidCodeImg(sParentId,true);}.bind(this),false);}}},_genValidCodeImg:function(sParentId,bForce){var _oCodeDiv=$("validCode"+sParentId);if(bForce){if(_oCodeDiv!=null&&_oCodeDiv.innerHTML==""){_oCodeDiv.innerHTML='<label for="txtVC">驗證碼: </label><input type="text" class="bd01 g_f_focus g_c_input" value="" maxlength="4" id="valcode'+sParentId+'" />'+'<img class="g_t_middle" style="margin-left:5px;" id="captchaimg${parentId}" alt="驗證碼" src="'+this._getCaptchaImgSrc(sParentId)+'" />';_oCodeDiv.style.display="block";}}else{if(_oCodeDiv!=null){_oCodeDiv.innerHTML='<label for="txtVC">驗證碼: </label><input type="text" class="bd01 g_f_focus g_c_input" value="" maxlength="4" id="valcode'+sParentId+'" />'+'<img class="g_t_middle" style="margin-left:5px;" id="captchaimg${parentId}" alt="驗證碼" src="'+this._getCaptchaImgSrc(sParentId)+'" />';_oCodeDiv.style.display="block";}}},hideValidCodeImg:function(sParentId){var _oCodeDiv=$("validCode"+sParentId);if(_oCodeDiv!=null&&_oCodeDiv.innerHTML!=""){_oCodeDiv.innerHTML="";_oCodeDiv.style.display="none";}},_getCaptchaImgSrc:function(sParentId){var _iRandom=Math.floor(Math.random()*10001);var _sId=(_iRandom+"_"+new Date().getTime()).toString();return"/cap/captcha.jpgx?parentId="+encodeURIComponent(sParentId)+"&"+_sId;},showPromptArea:function(sShowDiv,sMsg,vIsIP,ipValue){var _oPromptDiv=$(sShowDiv);var _sMessage;if("ip"==vIsIP){if(sMsg==null||sMsg==""||sMsg==undefined){if(ipValue==null||ipValue==""||ipValue==undefined)_sMessage="未知區域";else_sMessage=ipValue;}else{_sMessage=sMsg;}}else{_sMessage=sMsg;}_oPromptDiv.innerHTML=_sMessage;_oPromptDiv.style.display="block";},hiddenPromptArea:function(sShowDiv){var _oPromptDiv=$(sShowDiv);_oPromptDiv.style.display="none";},reply:function(sComId,bLogin,sName,vPara){var sContent=$("comContent"+sComId).innerHTML;var s=[];s.push('<blockquote class="selitm bd01">');if(bLogin){s.push('<span class="a_a c05" href="http://'+vPara+'/" target="_blank">'+sName+'</span><span class="c05 dot">:</span><br>');}else{s.push('<span class="c08">'+sName+'</span>');if(vPara!=null&&vPara!=""){vPara=Trim(vPara);s.push('<span class="c09">('+vPara+'):</span><br>');}else{s.push('<span class="c08 dot">:</span><br>');}}s.push('<span>'+sContent+'</span>');s.push('</blockquote>');this.sReplayData=s.join('');new Effect.ScrollTo(this._sCmPubElemId,{duration:0.0});this.htmleditor.focus();}}if(NetEase==undefined){var NetEase={};}NetEase.quickLoginTemplate=null;NetEase.indexLoginTemplate=null;var type163=0;var typePopo=1;var type126=2;var type188=3;var typeVip=4;var typeYeah=5;var ckLoginInfoKey="NEBLOG_LOGIN";var ckLoginInfo={type:null,name:null,pass:null};var ckPath="/";var ckDomain=DomainMap.cookieDomain;var errInfo=["用戶名或密碼不正確,請重新輸入","該網易博客用戶名不存在","超時退出或無權限訪問,請重新登錄"];NetEase.QuickLogin=Class.create();NetEase.QuickLogin.prototype={initialize:function(presentShowId,serverName,bFromIndex){this.options=Object.extend({err:false,jsWindowManager:null,loginTarget:null},arguments[3]||{});this.presentShowId=presentShowId;this.serverName=serverName;this.bFromIndex=bFromIndex;this.err=false;this.jsWindowManager=this.options.jsWindowManager;this.objUsername;this.objPassword;this.objSetCkCheck;this.frmLogin;this.divNotice;this.btn_login;this.btn_reg;this.curUserType=0;this.noticeInit="請輸入用戶名和密碼登錄";this.noticeAccount="請輸入網易通行證用戶名";this.noticePassword="請完整填寫登錄信息,密碼不能為空";this.isPwdFromCk=false;this.pwdFromCk;this.pwdFromCkTrim;this.strUsername;this.strPassword;this.qLoginZone=null;this.loginTarget=this.options.loginTarget;this._load();},_load:function(){getLoginCookie();this.curUserType=ckLoginInfo.type;if(this.curUserType==null){this.curUserType=type163;}else{this.curUserType=parseInt(this.curUserType);}if(!this.bFromIndex||this.presentShowId=="qIndexLoginDiv"){if(NetEase.quickLoginTemplate==null)NetEase.quickLoginTemplate=quicklogin_jst;var data={err:false};var result=NetEase.quickLoginTemplate;if(this.presentShowId){this.qLoginZone=this.jsWindowManager.createWindow(this.presentShowId,{
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -