Cuando envio un nuevo comentario el cuadro para realizar el mensaje siempre sale.
Como hago que se quite cuando el mensaje se ha enviado?
Código PHP:
function comment_form($stream_id, $flag = '') {
global $config, $client;
if (!$client['id']) {
return '<div>>>'.url('member/login',t('Login to comment') ).'</div>';
}
if (!$flag) $flag = t('Comment');
if (!$config['comment_headed']) {
$comment_head =
'
<script>
$(document).ready( function(){
$("a[class=comment_delete]").click( function () {
var parentdd = $(this).parents(".user_comment");
var sid = $(this).prev()[0].value;
$(this).after("<img src=\''.uhome().'/files/loading.gif\' /> hiding..");
$(this).hide();
$.get(\''.uhome().'/index.php?p=jquery/comment_delete/\'+sid, function(data) {
parentdd.hide("slow");
});
return false;
});
$(".quick_comment").click(function() {
$(this).next().next().css("display","block");
$(this).next().next().find(".commentmessage").focus();
return false;
});
$(".commentsubmit").click(function() {
if ($(this).prev()[0].value != "") {
var thiscomment = $(this).parents(".quick_comment_form");
var cbox = thiscomment.next().next();
var mbox = thiscomment.find(".commentmessage");
var tbox = thiscomment.next();
cbox.html("<img src=\"'.uhome().'/files/loading.gif\" /> Submitting");
$.post("'.uhome().'/index.php?p=jquery/comment_publish",
{message:mbox[0].value,target_id:tbox[0].value},
function(data){
cbox.html("");
cbox.after(data);
mbox.attr("value","");
},"html"
);
return false;
}
});
$(".dolike").click(function() {
var thiscomment = $(this).next();
var cbox = thiscomment.next().next();
var tbox = thiscomment.next();
cbox.html("<img src=\"'.uhome().'/files/loading.gif\"/> Submitting");
$.post("'.uhome().'/index.php?p=jquery/dolike",
{target_id:tbox[0].value},
function(data){
cbox.html("");
cbox.after(data);
},"html"
);
$(this).css("display","none");
return false;
});
});
</script>
';
$config['comment_headed'] = 1;
}
$res = sql_query("select * from ".tb()."liked where stream_id='$stream_id' and uid='{$client['id']}' limit 1");
if (sql_counts($res)) {
$likeit = '<a href="#" class="dolike">'.t('Unlike').'</a>';
}
else {
$likeit = '<a href="#" class="dolike">'.t('Like').'</a>';
}
return $comment_head.'
<div>
<a href="#" class="quick_comment">+'.$flag.'</a> | '.$likeit.'
<div class="quick_comment_form" style="display:none;">
<table border="0"><tr><td valign="top">
<img src="'.uhome().'/uploads/avatars/s_'.$client['avatar'].'" width="25" height="25" />
</td><td>
<textarea name="message" rows="2" class="fpost commentmessage"" style="width:350px;" ></textarea>
<input type="button" value=" '.$flag.' " class="fbutton commentsubmit" />
</td></tr>
</table>
</div>
<input type="hidden" name="wall_id" value="'.$stream_id.'" />
<div></div>
</div>';
}