// Ajax Comment Posting // WordPress plugin // version 1.0 // author: regua // http://regua.biz $(document).ready(function(){ $('#commentform').after('
'); $('#submit').after('
');
$('#loading').hide();
var form = $('#commentform');
var err = $('#error');
form.submit(function() {
if(form.find('#author').val() == '') {
err.empty();
err.append('Please enter your name.');
return false;
} // end if
if(!form.find('a[@title="Log out of this account"]')[0]) {
if(form.find('#email').val() == '') {
err.empty();
err.append('Please enter your email address.');
return false;
} // end if
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if(!filter.test(form.find('#email').val())) {
err.empty();
err.append('Please enter a valid email address.');
return false;
} // end if
} // end if
if(form.find('#comment').val() == '') {
err.empty();
err.append('Please enter your comment.');
return false;
} // end if
$(this).ajaxSubmit({
beforeSubmit: function() { $('#loading').show(); },
success: function(data) {
var nomoreloading = function() {
$('#loading').hide();
}; // end nomoreloading()
try {
response = $("