//
//
//
//
" + d[5] + "[訪問ta]"
}
title_div.appendChild(creator);
if (isowner || isadm){
var ctime = document.createElement("span");
ctime.setAttribute("class", "del");
ctime.innerHTML = "
[刪除]";
title_div.appendChild(ctime);
var edit = document.createElement("span");
edit.setAttribute("class", "edt");
edit.innerHTML = "
編輯回復(fù)";
title_div.appendChild(edit);
}
var reply = document.createElement("span");
reply.setAttribute("class", "rp");
reply.innerHTML = "
回復(fù)";
title_div.appendChild(reply);
var ctime = document.createElement("span");
ctime.setAttribute("class", "ct");
ctime.innerHTML = d[3];
title_div.appendChild(ctime);
/******************************************
var no = document.createElement("span");
no.setAttribute("class", "no");
no.innerHTML = d[0];
title_div.appendChild(no);
*****************************************/
var tmp_p = document.createElement("p");
$(tmp_p).attr({"class": "ctnt"});
tmp_p.innerHTML = d[4];
tmp_item.appendChild(tmp_p);
}
t.clearComments = function(){
$("#comment_list").children().remove();
}
t.showReply = function(c_id, obj){
//回復(fù)
var _tmp = $("#citm_"+c_id).offset();$("#reply input[name='c_id']").val(c_id);
$("#reply").prependTo($("#citm_"+c_id)).toggle().css({top:_tmp.top+60,left:540});
}
t.showEdit = function(c_id, obj){
//編輯
var _tmp = $("#citm_"+c_id).offset();$("#edt input[name='c_id']").val(c_id);
var tmp = $("#citm_"+c_id + " .ctnt quote:last").html();
if(tmp){
$("#edt textarea[name='ctnt']").val(tmp.split("")[1]);
}else{alert('您尚未回復(fù),無需修改');return 0;}
$("#edt").prependTo($("#citm_"+c_id)).toggle().css({top:_tmp.top+60,left:540});
}
t.reply = function(){
var ctnt = $("#reply textarea[name='ctnt']").val();
if(!ctnt){alert('請輸入回復(fù)內(nèi)容!');return;}
$.post("/kcms/count/reply",{'ctnt':ctnt,'c_id':$("#reply input[name='c_id']").val()},function(d){
if(d.err){alert('錯誤:' + d.err);return;}
$("#citm_" + $("#reply input[name='c_id']").val() + " p.ctnt").html(d.ctnt);
alert('回復(fù)成功!');
$("#reply").hide();
},'json');
}
t.edit = function(){
var ctnt = $("#edt textarea[name='ctnt']").val();
if(!ctnt){alert('內(nèi)容不能為空!');return;}
$.post("/kcms/count/editcmt",{'ctnt':ctnt,'c_id':$("#edt input[name='c_id']").val()},function(d){
if(d.err){alert('錯誤:' + d.err);return;}
$("#citm_" + $("#edt input[name='c_id']").val() + " p.ctnt").html(d.ctnt);
alert('修改成功!');
$("#edt").hide();
},'json');
}
t.addPager = function(pages, cur_p){
var str = "";
for(var i=0;i
" + (i+1) + "
";
}
str = "
";
$("#comment_list").append($(str))
}
t.showComment = function(p_id){
t.clearComments();
$.post("/kcms/count/getcomment",{'p_id':p_id,'a_id':t.a_id},
function(d){
if (d)
{
var len = d.rows.length;
for (var i=0;i1){t.addPager(d.pages,d.p)}
}
},'json');
}
window.k_comment = t;
}
})()
$(document).ready(function(){
var n = kcms.getUserInfo()['un'];
n = n?n:"您";
$("#cms_comment_content__label").html("請" + n + "發(fā)表評論");
k_comment.showComment(1);
});
//]]>
jQuery(function($){
$('#comment #reply, #comment #edt').drag(function( ev, dd ){
$( this ).css({
top: dd.offsetY,
left: dd.offsetX
});
});
});