Hide images if error on billboards to fix blocking page (#20419)

* Hide images if error on billboards

* Update app/javascript/packs/billboard.js
This commit is contained in:
Ben Halpern 2023-12-05 09:02:27 -05:00 committed by GitHub
parent 4815661bad
commit 55997ffba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -279,6 +279,10 @@
--indicator-bg: rgb(var(--grey-600));
--indicator-color: rgb(var(--grey-200));
/* Indicators: Subtle */
--indicator-subtle-bg: rgb(var(--grey-700));
--indicator-subtle-color: rgb(var(--grey-200));
/* Indicators: Success */
--indicator-success-bg: rgb(var(--green-700));
--indicator-success-color: rgb(var(--green-50));

View file

@ -29,6 +29,11 @@ async function generateBillboard(element) {
element.innerHTML = '';
element.appendChild(generatedElement);
element.querySelectorAll('img').forEach((img) => {
img.onerror = function () {
this.style.display = 'none';
};
});
executeBBScripts(element);
setupBillboardDropdown();
// This is called here because the ad is loaded asynchronously.