From 612df73968914cb83863292609bda74770d6fd0d Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Sun, 11 Dec 2022 19:44:51 +0800 Subject: [PATCH] [opt] swiper --- _config.yml | 4 ++-- scripts/tags/lib/swiper.js | 10 ++++------ source/css/_layout/md.styl | 3 +-- source/css/_plugins/swiper.styl | 11 +++++++---- source/js/main.js | 4 +++- 5 files changed, 17 insertions(+), 15 deletions(-) diff --git a/_config.yml b/_config.yml index cb19dec..e5152f7 100755 --- a/_config.yml +++ b/_config.yml @@ -288,8 +288,8 @@ plugins: # swiper swiper: enable: true - css: https://unpkg.com/swiper@6/swiper-bundle.min.css - js: https://unpkg.com/swiper@6/swiper-bundle.min.js + css: https://unpkg.com/swiper@8/swiper-bundle.min.css + js: https://unpkg.com/swiper@8/swiper-bundle.min.js # 赫蹏 (Heti) - 专为中文网页内容设计的排版样式增强 diff --git a/scripts/tags/lib/swiper.js b/scripts/tags/lib/swiper.js index e2ffd33..ba0ace5 100644 --- a/scripts/tags/lib/swiper.js +++ b/scripts/tags/lib/swiper.js @@ -2,7 +2,7 @@ * swiper.js v1 | https://github.com/xaoxuu/hexo-theme-stellar/ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来) * - * {% swiper %} + * {% swiper [width:max] [effect:cards] %} * ![img](src) * {% endswiper %} */ @@ -10,7 +10,7 @@ 'use strict' module.exports = ctx => function(args, content) { - args = ctx.args.map(args, ['width']) + args = ctx.args.map(args, ['width', 'effect']) var el = '' function slide() { let imgs = ctx.render.renderSync({text: content, engine: 'markdown'}) @@ -22,10 +22,8 @@ module.exports = ctx => function(args, content) { }) } } - el += '
0) { - el += ' ' + ctx.args.joinTags(args, 'width').join(' ') - } + el += '