mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 17:40:55 +08:00
🔖 2.2.5發佈
更新内容請看 https://github.com/jerryc127/hexo-theme-butterfly/releases
This commit is contained in:
@@ -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}`);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -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="` +
|
||||
"/" +
|
||||
|
||||
Reference in New Issue
Block a user