Merge pull request #435 from chengzhongxue/main

优化懒加载
This commit is contained in:
困困鱼 2023-08-20 15:45:05 +08:00 committed by GitHub
commit aa5b2ca26b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 54 additions and 61 deletions

View File

@ -24,7 +24,6 @@
<th:block th:each="group : ${photoFinder.groupBy()}"> <th:block th:each="group : ${photoFinder.groupBy()}">
<div class="card" th:onclick="go([[${group.metadata.name}]])"> <div class="card" th:onclick="go([[${group.metadata.name}]])">
<img class="card_cover" <img class="card_cover"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : #annotations.get(group, 'cover')}" th:src="${isLazyload ? loadingImg : #annotations.get(group, 'cover')}"
th:data-lazy-src="${ isLazyload ? #annotations.get(group, 'cover') : ''}" th:data-lazy-src="${ isLazyload ? #annotations.get(group, 'cover') : ''}"
> >
@ -45,10 +44,8 @@
<th:block th:each="group : ${photoFinder.groupBy()}"> <th:block th:each="group : ${photoFinder.groupBy()}">
<figure class="gallery-group"> <figure class="gallery-group">
<img class="gallery-group-img no-lightbox" <img class="gallery-group-img no-lightbox"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : #annotations.get(group, 'cover')}" th:src="${isLazyload ? loadingImg : #annotations.get(group, 'cover')}"
th:data-lazy-src="${ isLazyload ? #annotations.get(group, 'cover') : ''}" th:data-lazy-src="${ isLazyload ? #annotations.get(group, 'cover') : ''}"
alt="Group Image Gallery"> alt="Group Image Gallery">
<figcaption> <figcaption>
<div class="gallery-group-name">[[${group.spec.displayName}]]</div> <div class="gallery-group-name">[[${group.spec.displayName}]]</div>

View File

@ -443,7 +443,10 @@ document.addEventListener('DOMContentLoaded', function () {
window.lazyLoadInstance = new LazyLoad({ window.lazyLoadInstance = new LazyLoad({
elements_selector: 'img', elements_selector: 'img',
threshold: 0, threshold: 0,
data_src: 'lazy-src' data_src: 'lazy-src',
callback_error: (img) => {
img.setAttribute("srcset", GLOBAL_CONFIG.lazyload.error);
}
}) })
} }

View File

@ -28,9 +28,10 @@
<div class="equipment-item-content-item" th:each="equipment : ${equipmentList}"> <div class="equipment-item-content-item" th:each="equipment : ${equipmentList}">
<div class="equipment-item-content-item-cover"> <div class="equipment-item-content-item-cover">
<img class="equipment-item-content-item-image entered loaded" <img class="equipment-item-content-item-image"
th:alt="${equipment.name}" th:alt="${equipment.name}"
th:src="${equipment.img}"> th:src="${isLazyload ? loadingImg : equipment.img}"
th:data-lazy-src="${ isLazyload ? equipment.img : ''}">
</div> </div>
<div class="equipment-item-content-item-info"> <div class="equipment-item-content-item-info">
<div class="equipment-item-content-item-name" <div class="equipment-item-content-item-name"

View File

@ -7,7 +7,6 @@
th:src="${isLazyload ? loadingImg : spec.cover}" th:src="${isLazyload ? loadingImg : spec.cover}"
th:data-lazy-src="${ isLazyload ? spec.cover : ''}" th:data-lazy-src="${ isLazyload ? spec.cover : ''}"
referrerpolicy="no-referrer" width="110" referrerpolicy="no-referrer" width="110"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
style="width:110px;margin:20px auto;"> style="width:110px;margin:20px auto;">
</div> </div>
<div class="bangumi-info"> <div class="bangumi-info">

View File

@ -27,7 +27,6 @@
<img th:with=" img = @{${linkOdd.spec.logo}}" <img th:with=" img = @{${linkOdd.spec.logo}}"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:title="${linkOdd.spec.displayName}"> th:title="${linkOdd.spec.displayName}">
</a> </a>
<a class="tags-group-icon" target="_blank" th:href="${linkEven.spec.url}" <a class="tags-group-icon" target="_blank" th:href="${linkEven.spec.url}"
@ -35,7 +34,6 @@
<img th:with="img = @{${linkEven.spec.logo}}" <img th:with="img = @{${linkEven.spec.logo}}"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:title="${linkEven.spec.displayName}"> th:title="${linkEven.spec.displayName}">
</a> </a>
</div> </div>
@ -96,7 +94,7 @@
<a class="img" target="_blank" th:href="${link.spec.url}" th:title="${link.spec.displayName}"> <a class="img" target="_blank" th:href="${link.spec.url}" th:title="${link.spec.displayName}">
<img class="flink-avatar" style="pointer-events: none;" th:alt="${link.spec.displayName}" <img class="flink-avatar" style="pointer-events: none;" th:alt="${link.spec.displayName}"
th:with="img = @{${#strings.isEmpty(#annotations.get(link, 'siteshot')) ? link.spec.logo : #annotations.get(link,'siteshot') }}" th:with="img = @{${#strings.isEmpty(#annotations.get(link, 'siteshot')) ? link.spec.logo : #annotations.get(link,'siteshot') }}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}"> th:data-lazy-src="${ isLazyload ? img : ''}">
</a> </a>
@ -105,7 +103,7 @@
th:title="${link.spec.displayName}"> th:title="${link.spec.displayName}">
<div class="site-card-avatar"> <div class="site-card-avatar">
<img class="flink-avatar cf-friends-avatar" th:alt="${link.spec.displayName}" <img class="flink-avatar cf-friends-avatar" th:alt="${link.spec.displayName}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : link.spec.logo}" th:src="${isLazyload ? loadingImg : link.spec.logo}"
th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}"> th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}">
</div> </div>
@ -129,14 +127,14 @@
<a class="cf-friends-link" rel="external nofollow" target="_blank" th:href="${link.spec.url}" <a class="cf-friends-link" rel="external nofollow" target="_blank" th:href="${link.spec.url}"
th:title="${link.spec.displayName}"> th:title="${link.spec.displayName}">
<img class="flink-avatar cf-friends-avatar" th:alt="${link.spec.displayName}" <img class="flink-avatar cf-friends-avatar" th:alt="${link.spec.displayName}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : link.spec.logo}" th:src="${isLazyload ? loadingImg : link.spec.logo}"
th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}"> th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}">
<div class="flink-item-info"> <div class="flink-item-info">
<span class="flink-item-name cf-friends-name" th:text="${link.spec.displayName}"></span> <span class="flink-item-name cf-friends-name" th:text="${link.spec.displayName}"></span>
<span class="flink-item-desc" th:text="${link.spec.description}" <span class="flink-item-desc" th:text="${link.spec.description}"
th:title="${link.spec.description}"></span> th:title="${link.spec.description}"></span>
<img th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''" <img
th:src="${isLazyload ? loadingImg : link.spec.logo}" th:src="${isLazyload ? loadingImg : link.spec.logo}"
th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}"> th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}">
</div> </div>
@ -150,7 +148,7 @@
<a class="cf-friends-link" rel="external nofollow" target="_blank" th:href="${link.spec.url}" <a class="cf-friends-link" rel="external nofollow" target="_blank" th:href="${link.spec.url}"
th:title="${link.spec.displayName}"> th:title="${link.spec.displayName}">
<img class="flink-avatar cf-friends-avatar" <img class="flink-avatar cf-friends-avatar"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : link.spec.logo}" th:src="${isLazyload ? loadingImg : link.spec.logo}"
th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}" th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}"
th:alt="${link.spec.displayName}"> th:alt="${link.spec.displayName}">

View File

@ -195,7 +195,7 @@
postUpdate: '2022-11-04 20:08:15', postUpdate: '2022-11-04 20:08:15',
copyright: undefined, copyright: undefined,
lightbox: 'fancybox', lightbox: 'fancybox',
lazyload: {enable: [[${theme.config.other.vanillaLazyload.enable}]], error: "/themes/theme-hao/assets/images/404.gif"}, lazyload: {enable: [[${theme.config.other.vanillaLazyload.enable}]], error: [[@{${theme.config.other.vanillaLazyload.errorImg}}]] },
isFriendLinksInFooter: [[${theme.config.footer.footer_group.enable_footer_group}]], isFriendLinksInFooter: [[${theme.config.footer.footer_group.enable_footer_group}]],
loadingBox: [[${theme.config.other.loadingBoxs.loadingBoxEnable}]], loadingBox: [[${theme.config.other.loadingBoxs.loadingBoxEnable}]],
loadProgressBar: [[${theme.config.other.loadingBoxs.loadProgressBar}]], loadProgressBar: [[${theme.config.other.loadingBoxs.loadProgressBar}]],

View File

@ -4,7 +4,6 @@
theme.config.other.staticResource.use == 'cbd' ? 'https://cdn.cbd.int/hao-theme-static@' + theme.spec.version +'/templates/assets' : theme.config.other.staticResource.use == 'cbd' ? 'https://cdn.cbd.int/hao-theme-static@' + theme.spec.version +'/templates/assets' :
theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')}, theme.config.other.staticResource.use == 'custom' ? theme.config.other.staticResource.cdn_link : #theme.assets('/')},
theme_version = ${ theme.config.other.staticResource.use == 'local' ? '?v='+ theme.spec.version : ''}, theme_version = ${ theme.config.other.staticResource.use == 'local' ? '?v='+ theme.spec.version : ''},
errorImg = @{${theme.config.other.vanillaLazyload.errorImg}},
isLazyload = ${theme.config.other.vanillaLazyload.enable}, isLazyload = ${theme.config.other.vanillaLazyload.enable},
loadingImg = ${theme.config.other.vanillaLazyload.loadingImg}"> loadingImg = ${theme.config.other.vanillaLazyload.loadingImg}">

View File

@ -18,7 +18,6 @@
<img class="post_bg" <img class="post_bg"
th:with='img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+","+post.spec.title : post.spec.cover}' th:with='img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+","+post.spec.title : post.spec.cover}'
th:alt="${post.spec.title}" th:alt="${post.spec.title}"
th:attr="onerror='this.onerror=null;this.src=\''+@{${errorImg}}+'\''"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
th:src="${isLazyload ? loadingImg : img}"> th:src="${isLazyload ? loadingImg : img}">
</a> </a>

View File

@ -18,7 +18,6 @@ containsTitle = ${#strings.contains(recommandPosts,post.spec.title)}">
<a th:href="@{${recommandPost.status.permalink}}" th:title="${recommandPost.spec.title}"> <a th:href="@{${recommandPost.status.permalink}}" th:title="${recommandPost.spec.title}">
<img alt="cover" class="cover" id="preimg" <img alt="cover" class="cover" id="preimg"
th:with="img = ${#strings.isEmpty(recommandPost.spec.cover) ? theme.config.layout.postRandomImg : recommandPost.spec.cover}" th:with="img = ${#strings.isEmpty(recommandPost.spec.cover) ? theme.config.layout.postRandomImg : recommandPost.spec.cover}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}"> th:data-lazy-src="${ isLazyload ? img : ''}">
<div class="content is-center"> <div class="content is-center">
@ -39,7 +38,7 @@ containsTitle = ${#strings.contains(recommandPosts,post.spec.title)}">
<a th:href="@{${recommandPost.status.permalink}}" th:title="${recommandPost.spec.title}"> <a th:href="@{${recommandPost.status.permalink}}" th:title="${recommandPost.spec.title}">
<img class="cover" alt="cover" <img class="cover" alt="cover"
th:with="img = ${#strings.isEmpty(recommandPost.spec.cover) ? theme.config.layout.postRandomImg : recommandPost.spec.cover}" th:with="img = ${#strings.isEmpty(recommandPost.spec.cover) ? theme.config.layout.postRandomImg : recommandPost.spec.cover}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}"> th:data-lazy-src="${ isLazyload ? img : ''}">
<div class="content is-center"> <div class="content is-center">

View File

@ -40,7 +40,7 @@
rel="external nofollow noreferrer" target="_blank" th:title="${comic.title}" draggable="false"> rel="external nofollow noreferrer" target="_blank" th:title="${comic.title}" draggable="false">
<div class="comic-item-cover"><img <div class="comic-item-cover"><img
th:with="img = @{${comic.bg}}" th:with="img = @{${comic.bg}}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
th:alt="${comic.title}" th:alt="${comic.title}"

View File

@ -17,7 +17,7 @@
<a th:each="link : ${group.links}" <a th:each="link : ${group.links}"
class="card-friend-item online-friend-link" th:href="${link.spec.url}" th:title="${link.spec.displayName}" class="card-friend-item online-friend-link" th:href="${link.spec.url}" th:title="${link.spec.displayName}"
target="_blank"><img class="no-lightbox card-friend-avatar" target="_blank"><img class="no-lightbox card-friend-avatar"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : link.spec.logo}" th:src="${isLazyload ? loadingImg : link.spec.logo}"
th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}" th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}"
th:alt="${link.spec.displayName}"> th:alt="${link.spec.displayName}">
@ -36,7 +36,7 @@
<a th:each="link : ${group.links}" <a th:each="link : ${group.links}"
class="card-friend-item offline-friend-link" th:href="${link.spec.url}" th:title="${link.spec.displayName}" class="card-friend-item offline-friend-link" th:href="${link.spec.url}" th:title="${link.spec.displayName}"
target="_blank"><img class="no-lightbox card-friend-avatar" target="_blank"><img class="no-lightbox card-friend-avatar"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : link.spec.logo}" th:src="${isLazyload ? loadingImg : link.spec.logo}"
th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}" th:data-lazy-src="${ isLazyload ? link.spec.logo : ''}"
th:alt="${link.spec.displayName}"> th:alt="${link.spec.displayName}">

View File

@ -14,7 +14,7 @@
</div> </div>
<img class="avatar-img" <img class="avatar-img"
th:with=" img = @{${#strings.isEmpty(site.logo) ? assets_link + '/images/hao-logo.jpg' : site.logo}}" th:with=" img = @{${#strings.isEmpty(site.logo) ? assets_link + '/images/hao-logo.jpg' : site.logo}}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}"> th:data-lazy-src="${ isLazyload ? img : ''}">
</div> </div>
@ -146,13 +146,13 @@
<div class="avatar-img-group"> <div class="avatar-img-group">
<img class="avatar-img" alt="avatar" <img class="avatar-img" alt="avatar"
th:with="img = @{${#strings.isEmpty(site.logo) ? assets_link + '/images/hao-logo.jpg' : site.logo}}" th:with="img = @{${#strings.isEmpty(site.logo) ? assets_link + '/images/hao-logo.jpg' : site.logo}}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}"> th:data-lazy-src="${ isLazyload ? img : ''}">
<div class="avatar-sticker"> <div class="avatar-sticker">
<img class="avatar-sticker-img" alt="avatar" <img class="avatar-sticker-img" alt="avatar"
th:with="img = @{${theme.config.sidebar.profile.stickerImg}}" th:with="img = @{${theme.config.sidebar.profile.stickerImg}}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}"> th:data-lazy-src="${ isLazyload ? img : ''}">
</div> </div>

View File

@ -9,7 +9,7 @@
<a class="thumbnail" th:href="@{${post.status.permalink}}" th:title="${post.spec.title}"> <a class="thumbnail" th:href="@{${post.status.permalink}}" th:title="${post.spec.title}">
<img th:alt="${post.spec.title}" <img th:alt="${post.spec.title}"
th:with="img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}" th:with="img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+post.spec.title : post.spec.cover}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}"> th:data-lazy-src="${ isLazyload ? img : ''}">
</a> </a>

View File

@ -21,7 +21,7 @@
<div class="tags-group-icon" style="background:#989bf8"> <div class="tags-group-icon" style="background:#989bf8">
<img <img
th:with=" img = ${assets_link + '/images/icons/AfterEffect.png'}" th:with=" img = ${assets_link + '/images/icons/AfterEffect.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="AfterEffect"> title="AfterEffect">
@ -29,7 +29,7 @@
<div class="tags-group-icon" style="background:#fff"> <div class="tags-group-icon" style="background:#fff">
<img <img
th:with=" img = ${assets_link + '/images/icons/Sketch.png'}" th:with=" img = ${assets_link + '/images/icons/Sketch.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Sketch"> title="Sketch">
@ -39,7 +39,7 @@
<div class="tags-group-icon" style="background:#57b6e6"> <div class="tags-group-icon" style="background:#57b6e6">
<img <img
th:with=" img = ${assets_link + '/images/icons/Docker.png'}" th:with=" img = ${assets_link + '/images/icons/Docker.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Docker"> title="Docker">
@ -47,7 +47,7 @@
<div class="tags-group-icon" style="background:#4082c3"> <div class="tags-group-icon" style="background:#4082c3">
<img <img
th:with=" img = ${assets_link + '/images/icons/Photoshop.png'}" th:with=" img = ${assets_link + '/images/icons/Photoshop.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Photoshop"> title="Photoshop">
@ -57,7 +57,7 @@
<div class="tags-group-icon" style="background:#fff"> <div class="tags-group-icon" style="background:#fff">
<img <img
th:with=" img = ${assets_link + '/images/icons/FinalCutPro.png'}" th:with=" img = ${assets_link + '/images/icons/FinalCutPro.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="FinalCutPro"> title="FinalCutPro">
@ -65,7 +65,7 @@
<div class="tags-group-icon" style="background:#fff"> <div class="tags-group-icon" style="background:#fff">
<img <img
th:with=" img = ${assets_link + '/images/icons/Python.png'}" th:with=" img = ${assets_link + '/images/icons/Python.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Python"> title="Python">
@ -75,7 +75,7 @@
<div class="tags-group-icon" style="background:#eb6840"> <div class="tags-group-icon" style="background:#eb6840">
<img <img
th:with=" img = ${assets_link + '/images/icons/Swift.png'}" th:with=" img = ${assets_link + '/images/icons/Swift.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Swift"> title="Swift">
@ -83,7 +83,7 @@
<div class="tags-group-icon" style="background:#8f55ba"> <div class="tags-group-icon" style="background:#8f55ba">
<img <img
th:with=" img = ${assets_link + '/images/icons/Principle.png'}" th:with=" img = ${assets_link + '/images/icons/Principle.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Principle"> title="Principle">
@ -93,7 +93,7 @@
<div class="tags-group-icon" style="background:#f29e39"> <div class="tags-group-icon" style="background:#f29e39">
<img <img
th:with=" img = ${assets_link + '/images/icons/illustrator.png'}" th:with=" img = ${assets_link + '/images/icons/illustrator.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="illustrator"> title="illustrator">
@ -101,7 +101,7 @@
<div class="tags-group-icon" style="background:#2c51db"> <div class="tags-group-icon" style="background:#2c51db">
<img <img
th:with=" img = ${assets_link + '/images/icons/CSS3.png'}" th:with=" img = ${assets_link + '/images/icons/CSS3.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="CSS3"> title="CSS3">
@ -111,7 +111,7 @@
<div class="tags-group-icon" style="background:#f7cb4f"> <div class="tags-group-icon" style="background:#f7cb4f">
<img <img
th:with=" img = ${assets_link + '/images/icons/JS.png'}" th:with=" img = ${assets_link + '/images/icons/JS.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="JS"> title="JS">
@ -119,7 +119,7 @@
<div class="tags-group-icon" style="background:#e9572b"> <div class="tags-group-icon" style="background:#e9572b">
<img <img
th:with=" img = ${assets_link + '/images/icons/HTML.png'}" th:with=" img = ${assets_link + '/images/icons/HTML.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="HTML"> title="HTML">
@ -129,7 +129,7 @@
<div class="tags-group-icon" style="background:#df5b40"> <div class="tags-group-icon" style="background:#df5b40">
<img <img
th:with=" img = ${assets_link + '/images/icons/Git.webp'}" th:with=" img = ${assets_link + '/images/icons/Git.webp'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Git"> title="Git">
@ -137,7 +137,7 @@
<div class="tags-group-icon" style="background:#e65164"> <div class="tags-group-icon" style="background:#e65164">
<img <img
th:with=" img = ${assets_link + '/images/icons/Apifox.webp'}" th:with=" img = ${assets_link + '/images/icons/Apifox.webp'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Apifox"> title="Apifox">
@ -147,7 +147,7 @@
<div class="tags-group-icon" style="background:#989bf8"> <div class="tags-group-icon" style="background:#989bf8">
<img <img
th:with=" img = ${assets_link + '/images/icons/AfterEffect.png'}" th:with=" img = ${assets_link + '/images/icons/AfterEffect.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="AfterEffect"> title="AfterEffect">
@ -155,7 +155,7 @@
<div class="tags-group-icon" style="background:#fff"> <div class="tags-group-icon" style="background:#fff">
<img <img
th:with=" img = ${assets_link + '/images/icons/Sketch.png'}" th:with=" img = ${assets_link + '/images/icons/Sketch.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Sketch"> title="Sketch">
@ -165,7 +165,7 @@
<div class="tags-group-icon" style="background:#57b6e6"> <div class="tags-group-icon" style="background:#57b6e6">
<img <img
th:with=" img = ${assets_link + '/images/icons/Docker.png'}" th:with=" img = ${assets_link + '/images/icons/Docker.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Docker"> title="Docker">
@ -173,7 +173,7 @@
<div class="tags-group-icon" style="background:#4082c3"> <div class="tags-group-icon" style="background:#4082c3">
<img <img
th:with=" img = ${assets_link + '/images/icons/Photoshop.png'}" th:with=" img = ${assets_link + '/images/icons/Photoshop.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Photoshop"> title="Photoshop">
@ -183,7 +183,7 @@
<div class="tags-group-icon" style="background:#fff"> <div class="tags-group-icon" style="background:#fff">
<img <img
th:with=" img = ${assets_link + '/images/icons/FinalCutPro.png'}" th:with=" img = ${assets_link + '/images/icons/FinalCutPro.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="FinalCutPro"> title="FinalCutPro">
@ -191,7 +191,7 @@
<div class="tags-group-icon" style="background:#fff"> <div class="tags-group-icon" style="background:#fff">
<img <img
th:with=" img = ${assets_link + '/images/icons/Python.png'}" th:with=" img = ${assets_link + '/images/icons/Python.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Python"> title="Python">
@ -201,7 +201,7 @@
<div class="tags-group-icon" style="background:#eb6840"> <div class="tags-group-icon" style="background:#eb6840">
<img <img
th:with=" img = ${assets_link + '/images/icons/Swift.png'}" th:with=" img = ${assets_link + '/images/icons/Swift.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Swift"> title="Swift">
@ -209,7 +209,7 @@
<div class="tags-group-icon" style="background:#8f55ba"> <div class="tags-group-icon" style="background:#8f55ba">
<img <img
th:with=" img = ${assets_link + '/images/icons/Principle.png'}" th:with=" img = ${assets_link + '/images/icons/Principle.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Principle"> title="Principle">
@ -219,7 +219,7 @@
<div class="tags-group-icon" style="background:#f29e39"> <div class="tags-group-icon" style="background:#f29e39">
<img <img
th:with=" img = ${assets_link + '/images/icons/illustrator.png'}" th:with=" img = ${assets_link + '/images/icons/illustrator.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="illustrator"> title="illustrator">
@ -227,7 +227,7 @@
<div class="tags-group-icon" style="background:#2c51db"> <div class="tags-group-icon" style="background:#2c51db">
<img <img
th:with=" img = ${assets_link + '/images/icons/CSS3.png'}" th:with=" img = ${assets_link + '/images/icons/CSS3.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="CSS3"> title="CSS3">
@ -237,7 +237,7 @@
<div class="tags-group-icon" style="background:#f7cb4f"> <div class="tags-group-icon" style="background:#f7cb4f">
<img <img
th:with=" img = ${assets_link + '/images/icons/JS.png'}" th:with=" img = ${assets_link + '/images/icons/JS.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="JS"> title="JS">
@ -245,7 +245,7 @@
<div class="tags-group-icon" style="background:#e9572b"> <div class="tags-group-icon" style="background:#e9572b">
<img <img
th:with=" img = ${assets_link + '/images/icons/HTML.png'}" th:with=" img = ${assets_link + '/images/icons/HTML.png'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="HTML"> title="HTML">
@ -255,7 +255,7 @@
<div class="tags-group-icon" style="background:#df5b40"> <div class="tags-group-icon" style="background:#df5b40">
<img <img
th:with=" img = ${assets_link + '/images/icons/Git.webp'}" th:with=" img = ${assets_link + '/images/icons/Git.webp'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Git"> title="Git">
@ -263,7 +263,7 @@
<div class="tags-group-icon" style="background:#e65164"> <div class="tags-group-icon" style="background:#e65164">
<img <img
th:with=" img = ${assets_link + '/images/icons/Apifox.webp'}" th:with=" img = ${assets_link + '/images/icons/Apifox.webp'}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
title="Apifox"> title="Apifox">
@ -282,7 +282,7 @@
th:with="techOdd = ${techs.get(iterStat.index - 1)}"> th:with="techOdd = ${techs.get(iterStat.index - 1)}">
<img <img
th:with=" img = @{${techOdd.url}}" th:with=" img = @{${techOdd.url}}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
th:title="${techOdd.name}"> th:title="${techOdd.name}">
@ -293,7 +293,7 @@
th:with="techEven = ${tech}"> th:with="techEven = ${tech}">
<img <img
th:with=" img = @{${techEven.url}}" th:with=" img = @{${techEven.url}}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
th:title="${techEven.name}"> th:title="${techEven.name}">

View File

@ -16,7 +16,7 @@
<img class="post_bg" <img class="post_bg"
th:with=' img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+","+post.spec.title : post.spec.cover}' th:with=' img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+","+post.spec.title : post.spec.cover}'
th:alt="${post.spec.title}" th:alt="${post.spec.title}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"
@ -43,7 +43,7 @@
<img class="post_bg" <img class="post_bg"
th:with='img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+","+post.spec.title : post.spec.cover}' th:with='img = ${#strings.isEmpty(post.spec.cover) ? postRandomImg+","+post.spec.title : post.spec.cover}'
th:alt="${post.spec.title}" th:alt="${post.spec.title}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:data-lazy-src="${ isLazyload ? img : ''}" th:data-lazy-src="${ isLazyload ? img : ''}"

View File

@ -34,7 +34,6 @@
th:if="${momentItem.type.name == 'PHOTO'}" th:if="${momentItem.type.name == 'PHOTO'}"
th:src="${isLazyload ? loadingImg : momentItem.url}" th:src="${isLazyload ? loadingImg : momentItem.url}"
th:data-lazy-src="${ isLazyload ? momentItem.url : ''}" th:data-lazy-src="${ isLazyload ? momentItem.url : ''}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
title="瞬间配图"> title="瞬间配图">
<div class="bber-content-noimg"></div> <div class="bber-content-noimg"></div>
<div class="bber-content-noimg"></div> <div class="bber-content-noimg"></div>

View File

@ -126,7 +126,7 @@
<img alt="cover" id="preimg" class="nolazyload" <img alt="cover" id="preimg" class="nolazyload"
th:with="img = ${#strings.isEmpty(postCursor.previous.spec.cover) ? theme.config.layout.postRandomImg : postCursor.previous.spec.cover}" th:with="img = ${#strings.isEmpty(postCursor.previous.spec.cover) ? theme.config.layout.postRandomImg : postCursor.previous.spec.cover}"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:data-lazy-src="${ isLazyload ? img : ''}"> th:data-lazy-src="${ isLazyload ? img : ''}">
<div class="pagination-info"> <div class="pagination-info">
<div class="label">上一篇</div> <div class="label">上一篇</div>
@ -139,7 +139,6 @@
<img alt="cover" id="preimg" class="nolazyload" <img alt="cover" id="preimg" class="nolazyload"
th:with="img = ${#strings.isEmpty(postCursor.next.spec.cover) ? theme.config.layout.postRandomImg : postCursor.next.spec.cover}" th:with="img = ${#strings.isEmpty(postCursor.next.spec.cover) ? theme.config.layout.postRandomImg : postCursor.next.spec.cover}"
th:src="${isLazyload ? loadingImg : img}" th:src="${isLazyload ? loadingImg : img}"
th:attr="onerror='this.onerror=null;this.src=\''+${errorImg}+'\''"
th:data-lazy-src="${ isLazyload ? img : ''}"> th:data-lazy-src="${ isLazyload ? img : ''}">
<div class="pagination-info"> <div class="pagination-info">
<div class="label">下一篇</div> <div class="label">下一篇</div>