From 5c4ce9b2d7b3d0cc56b43bd1e7e646d1f3f35498 Mon Sep 17 00:00:00 2001 From: Gerardo O Date: Thu, 11 Apr 2024 21:01:52 -0500 Subject: [PATCH] Ensure proper JS comments so they can be minified + formatting. --- resources/js/charts.js | 23 +++++++++++++---------- src/util.c | 5 ++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/resources/js/charts.js b/resources/js/charts.js index cc182c64e3..d0eba66d3f 100644 --- a/resources/js/charts.js +++ b/resources/js/charts.js @@ -108,7 +108,7 @@ function WorldMap() { if (svg.empty()) { svg = selection.append('svg') .attr('class', 'legend-svg') - .attr('width', width + margin.left + margin.right) // Adjust the width of the SVG + .attr('width', width + margin.left + margin.right) .attr('height', legendHeight + 2 * legendPadding); } @@ -116,7 +116,7 @@ function WorldMap() { if (legend.empty()) { legend = svg.append('g') .attr('class', 'legend') - .attr('transform', `translate(${margin.left}, ${legendPadding})`); // Adjust the position of the legend + .attr('transform', `translate(${margin.left}, ${legendPadding})`); } const legendData = colorScale.quantiles(); @@ -126,9 +126,9 @@ function WorldMap() { legendRects.enter().append('rect') .merge(legendRects) - .attr('x', (d, i) => (i * (innerW())) / legendData.length) // Adjust the x attribute + .attr('x', (d, i) => (i * (innerW())) / legendData.length) .attr('y', 0) - .attr('width', (innerW()) / legendData.length) // Adjust the width of the rectangles + .attr('width', (innerW()) / legendData.length) .attr('height', legendHeight) .style('fill', d => colorScale(d)); @@ -139,7 +139,7 @@ function WorldMap() { legendTexts.enter().append('text') .merge(legendTexts) - .attr('x', (d, i) => (i * (innerW())) / legendData.length) // Adjust the x attribute + .attr('x', (d, i) => (i * (innerW())) / legendData.length) .attr('y', legendHeight + legendPadding) .text(d => Math.round(d)) .style('font-size', '10px') @@ -167,10 +167,11 @@ function WorldMap() { let country = svg.select('g').selectAll('.country') .data(countries); + // set initial opacity to 0 for entering elements let countryEnter = country.enter().append('path') .attr('class', 'country') .attr('d', path) - .attr('opacity', 0); // set initial opacity to 0 for entering elements + .attr('opacity', 0); country = countryEnter.merge(country) .on('mouseover', function(event, d) { @@ -187,19 +188,21 @@ function WorldMap() { const countryData = dataByName[d.id]; return countryData ? colorScale(countryData[metric]) : '#cccccc54'; }) - .attr('opacity', 1); // animate opacity to 1 + .attr('opacity', 1); country.exit() .transition().duration(500) - .attr('opacity', 0) // animate opacity to 0 + .attr('opacity', 0) .remove(); } function setBounds(projection, maxLat) { const [yaw] = projection.rotate(); - const xymax = projection([-yaw + 180 - 1e-6, -maxLat]); // Top left corner - const xymin = projection([-yaw - 180 + 1e-6, maxLat]); // Bottom right corner + // Top left corner + const xymax = projection([-yaw + 180 - 1e-6, -maxLat]); + // Bottom right corner + const xymin = projection([-yaw - 180 + 1e-6, maxLat]); return [xymin, xymax]; } diff --git a/src/util.c b/src/util.c index 7021bcfd24..d96dc4c33b 100644 --- a/src/util.c +++ b/src/util.c @@ -96,9 +96,8 @@ static const char *codes[1000] = { [500] = STATUS_CODE_500, STATUS_CODE_501, STATUS_CODE_502, STATUS_CODE_503, STATUS_CODE_504, [505] = STATUS_CODE_505, [509] = STATUS_CODE_509, - [520] = - STATUS_CODE_520, STATUS_CODE_521, STATUS_CODE_522, STATUS_CODE_523, STATUS_CODE_524, - STATUS_CODE_525, STATUS_CODE_526, STATUS_CODE_527, STATUS_CODE_529, + [520] = STATUS_CODE_520, STATUS_CODE_521, STATUS_CODE_522, STATUS_CODE_523, STATUS_CODE_524, + STATUS_CODE_525, STATUS_CODE_526, STATUS_CODE_527, STATUS_CODE_529, [530] = STATUS_CODE_530, [540] = STATUS_CODE_540, [561] = STATUS_CODE_561,