diff --git a/src/app/components/preferences/common/symbols/symbols.component.html b/src/app/components/preferences/common/symbols/symbols.component.html index 00279958..2b2e0cec 100644 --- a/src/app/components/preferences/common/symbols/symbols.component.html +++ b/src/app/components/preferences/common/symbols/symbols.component.html @@ -26,7 +26,7 @@
diff --git a/src/app/directives/LazyImg.directive.ts b/src/app/directives/LazyImg.directive.ts new file mode 100644 index 00000000..fa4827f7 --- /dev/null +++ b/src/app/directives/LazyImg.directive.ts @@ -0,0 +1,12 @@ +import { Directive, ElementRef } from '@angular/core'; + +@Directive({ selector: '[lazyimg]' }) +export class LazyImgDirective { + constructor({ nativeElement }: ElementRef) { + const supports = 'loading' in HTMLImageElement.prototype; + + if (supports) { + nativeElement.setAttribute('loading', 'lazy'); + } + } +}