This commit is contained in:
xaoxuu 2024-01-30 18:08:47 +08:00
parent a2f429a4e9
commit 48afb63f4c
3 changed files with 4 additions and 10 deletions

View File

@ -115,7 +115,7 @@ function layoutFooterDiv() {
el += ' onclick="' + item.onclick + '"'; el += ' onclick="' + item.onclick + '"';
} }
el += '>'; el += '>';
el += item.icon; el += icon(item.icon, 'no-lazy')
el += '</a>'; el += '</a>';
} }
} }

View File

@ -12,13 +12,7 @@ function layoutDiv() {
} }
el += `>` el += `>`
if (item.icon?.length > 0) { if (item.icon?.length > 0) {
if (item.icon.startsWith('<')) { el += icon(item.icon, 'no-lazy')
el += item.icon
} else if (theme.icons[item.icon]) {
el += theme.icons[item.icon]
} else {
el += `<img no-lazy src="${item.icon}">`
}
} else { } else {
el += `<span>${__(item.title)}</span>` el += `<span>${__(item.title)}</span>`
} }

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
hexo.extend.helper.register('icon', function(key) { hexo.extend.helper.register('icon', function(key, args) {
const { icons } = hexo.theme.config const { icons } = hexo.theme.config
var result = '' var result = ''
if (icons[key]) { if (icons[key]) {
@ -9,7 +9,7 @@ hexo.extend.helper.register('icon', function(key) {
result = key result = key
} }
if (result.startsWith('/') || result.startsWith('https://') || result.startsWith('http://')) { if (result.startsWith('/') || result.startsWith('https://') || result.startsWith('http://')) {
return `<img src="${result}" />` return `<img ${args?.length > 0 ? args : ''} src="${result}" />`
} else { } else {
return result return result
} }