From 9e1fca5c12dd8ff1cc22b070a8500c3f8c626f7f Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Fri, 22 Dec 2023 10:29:45 +0800 Subject: [PATCH] [opt] ablock -> box --- _config.yml | 4 ++-- scripts/tags/index.js | 2 +- scripts/tags/lib/{ablock.js => box.js} | 6 +++--- source/css/_common/highlight.styl | 1 + source/css/_layout/tag-plugins/gallery.styl | 14 ++++++++------ 5 files changed, 15 insertions(+), 12 deletions(-) rename scripts/tags/lib/{ablock.js => box.js} (85%) diff --git a/_config.yml b/_config.yml index a38eddc..a3c4690 100755 --- a/_config.yml +++ b/_config.yml @@ -215,7 +215,7 @@ footer: ######## Tag Plugins ######## tag_plugins: - # {% ablock %} / {% note %} + # {% box %} / {% note %} note: default_color: '' # light, dark, red, orange, yellow, green, cyan, blue, purple, warning, error border: true # true / false @@ -393,7 +393,7 @@ plugins: style: darkmode: auto # auto / always / false - smooth_scroll: true # true / false + smooth_scroll: false # true / false 开启时如果目录过长可能无法准确定位 font-size: root: 16px body: .9375rem # 15px diff --git a/scripts/tags/index.js b/scripts/tags/index.js index c86eaab..b02132c 100644 --- a/scripts/tags/index.js +++ b/scripts/tags/index.js @@ -4,7 +4,7 @@ // container hexo.extend.tag.register('tabs', require('./lib/tabs')(hexo), true) -hexo.extend.tag.register('ablock', require('./lib/ablock')(hexo), true) +hexo.extend.tag.register('box', require('./lib/box')(hexo), true) hexo.extend.tag.register('about', require('./lib/about')(hexo), true) hexo.extend.tag.register('folding', require('./lib/folding')(hexo), true) hexo.extend.tag.register('folders', require('./lib/folders')(hexo), true) diff --git a/scripts/tags/lib/ablock.js b/scripts/tags/lib/box.js similarity index 85% rename from scripts/tags/lib/ablock.js rename to scripts/tags/lib/box.js index 54e4eb2..4b8e9e6 100644 --- a/scripts/tags/lib/ablock.js +++ b/scripts/tags/lib/box.js @@ -1,10 +1,10 @@ /** - * ablock.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/ + * box.js v1.0 | https://github.com/xaoxuu/hexo-theme-stellar/ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来) * - * {% ablock [color:color] [child:codeblock/tabs] title %} + * {% box [color:color] [child:codeblock/tabs] title %} * body - * {% endablock %} + * {% endbox %} */ 'use strict'; diff --git a/source/css/_common/highlight.styl b/source/css/_common/highlight.styl index 6364be3..511a84e 100644 --- a/source/css/_common/highlight.styl +++ b/source/css/_common/highlight.styl @@ -78,6 +78,7 @@ p>code:not([class]),li>code:not([class]) .gist-file border: 1px solid var(--block-border) border-radius: $border-block + overflow: hidden .gist-data border-bottom: 1px solid var(--block-border) .highlight diff --git a/source/css/_layout/tag-plugins/gallery.styl b/source/css/_layout/tag-plugins/gallery.styl index 070fdd4..c7ca0df 100644 --- a/source/css/_layout/tag-plugins/gallery.styl +++ b/source/css/_layout/tag-plugins/gallery.styl @@ -12,15 +12,16 @@ position: relative &:hover .image-meta - opacity: 1 + background: rgba(black, 0.5) + .image-caption + color: white img object-fit: cover - height: 100% + max-height: 100% overflow: hidden display: block .image-meta position: absolute - opacity: 0 z-index: 1 margin: 4px top: 0 @@ -28,17 +29,18 @@ right: 0 bottom: 0 pointer-events: none - background: rgba(black, 0.5) + background: transparent border-radius: 8px - trans1(opacity) + trans1(background) display: flex flex-direction: column justify-content: flex-end .image-caption display: block font-size: $fs-13 - color: white + color: transparent line-height: 1.2 margin: 4px + trans1(color) &:empty display: none