Skip to content

Commit 05a096c

Browse files
authored
Revert image workarounds (#3821)
* Revert figure workarounds * Add comment
1 parent 31fc238 commit 05a096c

2 files changed

Lines changed: 3 additions & 10 deletions

File tree

src/static/js/almanac.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,6 @@ function googleSheetsPixelNotLoaded() {
388388
//We use Google Sheets for detailed visualisations
389389
//Check for support and switch out images if supported
390390
function upgradeInteractiveFigures() {
391-
392-
// Temporarily disable charts since embedding is currently broken in Sheets
393-
// See: https://github.com/HTTPArchive/almanac.httparchive.org/issues/3803
394-
return;
395-
396391
try {
397392
if (!isInPrintMode() && bigEnoughForInteractiveFigures() && !dataSaverEnabled() && highBandwidthConnection() && highResolutionCanvasSupported()) {
398393

src/tools/generate/generate_figure_images.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ const take_single_screenshot = async (graphUrl, filename) => {
77

88
const sheets_chart = graphUrl.startsWith('https://docs.google.com/spreadsheets') ? true : false;
99

10-
// Temporarily replace `&format=interactive` with `&format=image`
11-
const chartUrl = sheets_chart ? graphUrl.replaceAll('&format=interactive', '&format=image') : 'http://localhost:8080/' + graphUrl;
10+
const chartUrl = sheets_chart ? graphUrl : 'http://localhost:8080/' + graphUrl;
1211
const browser = await puppeteer.launch();
1312
const page = await browser.newPage();
1413
await page.setViewport({
@@ -21,9 +20,8 @@ const take_single_screenshot = async (graphUrl, filename) => {
2120
});
2221

2322

24-
// Temporarily handle `&format=image` instead of `&format=interactive`
25-
// const el = sheets_chart ? await page.$('#embed_chart') : await page.$('main');
26-
const el = sheets_chart ? await page.$('img') : await page.$('main');
23+
// Charts are in #embed_chart, maps are in #c div div
24+
const el = sheets_chart ? await page.$('#embed_chart, #c div div') : await page.$('main');
2725
await el.screenshot({ path: filename });
2826
await browser.close();
2927
}

0 commit comments

Comments
 (0)