feat: idownloadblog optimization (#4667)

This commit is contained in:
Henry Wang 2020-05-06 13:00:00 +01:00 committed by GitHub
parent 4c33e3ebe8
commit 451b05a654
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -11,7 +11,12 @@ module.exports = async (ctx) => {
const content = $('div.post-content');
content.find('.lazy-hidden').each((i, e) => {
$(e).attr('src', $(e).attr('data-src'));
$(`<img src=${$(e).attr('data-src')}>`).insertBefore(e);
$(e).remove();
});
content.find('.code-block, noscript').each((i, e) => {
$(e).remove();
});
return content.html();