Skip to content

Commit 0faf7a4

Browse files
Tweak param string for ai2html case
1 parent 69a1797 commit 0faf7a4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dotcom-rendering/src/components/InteractiveBlockComponent.importable.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,19 +350,23 @@ export const InteractiveBlockComponent = ({
350350

351351
// Bespoke dark mode logic for Datawrapper and ai2html embeds on web
352352
// This should be removed if/when dark mode is implements on the website
353+
const isai2html = url.includes(
354+
'interactive.guim.co.uk/uploader/embed/',
355+
);
353356
if (
354357
!document.querySelector('.ios') &&
355358
!document.querySelector('.android') &&
356-
(url.includes('datawrapper') ||
357-
url.includes('interactive.guim.co.uk/uploader/embed/'))
359+
(url.includes('datawrapper') || isai2html)
358360
) {
359361
const prefersDarkScheme = window.matchMedia(
360362
'(prefers-color-scheme: dark)',
361363
).matches;
362364
const darkMode = darkModeAvailable && prefersDarkScheme;
363365
if (!darkMode) {
364366
iframe.src +=
365-
(iframe.src.includes('?') ? '&' : '?') + 'dark=false';
367+
(isai2html ? '/' : '') +
368+
(iframe.src.includes('?') ? '&' : '?') +
369+
'dark=false';
366370
}
367371
}
368372

0 commit comments

Comments
 (0)