// J0ZF 2010.3.18
var add_comment_started = false;
// turns the comment box and the captcha on
function start_add_comment(be_id)
{
if(!add_comment_started) {
add_comment_started = true;
$('#comment_box_'+be_id).val('').addClass('add_comment_now').animate({height:'100px'}, "slow", "swing", function(){
$('#add_comment_controls_'+be_id).slideDown("slow", function(){
$('input#verification_code_'+be_id).focus();
$('#comment_box_'+be_id).focus();
});
});
}
return true;
}
function submit_comment( frm, be_id, e )
{
e.preventDefault();
$('#add_comment_status_'+be_id).html(' Saving ...');
var name = frm.elements["comment_box"].form.elements["author_name"].value;
var email = frm.elements["comment_box"].form.elements["author_email"].value;
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if(re.test(email) == false)
{
$('#add_comment_status_'+be_id).html( '
' );
return false;
}
if(name == '')
{
$('#add_comment_status_'+be_id).html( '' );
return false;
}
$.post( frm.action, $(frm).serialize(), function(data){
if( data['status'] == 'OK' ) {
$('#add_comment_status_'+be_id).html(data['status_msg']);
$('#comment_box_submit_'+be_id).attr("disabled", "disabled");
$('#comment_box_'+be_id).removeClass('add_comment_now').attr("readonly", "readonly");
$('#add_comment_controls_'+be_id).slideUp("slow");
$('#comment_box_'+be_id).val('').addClass('add_comment_now').animate({height:'28px'}, "slow", "swing", function(){
$('#add_comment_controls_'+be_id).slideUp("slow",function() { $('#comment_box_'+be_id).hide(); });
});
}
else {
$('#add_comment_status_'+be_id).html( '' );
}
}
, 'json'
);
return false;
}
function comment_visibility_toggle( be_id, comment_id, blog )
{
$('#id_comment_visibility_'+comment_id).html('Saving..');
$.post( 'blog_ajax?ai_skin=full_page&cmd=comment.visibility_toggle.json'
, { 'blog_entry_id':be_id, 'comment_id':comment_id, 'blog':blog }, function(data) {
if(data['visibility'] == 'Hidden') {
$('#id_comment_visibility_'+comment_id)
.removeClass('comment_visibility_visible')
.addClass('comment_visibility_hidden')
.html('Hidden');
} else {
$('#id_comment_visibility_'+comment_id)
.removeClass('comment_visibility_hidden')
.addClass('comment_visibility_visible')
.html('Visible');
}
}
, 'json'
);
return false;
}
function delete_comment( be_id, comment_id, blog )
{
if(!confirm('Delete this comment?')){
return false;
}
$('#id_comment_delete_'+comment_id).html('Deleting..');
$.post( 'blog_ajax?ai_skin=full_page&cmd=comment.delete.json'
, { 'blog_entry_id':be_id, 'comment_id':comment_id, 'blog':blog }, function(data) {
if(data['status'] == 'OK') {
$('#id_comment_div_'+comment_id).slideUp();
} else {
alert(data['status_msg']);
}
}
, 'json'
);
return false;
}
//Samuel Larkin 2015.6.18
function show_comments()
{
$("#comments_container").show();
$target = $("#comments_container");
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 900, 'swing');
}