Si scusami, non l'avevo visto
Prova a sostituire la parte aggiunta in overall_footer.html con questa:
Codice: Seleziona tutto
<!-- JQueratings -->
<script>
// Set if lot negative posts are hidden
var jqr_hidePost = 1;
$(document).ready( function() {
// Fetch username from phpBB
var user_id = "{S_USER_ID}";
// Populates JQrs
$('.jqueratings').each(function() {
var thiz = this;
var post_id = $(this).attr('alt');
$.ajax({
type: "GET",
url: "{ROOT_PATH}jqueratings/rate.php",
data: "type=show&post_id=" + post_id + "&user_id=" + user_id ,
success: function(response){
$("#p" + post_id + " .val").html(response);
if(response > 0) {
$(thiz).css('color', '#0dd92a');
}
if(response < 0) {
$(thiz).css('color', '#cf1313');
if(response < -15 && jqr_hidePost == 1) {
$("#p" + post_id + " h3").prepend('<span class="jqr_hidden" alt="' + post_id + '">[MOSTRA MESSAGGIO]</span> ');
$("#p" + post_id + " .content").css('display', 'none');
}
}
if(response == 0) {
$(thiz).css('color', '');
}
}
});
});
// View raters
$('.jqueratings .val').click( function() {
var post_id = $(this).parent().attr( 'alt' );
var author_id = $(this).parent().attr( 'name' );
$.ajax({
type: "GET",
url: "{ROOT_PATH}jqueratings/list.php",
data: "post_id=" + post_id + "&author_id=" + author_id ,
success: function(response){
$.msg({
autoUnblock : false,
content: '<p>' + response + '</p>' + '<p id="close">Chiudi</p>',
afterBlock : function(){
var self = this;
$( '#close' ).bind( 'click', function(){
// self.method is not chainable
self.unblock();
});
}
});
}
});
});
// Show bad rated posts
$( '.jqr_hidden' ).live("click", function() {
var post_id = $(this).attr( 'alt' );
$("#p" + post_id + " .content").toggle();
});
// Add user rate
$('.jqueratings div').not('.val').click( function() {
if( $(this).hasClass('plus') ) { type = 'plus' } else { type = 'minus' }
var author_id = $(this).parent().attr( 'name' );
var thiz = $(this).parent();
var post_id = $(this).parent().attr( 'alt' );
// Only registered users can votes && Users can't vote for themselves
if(user_id != 1 && user_id != author_id) {
$.ajax({
type: "GET",
url: "{ROOT_PATH}jqueratings/rate.php",
data: "type=" + type + "&post_id=" + post_id + "&user_id=" + user_id + "&author_id=" + author_id ,
success: function(response){
if(response != "voted") {
$("#p" + post_id + " .val").html(response);
if(response > 0) {
$(thiz).css('color', '#0dd92a');
}
if(response < 0) {
$(thiz).css('color', '#cf1313');
}
if(response == 0) {
$(thiz).css('color', '');
}
}
else {
// User had already voted this message, he can remove
$.msg({ autoUnblock : false,
content: "Hai già votato questo messaggio<br /><br /><span class='remove_vote' alt='" + post_id +"' name='" + author_id + "'>Rimuovi il tuo voto</span><span id='close'>Chiudi</span>",
afterBlock : function(){
var self = this;
$( '.remove_vote' ).bind( 'click', function(){
jqr_remove_vote(thiz, post_id, author_id, user_id);
// self.method is not chainable
self.unblock();
});
$( '#close' ).bind( 'click', function(){
// self.method is not chainable
self.unblock();
});
}
});
}
}
});
}
else {
if(user_id == author_id) {
$.msg({ content: 'Non puoi votare il tuo stesso messaggio.' });
}
else {
$.msg({ content: 'Devi essere registrato per votare!' });
}
}
});
// Remove vote
function jqr_remove_vote(thiz, post_id, author_id, user_id) {
$.ajax({
type: "GET",
url: "{ROOT_PATH}jqueratings/rate.php",
data: "type=remove&post_id=" + post_id + "&user_id=" + user_id + "&author_id=" + author_id ,
success: function(response) {
if(response != "voted") {
$("#p" + post_id + " .val").html(response);
if(response > 0) {
$(thiz).css('color', '#0dd92a');
}
if(response < 0) {
$(thiz).css('color', '#cf1313');
}
if(response == 0) {
$(thiz).css('color', '');
}
}
}
});
}
});
</script>
<!-- JQueratings -->