fix(route/keylol): handle lazy load image (#16346)

This commit is contained in:
Kenny Fong 2024-08-03 03:23:11 +08:00 committed by GitHub
parent 45818f4e7b
commit e2f6c70290
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 0 deletions

View File

@ -186,6 +186,17 @@ async function handler(ctx) {
function getDescription($) {
const descriptionEl = $('td.t_f');
descriptionEl.find('div.rnd_ai_pr').remove(); // remove ad image
// handle lazyload image
descriptionEl.find('img').each((_, img) => {
img = $(img);
if (img.attr('src')?.endsWith('none.gif') && img.attr('file')) {
img.attr('src', img.attr('file'));
img.removeAttr('file');
img.removeAttr('zoomfile');
}
});
return descriptionEl.length > 0 ? descriptionEl.html() : $('div.alert_info').html();
}