Lazy load integration images (#25024)

This commit is contained in:
Joakim Sørensen 2022-11-22 11:29:52 +01:00 committed by GitHub
parent 80f2e66e89
commit 674ef79531
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,9 +161,9 @@ allComponents.pop(); // remove placeholder element at the end
components: [],
image: function () {
if (this.logo === '') {
return '<img src="https://brands.home-assistant.io/_/' + this.domain + '/logo.png" srcset="https://brands.home-assistant.io/_/' + this.domain + '/logo@2x.png 2x">';
return '<img src="https://brands.home-assistant.io/_/' + this.domain + '/logo.png" srcset="https://brands.home-assistant.io/_/' + this.domain + '/logo@2x.png 2x" loading="lazy">';
} else {
return '<img data-src="/images/supported_brands/' + this.logo + '">';
return '<img data-src="/images/supported_brands/' + this.logo + '" loading="lazy">';
}
}
};