diff --git a/_config.yml b/_config.yml index 3516866..f52c7a1 100755 --- a/_config.yml +++ b/_config.yml @@ -333,7 +333,7 @@ plugins: # 可以处理评论区的图片(不支持 iframe 类评论系统)例如: # 使用twikoo评论可以写: .tk-content img:not([class*="emo"]) # 使用waline评论可以写: #waline_container .vcontent img - selector: .swiper-slide img, .gallery img # 多个选择器用英文逗号隔开 + selector: .fancybox img # 多个选择器用英文逗号隔开 # swiper swiper: diff --git a/scripts/tags/index.js b/scripts/tags/index.js index b313f71..3c3f7f7 100644 --- a/scripts/tags/index.js +++ b/scripts/tags/index.js @@ -16,6 +16,7 @@ hexo.extend.tag.register('banner', require('./lib/banner')(hexo), true) // data hexo.extend.tag.register('users', require('./lib/friends')(hexo)) hexo.extend.tag.register('friends', require('./lib/friends')(hexo)) +hexo.extend.tag.register('albums', require('./lib/albums')(hexo)) hexo.extend.tag.register('sites', require('./lib/sites')(hexo)) hexo.extend.tag.register('ghcard', require('./lib/ghcard')(hexo)) hexo.extend.tag.register('toc', require('./lib/toc')(hexo)) diff --git a/scripts/tags/lib/albums.js b/scripts/tags/lib/albums.js new file mode 100644 index 0000000..ef426d2 --- /dev/null +++ b/scripts/tags/lib/albums.js @@ -0,0 +1,47 @@ +/** + * albums.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/ + * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来) + * + * {% albums [group] [repo:owner/repo] [api:http] [size:s/m/l/xl/mix] %} + */ + +'use strict' + +module.exports = ctx => function(args) { + var args = ctx.args.map(args, ['repo', 'api', 'size'], ['group']) + if (args.size == null) { + args.size = 's' + } + var api + if (args.api) { + api = args.api + } else if (args.repo) { + api = 'https://api.vlts.cc/output_data/v2/' + args.repo + } + + var el = '' + el += `
` + if (api) { + el += `
` + } else if (args.group) { + const links = ctx.theme.config.links || {} + el += `` + } + el += `
` + return el +} diff --git a/scripts/tags/lib/friends.js b/scripts/tags/lib/friends.js index 671e142..eb09bf4 100644 --- a/scripts/tags/lib/friends.js +++ b/scripts/tags/lib/friends.js @@ -9,10 +9,6 @@ module.exports = ctx => function(args) { args = ctx.args.map(args, ['repo', 'api'], ['group']) - var links = ctx.theme.config.links - if (links == undefined) { - links = {} - } var api if (args.api) { api = args.api @@ -22,29 +18,22 @@ module.exports = ctx => function(args) { var el = '
' if (api) { - el += '
` } else if (args.group) { - function cell(item) { - if (item.url && item.title) { - var cell = '
' - cell += '' - cell += '' - cell += '
' + item.title + '
' - cell += '
' - return cell - } else { - return '' + const links = ctx.theme.config.links || {} + el += '
' + for (let item of (links[args.group] || [])) { + if (item?.url && item?.title) { + el += `` } } - el += '
' - const items = links[args.group] || [] - items.forEach((item, i) => { - el += cell(item) - }) el += '
' } diff --git a/scripts/tags/lib/gallery.js b/scripts/tags/lib/gallery.js index 999c1cd..6cbf551 100644 --- a/scripts/tags/lib/gallery.js +++ b/scripts/tags/lib/gallery.js @@ -33,9 +33,6 @@ function img(src, alt) { module.exports = ctx => function(args, content) { args = ctx.args.map(args, ['layout', 'size', 'ratio']) - if (args.layout == null) { - args.layout = ctx.theme.config.tag_plugins.gallery.layout - } if (args.size == null) { args.size = ctx.theme.config.tag_plugins.gallery.size } @@ -43,14 +40,18 @@ module.exports = ctx => function(args, content) { args.ratio = ctx.theme.config.tag_plugins.gallery.ratio } var el = '' - el += `