Commit e77a50a3 authored by Vadim's avatar Vadim

Version 2.5.3

Обновление снипетов онлайн
parent 519c648d
......@@ -3,7 +3,7 @@
Plugin Name: Bg Az-Counter
Plugin URI: https://bogaiskov.ru
Description: Подсчет количества посещений страниц на базе stat.azbyka.ru
Version: 2.5.2
Version: 2.5.3
Author: VBog
Author URI: https://bogaiskov.ru
License: GPL2
......@@ -37,7 +37,7 @@
if ( !defined('ABSPATH') ) {
die( 'Sorry, you are not allowed to access this page directly.' );
}
define('BG_COUNTER_VERSION', '2.5.2');
define('BG_COUNTER_VERSION', '2.5.3');
define('BG_COUNTER_LOG', dirname(__FILE__ ).'/bg_counter.log');
define('BG_COUNTER_STAT_COUNTERS','https://stat.azbyka.ru/counters');
......
......@@ -75,7 +75,7 @@ function bg_az_counter_rating($type, $id) {
$votes = 0;
} else {
$data = $response->data;
$score = number_format((float)$data->score, 1, ',', '');
$score = number_format((float)$data->score, 1, '.', '');
$votes = $data->votes;
}
$alreadyVoted = 'false'; // Сервер голосовать не должен!!!
......
......@@ -8,25 +8,19 @@ jQuery( document ).ready(function() {
if (!bg_counter.ID) return; // У объекта нет ID
if (jQuery("div").is(".bg_counter_rating") == false) return; // На странице нет счетчика
getAllRates();
// start_rate_index = Math.round(parseFloat(jQuery( "#bg_counter_score" ).html()));
// var price = ["очень плохо", "плохо", "удовлетворительно", "хорошо", "отлично"];
start_rate_index = parseFloat(jQuery( "#bg_counter_score" ).html());
rating_voted = (jQuery( "#bg_counter_score" ).attr("data-voted")=='true')?true:false;
iniRatingState(start_rate_index, rating_voted);
getRate(bg_counter.type, bg_counter.ID);
getRate(bg_counter.type, bg_counter.ID);
jQuery( "#bg_counter_rate_box li" ).mouseover(function() {
if(!rating_voted){
var index = jQuery( this ).index();
iniRatingState(index+1, rating_voted);
jQuery('#bg_counter_popup_help').text(bg_counter.price[index]);
// jQuery('#bg_counter_popup_help').css('width', '110px');
} else {
jQuery('#bg_counter_popup_help').text(bg_counter.voted);
// jQuery('#bg_counter_popup_help').css('width', '260px');
}
jQuery('#bg_counter_popup_help').show();
});
......@@ -110,6 +104,8 @@ function getRate(type, id) {
jQuery('#bg_counter_votes').html(response.data.votes);
jQuery('#bg_counter_votes_txt').html(txt_votes);
jQuery('#bg_counter_score').html(start_rate_index);
jQuery('meta[itemprop=ratingCount]').attr("content", response.data.votes);
jQuery('meta[itemprop=ratingValue]').attr("content", start_rate_index);
rating_voted = response.data.alreadyVoted;
iniRatingState(start_rate_index, rating_voted);
} else {
......@@ -117,6 +113,8 @@ function getRate(type, id) {
jQuery('#bg_counter_votes').html('0');
jQuery('#bg_counter_votes_txt').html(bg_counter.votes5);
jQuery('#bg_counter_score').html('0');
jQuery('meta[itemprop=ratingCount]').attr("content", 0);
jQuery('meta[itemprop=ratingValue]').attr("content", 0);
iniRatingState(0, false);
}
}
......@@ -210,6 +208,8 @@ function sendRate(type, id, number) {
jQuery('#bg_counter_votes').html(response.data.votes);
jQuery('#bg_counter_votes_txt').html(txt_votes);
jQuery('#bg_counter_score').html(start_rate_index);
jQuery('meta[itemprop=ratingCount]').attr("content", response.data.votes);
jQuery('meta[itemprop=ratingValue]').attr("content", start_rate_index);
iniRatingState(start_rate_index, true);
getAllRates();
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment