Um einen Text zu formatieren nutzt das existierende Livecomment-Plugin das frontend_display-event. In Kombination mit jquery sähe das so aus:
Aufruf im Javascript:
Code: Select all
$.post(lcbase, 'data='+$('#serendipity_commentform_comment').val(), function(text){
alert(text);
},'html')
Code: Select all
case 'external_plugin':
if ($eventData == 'livecomment') {
$data = array('comment' => $_REQUEST['data']);
serendipity_plugin_api::hook_event('frontend_display', $data);
echo $data['comment'];
}
Nun wäre es ziemlich praktisch, wenn nicht nur das innere des Kommentars ausgegeben würde, sondern ein ganzer Kommentarblock. Also ein
Code: Select all
<div id="serendipity_comment_" class="serendipity_comment serendipity_comment_author_unknown comment_oddbox" style="padding-left: 40px">
<div class="serendipity_commentBody">
<strong>abc</strong>
</div>
<div class="serendipity_comment_source">
...
Gruß