Skip to content

Commit

Permalink
fix(route/keylol): handle lazy load image (#16346)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyfong19931 authored Aug 2, 2024
1 parent 45818f4 commit e2f6c70
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/routes/keylol/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit e2f6c70

Please sign in to comment.