deleting totalCells in the code, maybe i will add provinceCells in the future.

Deleted lines for const totalCells and for (+cells / totalCells) * 100 + "%";
This commit is contained in:
Ángel Montero Lamas 2024-01-16 19:30:17 +01:00
parent f3253380c5
commit 8b57426dc8

View file

@ -584,14 +584,12 @@ function editProvinces() {
function togglePercentageMode() { function togglePercentageMode() {
if (body.dataset.type === "absolute") { if (body.dataset.type === "absolute") {
body.dataset.type = "percentage"; body.dataset.type = "percentage";
const totalCells = +byId("statesFooterCells").innerText;
const totalBurgs = +byId("provincesFooterBurgs").innerText; const totalBurgs = +byId("provincesFooterBurgs").innerText;
const totalArea = +provincesFooterArea.dataset.area; const totalArea = +provincesFooterArea.dataset.area;
const totalPopulation = +provincesFooterPopulation.dataset.population; const totalPopulation = +provincesFooterPopulation.dataset.population;
body.querySelectorAll(":scope > div").forEach(function (el) { body.querySelectorAll(":scope > div").forEach(function (el) {
const {cells, burgs, area, population} = el.dataset; const {cells, burgs, area, population} = el.dataset;
el.querySelector(".provinceCells").innerText = rn((+cells / totalCells) * 100) + "%";
el.querySelector(".provinceBurgs").innerText = rn((+burgs / totalBurgs) * 100) + "%"; el.querySelector(".provinceBurgs").innerText = rn((+burgs / totalBurgs) * 100) + "%";
el.querySelector(".biomeArea").innerHTML = rn((+area / totalArea) * 100) + "%"; el.querySelector(".biomeArea").innerHTML = rn((+area / totalArea) * 100) + "%";
el.querySelector(".culturePopulation").innerHTML = rn((+population / totalPopulation) * 100) + "%"; el.querySelector(".culturePopulation").innerHTML = rn((+population / totalPopulation) * 100) + "%";