© RIPRODUZIONE RISERVATA
‘);
$ form.append(‘
Caratteri rimanenti:
‘);
$ form.append(”);
$ form.hide();
$ (this).closest(‘div’).first().after( $ form );
$ form.wrap(”);
}
$ form.toggle();
$ form_report.hide();
});
$ (document).on(‘click’,’.commenti .vc_report’, function(){
$ (‘.commenti .vc_report_comment_box form’).not( $ (this).closest(‘li’).find(‘form’) ).hide();
var $ form=$ (this).closest(‘li’).find(‘> .vc_report_comment_box form’);
var $ form_comment=$ (this).closest(‘li’).find(‘> .posta_commenti form’);
if ( $ form.length==0 ){
$ form = $ (”).attr(‘method’, ‘post’).attr(‘action’, ‘/actions/report.jsp’);
$ form.append(‘‘);
$ form.append(‘‘);
$ form.append(”);
$ form.append(”);
$ form.hide();
$ (this).closest(‘div’).first().after( $ form );
$ form.wrap(”);
$ form.submit(function(){
var text=$ (this).find(‘[name=text]’).val();
if(text==”){
$ .confirm({
‘title’ : ‘Errore!’,
‘message’ : ‘Inserisci un testo’,
‘buttons’ : {‘Ok’:{‘class’:’blue’}}
});
}else{
$ .ajax({
url: $ (this).attr(‘action’),
data: $ (this).serialize(),
dataType: ‘json’,
success: function(response){
if(response.askForLogin){
openPopupLogin();
}else{
$ .confirm({
‘title’ : ”,
‘message’ : ‘La sua segnalazione è stata inviata con successo’,
‘buttons’ : {‘Ok’:{‘class’:’blue’, ‘action’: function(){ location.href=parent.location.href; } }}
});
}
}
});
}
return false;
});
}
$ form.toggle();
$ form_comment.hide();
});
$ (document).on(‘focus’,’.commenti .post_commenti_form textarea[name=”testo”]’, function(){
if( $ (this).val()==’Testo’){
$ (this).val(”);
}
});
$ (document).on(‘blur’,’.commenti .post_commenti_form textarea[name=”testo”]’, function(){
if($ (this).val().replace(/ /g,”).length==0){
$ (this).val(‘Testo’);
}
});
$ (document).on(‘change keyup’,’.commenti .post_commenti_form textarea[name=”testo”]’, function(){
if($ (this).val().length>max_characters){
$ (this).val($ (this).val().substring(0,max_characters));
}
$ (this).closest(‘form’).find(‘.commentodispo’).html(max_characters-$ (this).val().length);
});