-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 );
//-->