diff --git a/_config.yml b/_config.yml index 27a0bd5..d47b8b7 100755 --- a/_config.yml +++ b/_config.yml @@ -63,8 +63,6 @@ article: related_posts: enable: false max_count: 5 - placeholder_img: https://7.dusays.com/2021/02/20/76b86c0226ffd.svg - ######## Comments ######## @@ -148,5 +146,10 @@ plugins: js: https://cdn.jsdelivr.net/npm/scrollreveal@4.0.7/dist/scrollreveal.min.js distance: 8px duration: 500 # ms - interval: 50 # ms + interval: 100 # ms scale: 1 # 0.1~1 + +default: + avatar: https://7.dusays.com/2021/03/03/87519671e4837.svg + link: https://7.dusays.com/2021/02/20/8f277b4ee0ecd.svg + cover: https://7.dusays.com/2021/02/20/76b86c0226ffd.svg diff --git a/scripts/filters/lib/img_lazyload.js b/scripts/filters/lib/img_lazyload.js index 7adf3d7..5788075 100644 --- a/scripts/filters/lib/img_lazyload.js +++ b/scripts/filters/lib/img_lazyload.js @@ -27,13 +27,13 @@ function lazyProcess(htmlContent) { if (newImgTag.includes(' class="') == false) { newImgTag = newImgTag.slice(0,4) + ' class=""' + newImgTag.slice(4); } - // class 中增加 lazyload + // class 中增加 lazy newImgTag = newImgTag.replace(/(.*?) class="(.*?)" (.*?)>/gi, function(ori, before, value, after){ var newClass = value; if (newClass.length > 0) { newClass += ' '; } - newClass += 'lazyload'; + newClass += 'lazy'; if (value) { return ori.replace(value, newClass); } else { @@ -42,7 +42,7 @@ function lazyProcess(htmlContent) { }); // 加载图 const loadingImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAABGdBTUEAALGPC/xhBQAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAAaADAAQAAAABAAAAAQAAAADa6r/EAAAAC0lEQVQIHWNgAAIAAAUAAY27m/MAAAAASUVORK5CYII='; - newImgTag = newImgTag.replace(src_value, src_value + '" data-srcset="' + src_value + '" srcset="' + loadingImg); + newImgTag = newImgTag.replace(src_value, loadingImg + '" data-src="' + src_value); return newImgTag; }); } diff --git a/scripts/helpers/related_posts.js b/scripts/helpers/related_posts.js index f79b7b4..f5aeff3 100644 --- a/scripts/helpers/related_posts.js +++ b/scripts/helpers/related_posts.js @@ -26,14 +26,14 @@ hexo.extend.helper.register('popular_posts_wrapper', function(args){ function generateHTML(list){ var el = ''; - el += ''; + el += ''; - if (cfg.placeholder_img && cfg.placeholder_img.length > 0) { + if (hexo.theme.config.default.cover) { el += '
' if (list.img && list.img != "") { el += ''; } else { - el += ''; + el += ''; } el += '
'; } diff --git a/scripts/tags/friends.js b/scripts/tags/friends.js index b334b01..6420f65 100644 --- a/scripts/tags/friends.js +++ b/scripts/tags/friends.js @@ -35,7 +35,7 @@ hexo.extend.tag.register('friends', function(args) { if (friend.url && friend.title) { var cell = '
'; cell += ''; - cell += ''; + cell += ''; cell += '
' + friend.title + '
'; cell += '
' return cell; @@ -57,9 +57,6 @@ hexo.extend.tag.register('friends', function(args) { el += '
'; - cell += ''; + cell += ''; cell += '
'; - cell += ''; + cell += ''; cell += '' + site.title + ''; cell += '' + (site.description || site.url) + ''; cell += '
'; @@ -61,9 +61,6 @@ hexo.extend.tag.register('sites', function(args) { el += '
img - trans2: box-shadow filter + trans-site filter .group-body .user-card .card-link>img - trans3: box-shadow filter transform + trans-user filter else - img.lazyload - trans2pro: transform 1s opacity 0.5s + img.lazy + trans-cover opacity 0.5s &:not(.loaded) opacity: 0 - &.loaded + &.loaded,&.error opacity: 1 .group-body .site-card .card-link>img - trans2: box-shadow opacity + trans-site opacity .group-body .user-card .card-link>img - trans3: box-shadow opacity transform + trans-user opacity diff --git a/source/js/main.js b/source/js/main.js index 0562179..53809f0 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -260,7 +260,7 @@ if (stellar.plugins.lazyload) { // Set the options globally // to make LazyLoad self-initialize window.lazyLoadOptions = { - elements_selector: ".lazyload", + elements_selector: ".lazy", threshold: 0 }; // Listen to the initialization event