FIX: Error calling LazyYT from chat when disabled (#20085)

This commit is contained in:
Jan Cernik 2023-01-30 21:19:04 -03:00 committed by GitHub
parent 33e6140179
commit bb35274984
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 13 deletions

View File

@ -34,19 +34,20 @@ export default {
}
);
}
api.decorateChatMessage(
(element) => {
element
.querySelectorAll(".lazyYT:not(.lazyYT-video-loaded)")
.forEach((iframe) => {
$(iframe).lazyYT();
});
},
{
id: "lazy-yt",
}
);
if (siteSettings.lazy_yt_enabled) {
api.decorateChatMessage(
(element) => {
element
.querySelectorAll(".lazyYT:not(.lazyYT-video-loaded)")
.forEach((iframe) => {
$(iframe).lazyYT();
});
},
{
id: "lazy-yt",
}
);
}
},
initialize(container) {