fix lazyload

This commit is contained in:
Jerry 2020-07-17 00:51:18 +08:00
parent 898cc31c58
commit f7d57ac883
2 changed files with 4 additions and 2 deletions

View File

@ -36,7 +36,9 @@ script.
document.addEventListener('pjax:send', function () {
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) window.aplayers[i].destroy()
if (!window.aplayers[i].options.fixed) {
window.aplayers[i].destroy()
}
}
}

View File

@ -10,7 +10,7 @@ const urlFor = require('hexo-util').url_for.bind(hexo)
function lazyProcess (htmlContent) {
const bg = hexo.theme.config.lazyload.post ? urlFor(hexo.theme.config.lazyload.post) : 'data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs='
return htmlContent.replace(/(<img .*? src=)/ig, `$1 "${bg}" data-lazy-src=`)
return htmlContent.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-lazy-src=`)
}
const processPost = function (data) {