From b60addc4e6aea8123f2ca7cbca6b06c1ef6e23f1 Mon Sep 17 00:00:00 2001 From: Alex Schroeder Date: Tue, 6 Dec 2022 12:25:08 +0100 Subject: [PATCH] Add loading="lazy" to all images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only load images when they're visible. "The loading attribute on an element … can be used to instruct the browser to defer loading of images/iframes that are off-screen until the user scrolls near them." https://developer.mozilla.org/en-US/docs/Web/Performance/Lazy_loading#images_and_iframes --- html.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/html.c b/html.c index a9f399e..78c6aed 100644 --- a/html.c +++ b/html.c @@ -66,7 +66,7 @@ d_char *html_actor_icon(snac *snac, d_char *os, char *actor, char *date, char *u if (n && i) { char *u = xs_dict_get(i, "url"); - xs *img = xs_fmt("", u); + xs *img = xs_fmt("", u); name = xs_replace_i(name, n, img); } @@ -84,7 +84,7 @@ d_char *html_actor_icon(snac *snac, d_char *os, char *actor, char *date, char *u avatar = xs_fmt("data:image/png;base64, %s", susie); { - xs *s1 = xs_fmt("

\"\"/\n", avatar); + xs *s1 = xs_fmt("

\"\"\n", avatar); s = xs_str_cat(s, s1); } @@ -668,7 +668,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int if (n && i) { char *u = xs_dict_get(i, "url"); - xs *img = xs_fmt("", u); + xs *img = xs_fmt("", u); c = xs_replace_i(c, n, img); } @@ -697,7 +697,7 @@ d_char *html_entry(snac *snac, d_char *os, char *msg, int local, int level, int char *name = xs_dict_get(v, "name"); if (url != NULL) { - xs *s1 = xs_fmt("

\"%s\"/

\n", + xs *s1 = xs_fmt("

\"%s\"

\n", url, xs_is_null(name) ? "" : name); s = xs_str_cat(s, s1);