🔖 2.2.5發佈

更新内容請看 https://github.com/jerryc127/hexo-theme-butterfly/releases
This commit is contained in:
Jerry
2020-03-28 03:20:36 +08:00
Unverified
parent c134d4fc86
commit 559afab632
41 changed files with 415 additions and 387 deletions

View File

@@ -1,11 +1,10 @@
'use strict';
const fs = require('hexo-fs');
const url_for = require('hexo-util').url_for.bind(hexo);
function lazyProcess(htmlContent) {
var bg = url_for(hexo.theme.config.lodding_bg.post);
return htmlContent.replace(/<img(\s*?)src="(.*?)"(.*?)>/gi, (str, p1, p2, p3) => {
return htmlContent.replace(/<img(.*?)src="(.*?)"(.*?)>/gi, (str, p1, p2, p3) => {
if (/data-src/gi.test(str)) {
return str;
}
@@ -14,10 +13,10 @@ function lazyProcess(htmlContent) {
return classStr.replace(p1, `${p1} lazyload`);
})
str = str.replace(p2, `${bg}`)
return str.replace(p3, `${p3} data-src="${p2}"`);
return str.replace('>', ` data-src="${p2}">`);
}
str = str.replace(p2, `${bg}`)
return str.replace(p3, `${p3} class="lazyload" data-src="${p2}"`);
return str.replace(p3, ` class="lazyload" data-src="${p2}" ${p3}`);
});
}

View File

@@ -89,7 +89,7 @@ hexo.extend.helper.register("list_archives", function(options = {}) {
}
if (data.length > limit) {
result += `<li class="archive-list-item">`;
result += `<li class="archive-list-item is-center">`;
result +=
`<a class="archive-list-link-more" href="` +
"/" +