Merge pull request #1298 from pi-hole/XhmikosR-patch-5

Enable `no-zero-fractions` rule
This commit is contained in:
DL6ER
2020-05-25 19:48:01 +02:00
committed by GitHub
6 changed files with 12 additions and 13 deletions

View File

@@ -269,11 +269,11 @@ $(document).ready(function () {
},
label: function (tooltipItems, data) {
if (tooltipItems.datasetIndex === 0) {
var percentage = 0.0;
var percentage = 0;
var permitted = parseInt(data.datasets[1].data[tooltipItems.index]);
var blocked = parseInt(data.datasets[0].data[tooltipItems.index]);
if (permitted + blocked > 0) {
percentage = (100.0 * blocked) / (permitted + blocked);
percentage = (100 * blocked) / (permitted + blocked);
}
return (

View File

@@ -97,7 +97,7 @@ function updateTopClientsChart() {
clientname = client;
}
percentage = (data.top_sources[client] / sum) * 100.0;
percentage = (data.top_sources[client] / sum) * 100;
clienttable.append(
"<tr> <td>" +
clientname +
@@ -144,7 +144,7 @@ function updateTopDomainsChart() {
data.top_domains[escapeHtml(domain)] = data.top_domains[domain];
}
percentage = (data.top_domains[domain] / sum) * 100.0;
percentage = (data.top_domains[domain] / sum) * 100;
domaintable.append(
"<tr> <td>" +
domain +
@@ -191,7 +191,7 @@ function updateTopAdsChart() {
data.top_ads[escapeHtml(ad)] = data.top_ads[ad];
}
percentage = (data.top_ads[ad] / sum) * 100.0;
percentage = (data.top_ads[ad] / sum) * 100;
adtable.append(
"<tr> <td>" +
ad +

View File

@@ -209,9 +209,9 @@ var reloadCallback = function () {
$("h3#ads_blocked_exact").text(statistics[2].toLocaleString());
$("h3#ads_wildcard_blocked").text(statistics[3].toLocaleString());
var percent = 0.0;
var percent = 0;
if (statistics[2] + statistics[3] > 0) {
percent = (100.0 * (statistics[2] + statistics[3])) / statistics[0];
percent = (100 * (statistics[2] + statistics[3])) / statistics[0];
}
$("h3#ads_percentage_today").text(parseFloat(percent).toFixed(1).toLocaleString() + " %");

View File

@@ -877,12 +877,12 @@ $(document).ready(function () {
},
label: function (tooltipItems, data) {
if (tooltipItems.datasetIndex === 0) {
var percentage = 0.0;
var percentage = 0;
var permitted = parseInt(data.datasets[1].data[tooltipItems.index]);
var blocked = parseInt(data.datasets[0].data[tooltipItems.index]);
var total = permitted + blocked;
if (total > 0) {
percentage = (100.0 * blocked) / total;
percentage = (100 * blocked) / total;
}
return (

View File

@@ -49,9 +49,9 @@ function rgbToHex(values) {
function mixColors(ratio, rgb1, rgb2) {
return [
(1.0 - ratio) * rgb1[0] + ratio * rgb2[0],
(1.0 - ratio) * rgb1[1] + ratio * rgb2[1],
(1.0 - ratio) * rgb1[2] + ratio * rgb2[2]
(1 - ratio) * rgb1[0] + ratio * rgb2[0],
(1 - ratio) * rgb1[1] + ratio * rgb2[1],
(1 - ratio) * rgb1[2] + ratio * rgb2[2]
];
}