-1)
commentHtml.gotoView();
else
commentHtml.container.scrollIntoView();
}
}
else
{
loginMode = false;
if(replay)
{
var commentBlogDiv=$("commentBlogDiv");
var commentText=$("commentContentText0");
if(commentText)
{
commentBlogDiv.scrollIntoView();
commentText.focus();
}
}
}
}
//鑭誨綍鐢ㄦ垌鍔犺澆html緙栬總鍣?
function loadCommentHtml()
{
var replay = ( document.location.hash.toLowerCase() == "#comment" );
var loginedUserText = $( "loginedUserText0" );
if( loginedUserText )
{
initializeCommentEditor();
}
}
var initializeCommentEditorTimeout = 500;
var initializeCommentEditorTimeoutCount = 0;
var initializeCommentEditorTimeoutMaxCount = 5;
var initializeCommentEditorTimeoutId = null;
function initializeCommentEditor() {
if ( initializeCommentEditorTimeoutId ) {
window.clearTimeout( initializeCommentEditorTimeoutId );
}
if ( typeof MTimeEditor != "undefined" ) {
var replay = ( document.location.hash.toLowerCase() == "#comment" );
var loginedUserText = $( "loginedUserText0" );
if( loginedUserText ) {
commentHtml = new MTimeEditor( {
instanceId: "loginedUserText",
container: loginedUserText,
type: 2,
height:150,
area:1,
unFocus: ( replay ? false : true )
} );
}
} else {
if ( initializeCommentEditorTimeoutCount < initializeCommentEditorTimeoutMaxCount ) {
initializeCommentEditorTimeoutCount++;
initializeCommentEditorTimeoutId = window.setTimeout( initializeCommentEditor, initializeCommentEditorTimeout );
}
}
}
function replayBlog()
{
if(loginMode)
commentHtml.gotoView();
else
{
var commentBlogDiv=$("commentBlogDiv");
var commentText=$("commentContentText0");
if(commentText)
{
commentBlogDiv.scrollIntoView();
commentText.focus();
}
}
}
//鑭誨綍鐢ㄦ垌鎖愪氦鍥炱
function submitCommentOfBlog( buttonId, parentId )
{
//鑾峰彇button鐨凞OM鍏冪礌
this.buttonElement = $( buttonId );
//淇濆瓨button鐨勫煎拰鐫夐挳濱嬩歡
this.buttonValue = this.buttonElement.value;
this.buttonClickHandler = this.buttonElement.onclick;
this.buttonClassName = this.buttonElement.className;
var loginedUserTextDiv=$("loginedUserText"+parentId);
var loginedUserText;
if(loginedUserTextDiv)
{
//鑾峰彇鍥炱鍐喋
if(parentId==0)
{
loginedUserText=commentHtml.getValue();
}
else if(parentId>0)
{
loginedUserText=loginedUserTextDiv.value;
}
if(( parentId==0 && !commentHtml.isEmpty()) || (parentId>0 && loginedUserText.Trim().length>0 )) //commentHtml.isEmpty() 鍒柇緙栬總鍣ㄦ槸鍚︿負絀?
{
var content=loginedUserText;
if(parentId==0)
{
content=loginedUserText.stripTags().Trim(); //緙栬總鍣ㄥ唴瀹瑰幓鎺倨爣絳懼垽鏂瓧鎖?
}
//鍥炱鏈澶?000涓瓧絎?2000涓眽瀛?
if(content.bytelength()>commentBodySize)
{
showMessageBox("TooLongBodyMessageBox","鍥炱鍐喋鏈澶氫負2000涓眽瀛楋紒","");
}
else if(content.bytelength()==0)
{
showMessageBox("TooLongBodyMessageBox","鍥炱鍐喋榪呸護鍚庝負絀猴紝璇烽噸鏂拌緭鍏紒","");
}
else
{
var opinionId=-1; //璇蹺環Id
//鍥炱鏈夎瘎浠鳳紝鍥炱簲娌℃湁璇蹺環
if(parentId==0 && userId.value!=bloggerId.value)
{
opinionId=Utility.Dom.getSelectedValues( "opinionRadio", 1 );
}
//璁劇疆button鐨勤柊鍊?
this.buttonElement.value = "鎖愪氦涓?;
this.buttonElement.className = "false";
this.buttonElement.disabled = true;
ShowBlog.CreateLoginedUserComment(parentId,loginedUserText,opinionId,onSubmitCommentOfBlogCallback.bind( this ));
}
}
else
{
showMessageBox("NullLoginedUserMessageBox","鍥炱鍐喋涓嶈始涓虹└錛?,"");
}
}
}
function onSubmitCommentOfBlogCallback(returnObj)
{
//鎮一鍘烞utton鐨勫煎拰濱嬩歡
this.buttonElement.onclick = this.buttonClickHandler;
this.buttonElement.value = this.buttonValue;
this.buttonElement.className = this.buttonClassName;
this.buttonElement.disabled = false;
if(returnObj)
{
if(returnObj.value.length>0)
{
window.location.href=returnObj.value;
}
else
{
//鑾峰彇鑭誨綍鎖愮淇℃伅
ShowBlog.GetLoginTip (onGetLoginTipCallback );
}
}
}
//鍖垮悕鐢ㄦ垌鎖愪氦鍥炱
function submitNotLoginedComment(parentId)
{
pId=parentId;
var err= new StringBuilder();
var nickname=$F("nicknameText"+parentId);
if(nickname.Trim().length==0)
{
err.append("鏄電涓嶈始涓虹└
");
}
var authorUrl=$F("authorUrlText"+parentId);
var commentContent=$F("commentContentText"+parentId);
if(commentContent.Trim().length==0)
{
err.append("鍥炱鍐喋涓嶈始涓虹└
");
}
var vcode=$F("codeText"+parentId);
if(vcode.Trim().length==0)
{
err.append("楠屻瘉鐮佷笉鑳戒負絀?);
}
var errTip=err.toString();
if(errTip.length==0)
{
//鍥炱鍐喋鏈澶氫負4000涓瓧絎︼紝2000涓眽瀛?
if(commentContent.bytelength()>commentBodySize)
{
showMessageBox("TooLongBodyMessageBox","鍥炱鍐喋鏈澶氫負2000涓眽瀛楋紒","");
}
else
{
if(isOverdue.value)
{
//ShowBlog.CreateNotLoginedUserComment(nickname,authorUrl,commentContent,vcode,parentId,onSubmitNotLoginedCommentCallback);
ShowBlog.CreateNotLoginedUserComment(nickname,authorUrl,commentContent,vcode,$F("__vc"),parentId,onSubmitNotLoginedCommentCallback);
}
else
{
showMessageBox("spanTimeMessageBox","璇烽輗闅?5縐掑啀鎖愪氦","");
}
}
}
else
{
showMessageBox("spanTimeMessageBox","璇峰~鍐欏洖澶嶄俊鎮?,errTip);
}
}
function onSubmitNotLoginedCommentCallback(returnObj)
{
if(returnObj)
{
eval(returnObj.value);
}
}
//鍒鋒柊楠屻瘉鐮?
function refreshVode(parentId)
{
pId=parentId;
ShowBlog.RefreshVcode (onChangeVodeCallback);
}
function onChangeVodeCallback(returnObj)
{
var anonymityCommentVcodeImg = $("AnonymityCommentVcodeImg"+pId);
if ( anonymityCommentVcodeImg && returnObj ) {
var items = returnObj.value.split("|");
anonymityCommentVcodeImg.src = items[0];
$("__vc").value = items[1];
}
else
{
if ( ! anonymityCommentVcodeImg )
{
alert( "浣犵殑嫻忚鍣ㄥ睆鑭戒簡楠屻瘉鐮佸浘鐗囷紝璇峰彇娑堝悗閱嶈瘯錛? );
}
else if ( ! returnObj )
{
alert( "緗戠粶鎖呴殰錛屾病鍙枻埌楠屻瘉鐮佸浘鐗囷紝璇風◢鍚庨噸璇曪紒" );
}
}
}
function inputonkeydown(ev,parentId)
{
var ev = ev || window.event;
var target = ev.target || ev.srcElement;
var key = ev.keyCode || e.which;
if (key == 13 && target.type != "textarea")
{
var o = $("AnonymityCommentSubmit"+parentId);
if (o!=null)
{
o.submitNotLoginedComment(parentId);
}
ev.cancelBubble = true;
ev.returnValue = false;
}
}
//鑾峰彇鑭誨綍鎖愮淇℃伅
function onGetLoginTipCallback(returnObj)
{
var commentBlogDiv=$("commentBlogDiv");
if(commentBlogDiv && returnObj)
{
commentBlogDiv.innerHTML=returnObj.value;
}
}
//鑾峰彇鍥炱鐨勫洖搴旀枃鏈
function getReplayOfCommentDiv(parentId,hasReplay)
{
//濡傛灉欏甸潰涓婂凡緇忔湁鍙︿竴涓洖搴旀枃鏈錛岄渶瑕佸曉鍏跺彇娑?
if(status==1)
{
cancelCommentOfBlog(pId)
}
//濡傛灉褰撳墠澶蹺簬緙栬總鐘舵觥紝闇瑕佸彇娑堡紕杈戛枃鏈
if(status==2)
{
cancelEditComment();
}
pId=parentId;
status=1;
ShowBlog.GetLoginedText(parentId,hasReplay,onReplayOfCommentDivCallback);
}
function onReplayOfCommentDivCallback(returnObj)
{
var replayOfCommentDiv=$("replayOfCommentDiv"+pId);
if(replayOfCommentDiv && returnObj)
{
replayOfCommentDiv.innerHTML=returnObj.value;
var loginCommentDiv=$("loginedUserText"+pId);
var unLoginCommentDiv=$("commentContentText"+pId);
if(loginCommentDiv)
{
loginCommentDiv.focus();
}
else if(unLoginCommentDiv)
{
unLoginCommentDiv.focus();
}
}
}
//鍙栨秷鍥炱簲鏂呸湰妗?
function cancelCommentOfBlog(parentId)
{
pId=0;
status=0;
var replayOfCommentDiv=$("replayOfCommentDiv"+parentId);
replayOfCommentDiv.innerHTML="";
}
//鍒吠櫎鏃織鍥炱寮瑰嚭紿楀彝
function deleteBlogCommentTip(blogCommentId,parentId)
{
if(parentId>0)
{
showOkCancelMessageBox("deleteBlogCommentMessageBox","浣犵『瀹氳鍒吠櫎榪欐潯鏃織鍥炱鐨勫洖澶嶅悧錛?,"(璇搷浣滀笉鍙反澶?",function(){deleteBlogComment(blogCommentId,parentId);});
}
else if(parentId==0)
{
showOkCancelMessageBox("deleteBlogCommentMessageBox","浣犵『瀹氳鍒吠櫎榪欐潯鏃織鍥炱浠強璇洖澶嶇殑鎵鏈綏洖澶嶅悧錛?,"(璇搷浣滀笉鍙反澶?",function(){deleteBlogComment(blogCommentId,parentId);});
}
}
//鍒吠櫎鏃織鍥炱
function deleteBlogComment(blogCommentId,parentId)
{
ShowBlog.DeleteBlogComment(blogCommentId,parentId,onDeleteBlogCommentCallback);
}
function onDeleteBlogCommentCallback(returnObj)
{
if(returnObj && returnObj.value.length>0)
{
window.location.href=returnObj.value;
}
else
{
showMessageBox("deleteCommentFailMessageBox","鍒吠櫎鍥炱澶辮觸錛屻紼嶅悗鍐嶈瘯錛?,"");
}
}
//鑾峰彇緙栬總鏃織鍥炱鏂呸湰妗骨拰紜畾銆佸彇娑壟寧閽?
function editComment(blogCommentId,parentId,opinionId)
{
//濡傛灉褰撳墠鐘舵佸濱庡洖搴旂姘鎬觥紝闇瑕佸彇娑堝洖搴旀枃鏈
if(status==1)
{
cancelCommentOfBlog(pId);
}
//濡傛灉褰撳墠澶蹺簬緙栬總鐘舵觥紝闇瑕佸彇娑堡紕杈戛枃鏈
if(status==2)
{
cancelEditComment();
}
pId=parentId;
cId=blogCommentId;
status=2;
var body="";
if(parentId==0)
{
//鑾峰彇鍥炱鍐喋
var commentDiv=$("commentDiv_"+blogCommentId);
if(commentDiv)
{
body=commentDiv.innerHTML;
}
}
else if(parentId>0)
{
//鑾峰彇鍥炱簲鍐喋
var ReplayDiv=$("ReplayDiv_"+blogCommentId);
if(ReplayDiv)
{
body=ReplayDiv.innerHTML;
}
}
ShowBlog.GetEditComment(blogCommentId,body,parentId,opinionId,onEditCommentCallback);
}
function onEditCommentCallback(returnObj)
{
if(returnObj)
{
if(pId==0)
{
//鍥炱
var commentDiv=$("commentDiv_"+cId);
var editCommentDiv=$("editCommentDiv_"+cId);
if(commentDiv && editCommentDiv)
{
cDivHTML=commentDiv.innerHTML;
commentDiv.innerHTML="";
editCommentDiv.innerHTML=returnObj.value;
//鏇挎崲html緙栬總鍣ㄥ唴瀹?
var editCommentText=$("editCommentText_"+cId); //鏀劇紕杈賊櫒鐨劄iv
if(editCommentText)
{
editCommentHtml= new MTimeEditor(
{
instanceId: "editCommentHtml"+cId,
container: editCommentText,
type: 2 ,
value: cDivHTML,
area: 1,
height: 150
}
);
}
}
}
else
{
//鍥炱鐨勫洖搴?
var replayDiv=$("ReplayDiv_"+cId);
var editReplayDiv=$("editReplayDiv_"+cId);
if(replayDiv && editReplayDiv)
{
cDivHTML=replayDiv.innerHTML;
replayDiv.innerHTML="";
editReplayDiv.innerHTML=returnObj.value;
}
}
}
}
//鍙栨秷鍥炱鎴枻洖搴旂殑緙栬總
function cancelEditComment()
{
if(cId>0 && pId==0)
{
//鍥炱
var commentDiv=$("commentDiv_"+cId); //鍥炱鍐喋Div
var editCommentDiv=$("editCommentDiv_"+cId); //緙栬總鍥炱Div
if(commentDiv && editCommentDiv)
{
commentDiv.innerHTML=cDivHTML;
editCommentDiv.innerHTML="";
}
}
else if(cId>0 && pId>0)
{
//鍥炱簲
var replayDiv=$("ReplayDiv_"+cId);
var editReplayDiv=$("editReplayDiv_"+cId);
if(replayDiv && editReplayDiv)
{
replayDiv.innerHTML=cDivHTML;
editReplayDiv.innerHTML="";
}
}
cId=0;
pId=0;
status=0;
}
//紜畾鍥炱鎴枻洖搴旂殑緙栬總
function okEditComment( )
{
//鑾峰彇淇敼鐨勫洖澶嶅唴瀹?
var body;
if(pId==0)
{
body=editCommentHtml.getValue();
}
else if(pId>0)
{
body=$F("editCommentText_"+cId);
}
if(( pId==0 && !editCommentHtml.isEmpty()) || (pId>0 && body.Trim().length>0 ))
{
var content=body;
if(pId==0)
{
content=body.stripTags().Trim(); //緙栬總鍣ㄥ唴瀹瑰幓鎺倨爣絳懼垽鏂瓧鎖?
}
//鍥炱鏈澶?000涓瓧絎?2000涓眽瀛?
if(content.bytelength()>commentBodySize)
{
showMessageBox("TooLongBodyMessageBox","鍥炱鍐喋鏈澶氫負2000涓眽瀛楋紒","");
}
else if(content.bytelength()==0)
{
showMessageBox("TooLongBodyMessageBox","鍥炱鍐喋榪呸護鍚庝負絀猴紝璇烽噸鏂拌緭鍏紒","");
}
else
{
//鍥炱鏈夎瘎浠鳳紝鍥炱簲娌℃湁璇蹺環
var opinionId=0;
if(pId==0 && userId.value!=bloggerId.value)
{
opinionId=Utility.Dom.getSelectedValues( "opinionRadio", 1 ); //鑾峰彇璇蹺環Id
}
ShowBlog.EditBlogComment(pId,cId,body,opinionId,onOkEditCommentCallback);
}
}
else
{
showMessageBox("NullLoginedUserEditTextWindow","鍥炱鍐喋涓嶈始涓虹└錛?,"");
}
}
function onOkEditCommentCallback(returnObj)
{
if(returnObj && returnObj.value.length>0)
{
location.href=returnObj.value;
}
else
{
showMessageBox("FailLoginedUserEditTextWindow","淇敼鍥炱澶辮觸錛屻紼嶅悗鍐嶈瘯錛?,"");
}
}
//鍒吠櫎鏃織鎖愮
function deleteBlogTip(blogId,blogType,relatedId,relatedObjId)
{
showOkCancelMessageBox("deleteBlogMessageBox","浣犵『瀹氳鍒吠櫎榪欑渾鏃織鍚楋紵","(璇搷浣滀笉鍙反澶?",function(){deleteBlog(blogId,blogType,relatedId,relatedObjId);});
}
//鍒吠櫎鏃織
function deleteBlog(blogId,blogType,relatedId,relatedObjId)
{
ShowBlog.DeleteBlog(blogId,blogType,relatedId,relatedObjId,onDeleteBlogCallback);
}
function onDeleteBlogCallback(returnObj)
{
if(returnObj && returnObj.value.length>0)
{
window.location.href=returnObj.value;
}
else
{
showMessageBox("deleteBlogFailMessageBox","鍒吠櫎鏃織澶辮觸錛屻紼嶅悗鍐嶈瘯錛?,"");
}
}
function copyUrl()
{
var title = document.title;
var myHerf = top.location.href;
var ok = Globals.copyToClipboard( title + "\n" + myHerf );
if ( ok )
{
showMessageBox("copyUrlTip1","鐫壘trl + V ,綺樿創鍒癰SN涓婂發緇鬱縫鐨勫鍙嬩滑鍚?錛?,"");
}
else
{
showMessageBox("copyUrlTip2","瀵逛笉璧鳳紝鐩墠姝姛鑳藉彧鏀寔IE錛屻鐩存帴澶嶅埠鍦板潃鏍忕殑鍦板潃錛?,"");
}
}
Event.onDOMReady( load );
//-->