Time to try fetchPriority=low

This commit is contained in:
Lim Chee Aun 2024-10-11 02:11:08 +08:00
parent edd34a5cfe
commit 48537742a2
5 changed files with 32 additions and 28 deletions

View file

@ -50,6 +50,7 @@ function Avatar({ url, size, alt = '', squircle, ...props }) {
alt={alt}
loading="lazy"
decoding="async"
fetchPriority="low"
crossOrigin={
alphaCache[url] === undefined && !isMissing
? 'anonymous'

View file

@ -13,6 +13,7 @@ export default function CustomEmoji({ staticUrl, alt, url }) {
height="16"
loading="lazy"
decoding="async"
fetchPriority="low"
/>
</picture>
);

View file

@ -2788,6 +2788,8 @@ function Card({ card, selfReferential, selfAuthor, instance }) {
width={width}
height={height}
loading="lazy"
decoding="async"
fetchPriority="low"
alt={imageDescription || ''}
onError={(e) => {
try {

54
src/locales/en.po generated
View file

@ -289,7 +289,7 @@ msgstr ""
#: src/components/account-info.jsx:1308
#: src/components/shortcuts-settings.jsx:1056
#: src/components/status.jsx:1152
#: src/components/status.jsx:3217
#: src/components/status.jsx:3219
msgid "Copy"
msgstr ""
@ -417,9 +417,9 @@ msgstr ""
#: src/components/shortcuts-settings.jsx:227
#: src/components/shortcuts-settings.jsx:580
#: src/components/shortcuts-settings.jsx:780
#: src/components/status.jsx:2942
#: src/components/status.jsx:3181
#: src/components/status.jsx:3679
#: src/components/status.jsx:2944
#: src/components/status.jsx:3183
#: src/components/status.jsx:3681
#: src/pages/accounts.jsx:36
#: src/pages/catchup.jsx:1581
#: src/pages/filters.jsx:224
@ -1207,9 +1207,9 @@ msgid "Filtered: {filterTitleStr}"
msgstr ""
#: src/components/media-post.jsx:133
#: src/components/status.jsx:3509
#: src/components/status.jsx:3605
#: src/components/status.jsx:3683
#: src/components/status.jsx:3511
#: src/components/status.jsx:3607
#: src/components/status.jsx:3685
#: src/components/timeline.jsx:973
#: src/pages/catchup.jsx:75
#: src/pages/catchup.jsx:1876
@ -2094,7 +2094,7 @@ msgid "Edited: {editedDateText}"
msgstr ""
#: src/components/status.jsx:1187
#: src/components/status.jsx:3186
#: src/components/status.jsx:3188
msgid "Embed post"
msgstr ""
@ -2223,77 +2223,77 @@ msgstr ""
msgid "More from <0/>"
msgstr "More from <0/>"
#: src/components/status.jsx:2947
#: src/components/status.jsx:2949
msgid "Edit History"
msgstr ""
#: src/components/status.jsx:2951
#: src/components/status.jsx:2953
msgid "Failed to load history"
msgstr ""
#: src/components/status.jsx:2956
#: src/components/status.jsx:2958
msgid "Loading…"
msgstr ""
#: src/components/status.jsx:3191
#: src/components/status.jsx:3193
msgid "HTML Code"
msgstr ""
#: src/components/status.jsx:3208
#: src/components/status.jsx:3210
msgid "HTML code copied"
msgstr ""
#: src/components/status.jsx:3211
#: src/components/status.jsx:3213
msgid "Unable to copy HTML code"
msgstr ""
#: src/components/status.jsx:3223
#: src/components/status.jsx:3225
msgid "Media attachments:"
msgstr ""
#: src/components/status.jsx:3245
#: src/components/status.jsx:3247
msgid "Account Emojis:"
msgstr ""
#: src/components/status.jsx:3276
#: src/components/status.jsx:3321
#: src/components/status.jsx:3278
#: src/components/status.jsx:3323
msgid "static URL"
msgstr ""
#: src/components/status.jsx:3290
#: src/components/status.jsx:3292
msgid "Emojis:"
msgstr ""
#: src/components/status.jsx:3335
#: src/components/status.jsx:3337
msgid "Notes:"
msgstr ""
#: src/components/status.jsx:3339
#: src/components/status.jsx:3341
msgid "This is static, unstyled and scriptless. You may need to apply your own styles and edit as needed."
msgstr ""
#: src/components/status.jsx:3345
#: src/components/status.jsx:3347
msgid "Polls are not interactive, becomes a list with vote counts."
msgstr ""
#: src/components/status.jsx:3350
#: src/components/status.jsx:3352
msgid "Media attachments can be images, videos, audios or any file types."
msgstr ""
#: src/components/status.jsx:3356
#: src/components/status.jsx:3358
msgid "Post could be edited or deleted later."
msgstr ""
#: src/components/status.jsx:3362
#: src/components/status.jsx:3364
msgid "Preview"
msgstr ""
#: src/components/status.jsx:3371
#: src/components/status.jsx:3373
msgid "Note: This preview is lightly styled."
msgstr ""
#. [Name] [Visibility icon] boosted
#: src/components/status.jsx:3613
#: src/components/status.jsx:3615
msgid "<0/> <1/> boosted"
msgstr ""

View file

@ -8,7 +8,7 @@ function emojifyText(text, emojis = []) {
const { shortcode, staticUrl, url } = emoji;
text = text.replace(
new RegExp(`:${shortcode}:`, 'g'),
`<picture><source srcset="${staticUrl}" media="(prefers-reduced-motion: reduce)"></source><img class="shortcode-emoji emoji" src="${url}" alt=":${shortcode}:" width="16" height="16" loading="lazy" decoding="async" /></picture>`,
`<picture><source srcset="${staticUrl}" media="(prefers-reduced-motion: reduce)"></source><img class="shortcode-emoji emoji" src="${url}" alt=":${shortcode}:" width="16" height="16" loading="lazy" decoding="async" fetchPriority="low" /></picture>`,
);
});
// console.log(text, emojis);