/**
* WordPress jQuery-Ajax-Comments
*/
jQuery(document).ready(function($) {
var $commentform = $('#commentform'),
edit_mode = '1', // edit mode ( '1'=Y; '0'=N )
ajax_url = $commentform.attr("action").replace("wp-comments-post.php", ""),
pic_sb = ajax_url + 'wp-admin/images/wpspin_light.gif', // submit icon
pic_no = ajax_url + 'wp-admin/images/no.png', // error icon
pic_ys = ajax_url + 'wp-admin/images/yes.png', // succeed icon
txt1 = '

'+ajaxL10n.txt1+'
',
txt2 = '#
',
txt3 = '">
'+ajaxL10n.txt3+'',
edt1 = ', '+ajaxL10n.edt1+' ',
cancel_edit = ajaxL10n.cancel_edit,
edit,
num = 0,
comm_array =[],
$comments = $('#comments-title span a'), // comment num ID
$cancel = $('#cancel-comment-reply-link'),
cancel_text = $cancel.text(),
$submit = $('#commentform #submit'); $submit.attr('disabled', false),
$body = (window.opera) ? (document.compatMode == "CSS1Compat" ? $('html') : $('body')) : $('html,body');
$('#comment').after( txt1 + txt2 ); $('#loading').hide(); $('#error').hide();
/** submit */
$commentform.submit(function() {
$('#loading').slideDown();
$submit.attr('disabled', true).fadeTo('slow', 0.5);
if ( edit ) $('#comment').after('');
/** Ajax */
$.ajax( {
url: ajax_url,
data: $(this).serialize() + "&action=ajax_comment",
type: $(this).attr('method'),
error: function(request) {
$('#loading').slideUp();
$('#error').slideDown().html('
' + request.responseText);
setTimeout(function() {$submit.attr('disabled', false).fadeTo('slow', 1); $('#error').slideUp();}, 3000);
},
success: function(data) {
$('#loading').hide();
comm_array.push($('#comment').val());
$('textarea').each(function() {this.value = ''});
var t = addComment, cancel = t.I('cancel-comment-reply-link'), temp = t.I('wp-temp-form-div'), respond = t.I(t.respondId), post = t.I('comment_post_ID').value, parent = t.I('comment_parent').value;
// comments
if ( ! edit && $comments.length ) {
n = parseInt($comments.text().match(/\d+/));
$comments.text($comments.text().replace( n, n + 1 ));
}
// show comment
new_htm = '" id="new_comm_' + num + '">';
new_htm = ( parent == '0' ) ? ('\n