autoscroll on home page and dont run ads js at all for firefox android

This commit is contained in:
Anthony 2022-01-04 17:55:59 +01:00 committed by Thomas Zarebczan
parent 24cc07c09b
commit 28bcb96ec7
2 changed files with 8 additions and 1 deletions

View file

@ -236,6 +236,9 @@ function HomePage(props: Props) {
// delete last card to not introduce layout shifts // delete last card to not introduce layout shifts
lastCard.remove(); lastCard.remove();
// addresses bug where ad doesn't show up until a scroll event
document.dispatchEvent(new CustomEvent('scroll'));
} }
} }
checkFlag(); checkFlag();

View file

@ -53,6 +53,8 @@ function Ads(props: Props) {
triggerBlacklist, triggerBlacklist,
} = props; } = props;
const shouldShowAds = SHOW_ADS && !authenticated;
// load ad and tags here // load ad and tags here
let scriptUrlToUse; let scriptUrlToUse;
let tagNameToUse; let tagNameToUse;
@ -71,7 +73,9 @@ function Ads(props: Props) {
// add script to DOM // add script to DOM
useEffect(() => { useEffect(() => {
if (SHOW_ADS && !authenticated) { if (isFirefoxAndroid) return;
if (shouldShowAds) {
let script; let script;
try { try {
script = document.createElement('script'); script = document.createElement('script');