osm-commerces/assets/utils.js

26 lines
709 B
JavaScript
Raw Normal View History

2025-06-06 13:26:44 +02:00
function colorHeadingTable() {
const headers = document.querySelectorAll('th');
headers.forEach(header => {
const text = header.textContent;
const match = text.match(/\((\d+)\s*\/\s*(\d+)\)/);
if (match) {
const [_, completed, total] = match;
const ratio = completed / total;
const alpha = ratio.toFixed(2);
header.style.backgroundColor = `rgba(154, 205, 50, ${alpha})`;
}
});
}
function updateMapHeightForLargeScreens() {
const mapFound = document.querySelector('#map');
if (mapFound && window.innerHeight > 800 && window.innerWidth > 800) {
mapFound.style.height = '80vh';
} else {
console.log('window.innerHeight', window.innerHeight);
}
}