diff options
| author | 2023-08-24 06:52:42 +0200 | |
|---|---|---|
| committer | 2023-08-24 06:52:42 +0200 | |
| commit | 5518bb509b5f3c197c616608eae5f44d676e4586 (patch) | |
| tree | 92232ed985b22ecc1762ae6f41c15b9bb40e994e /html.c | |
| parent | mastoapi: process tag lists that are not lists correctly. (diff) | |
| download | snac2-5518bb509b5f3c197c616608eae5f44d676e4586.tar.gz snac2-5518bb509b5f3c197c616608eae5f44d676e4586.tar.xz snac2-5518bb509b5f3c197c616608eae5f44d676e4586.zip | |
In HTML images, move the loading=lazy BEFORE the src attribute.
This may (or may not, not completely sure) avoid this Firefox bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1647077
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 13 |
1 files changed, 7 insertions, 6 deletions
| @@ -78,7 +78,7 @@ xs_str *actor_name(xs_dict *actor) | |||
| 78 | 78 | ||
| 79 | if (n && i) { | 79 | if (n && i) { |
| 80 | char *u = xs_dict_get(i, "url"); | 80 | char *u = xs_dict_get(i, "url"); |
| 81 | xs *img = xs_fmt("<img src=\"%s\" style=\"height: 1em; vertical-align: middle;\" loading=\"lazy\"/>", u); | 81 | xs *img = xs_fmt("<img loading=\"lazy\" src=\"%s\" style=\"height: 1em; vertical-align: middle;\"/>", u); |
| 82 | 82 | ||
| 83 | name = xs_replace_i(name, n, img); | 83 | name = xs_replace_i(name, n, img); |
| 84 | } | 84 | } |
| @@ -110,8 +110,8 @@ xs_str *html_actor_icon(xs_str *os, char *actor, | |||
| 110 | avatar = xs_fmt("data:image/png;base64, %s", default_avatar_base64()); | 110 | avatar = xs_fmt("data:image/png;base64, %s", default_avatar_base64()); |
| 111 | 111 | ||
| 112 | { | 112 | { |
| 113 | xs *s1 = xs_fmt("<p><img class=\"snac-avatar\" src=\"%s\" alt=\"\" " | 113 | xs *s1 = xs_fmt("<p><img class=\"snac-avatar\" loading=\"lazy\" " |
| 114 | "loading=\"lazy\"/>\n", avatar); | 114 | "src=\"%s\" alt=\"\"/>\n", avatar); |
| 115 | s = xs_str_cat(s, s1); | 115 | s = xs_str_cat(s, s1); |
| 116 | } | 116 | } |
| 117 | 117 | ||
| @@ -1164,8 +1164,9 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local, | |||
| 1164 | 1164 | ||
| 1165 | if (n && i) { | 1165 | if (n && i) { |
| 1166 | char *u = xs_dict_get(i, "url"); | 1166 | char *u = xs_dict_get(i, "url"); |
| 1167 | xs *img = xs_fmt("<img src=\"%s\" style=\"height: 2em; vertical-align: middle;\" " | 1167 | xs *img = xs_fmt("<img loading=\"lazy\" src=\"%s\" " |
| 1168 | "loading=\"lazy\" title=\"%s\"/>", u, n); | 1168 | "style=\"height: 2em; vertical-align: middle;\" " |
| 1169 | "title=\"%s\"/>", u, n); | ||
| 1169 | 1170 | ||
| 1170 | c = xs_replace_i(c, n, img); | 1171 | c = xs_replace_i(c, n, img); |
| 1171 | } | 1172 | } |
| @@ -1341,7 +1342,7 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local, | |||
| 1341 | if (xs_startswith(t, "image/") || strcmp(t, "Image") == 0) { | 1342 | if (xs_startswith(t, "image/") || strcmp(t, "Image") == 0) { |
| 1342 | s1 = xs_fmt( | 1343 | s1 = xs_fmt( |
| 1343 | "<a href=\"%s\" target=\"_blank\">" | 1344 | "<a href=\"%s\" target=\"_blank\">" |
| 1344 | "<img src=\"%s\" alt=\"%s\" title=\"%s\" loading=\"lazy\"/></a>\n", | 1345 | "<img loading=\"lazy\" src=\"%s\" alt=\"%s\" title=\"%s\"/></a>\n", |
| 1345 | url, url, es1, es1); | 1346 | url, url, es1, es1); |
| 1346 | } | 1347 | } |
| 1347 | else | 1348 | else |