From 540f93eaed0e288eae540cbcda2ecf7aa2b42ac0 Mon Sep 17 00:00:00 2001 From: xaoxuu Date: Mon, 12 Dec 2022 21:07:22 +0800 Subject: [PATCH] [opt] css --- layout/_partial/plugins/comments/layout.ejs | 8 ++++---- layout/_partial/widgets/toc.ejs | 2 +- source/css/_layout/md.styl | 3 ++- source/css/_layout/partial/related.styl | 4 ++-- source/css/_plugins/aplayer.styl | 3 +++ source/css/_plugins/comments/utterances.styl | 2 +- source/css/_plugins/index.styl | 2 ++ source/js/main.js | 8 ++++---- 8 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 source/css/_plugins/aplayer.styl diff --git a/layout/_partial/plugins/comments/layout.ejs b/layout/_partial/plugins/comments/layout.ejs index a005f6e..f7dd825 100644 --- a/layout/_partial/plugins/comments/layout.ejs +++ b/layout/_partial/plugins/comments/layout.ejs @@ -32,11 +32,11 @@ page.cmt = cmt; %> <% if (loadComment) { %> <% } %> diff --git a/layout/_partial/widgets/toc.ejs b/layout/_partial/widgets/toc.ejs index 6125a98..ce9564c 100644 --- a/layout/_partial/widgets/toc.ejs +++ b/layout/_partial/widgets/toc.ejs @@ -63,7 +63,7 @@ function layoutDiv(fallback) { var el = ''; if (type.length > 0) { - el += ''; + el += ''; if (page.layout !== 'wiki') { // post 布局 el += layoutTocHeader(page.toc_title); diff --git a/source/css/_layout/md.styl b/source/css/_layout/md.styl index 92ef60a..4f8bd80 100644 --- a/source/css/_layout/md.styl +++ b/source/css/_layout/md.styl @@ -49,7 +49,8 @@ h1.article-title a.headerlink:before opacity: 1 - +.md-text.content:first-child + padding-top: 0 .md-text ul:not(:last-child), diff --git a/source/css/_layout/partial/related.styl b/source/css/_layout/partial/related.styl index 535d483..7b7e6ad 100644 --- a/source/css/_layout/partial/related.styl +++ b/source/css/_layout/partial/related.styl @@ -84,7 +84,7 @@ article.md-text.content+.related-wrap .related-wrap#comments padding: 0 1rem - div.cmt-title + .cmt-title p margin: 0 font-size: inherit @@ -95,7 +95,7 @@ article.md-text.content+.related-wrap color: $color-hover &:before display: none - div.cmt-body + .cmt-body min-height: 150px position: relative svg.loading diff --git a/source/css/_plugins/aplayer.styl b/source/css/_plugins/aplayer.styl new file mode 100644 index 0000000..bf506ee --- /dev/null +++ b/source/css/_plugins/aplayer.styl @@ -0,0 +1,3 @@ +.md-text + .aplayer + border-radius: $border-block \ No newline at end of file diff --git a/source/css/_plugins/comments/utterances.styl b/source/css/_plugins/comments/utterances.styl index 8be98f9..5789920 100644 --- a/source/css/_plugins/comments/utterances.styl +++ b/source/css/_plugins/comments/utterances.styl @@ -2,5 +2,5 @@ margin: 0 -4px width: 'calc(100% + %s)' % 8px -.related-wrap#comments div.cmt-body svg.loading +.related-wrap#comments .cmt-body svg.loading top: 62px \ No newline at end of file diff --git a/source/css/_plugins/index.styl b/source/css/_plugins/index.styl index 85ee4f2..bba960e 100644 --- a/source/css/_plugins/index.styl +++ b/source/css/_plugins/index.styl @@ -1,3 +1,5 @@ +@import 'aplayer' + // 根据主题配置加载 if hexo-config('plugins.lazyload.enable') @import 'lazyload' diff --git a/source/js/main.js b/source/js/main.js index 44cfd11..de70b93 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -111,12 +111,12 @@ const init = { } } if (topSeg) { - $(".toc#toc a.toc-link").removeClass("active") + $("#data-toc a.toc-link").removeClass("active") var link = "#" + topSeg.attr("id") if (link != '#undefined') { - $('.toc#toc a.toc-link[href="' + encodeURI(link) + '"]').addClass("active") + $('#data-toc a.toc-link[href="' + encodeURI(link) + '"]').addClass("active") } else { - $('.toc#toc a.toc-link:first').addClass("active") + $('#data-toc a.toc-link:first').addClass("active") } } }) @@ -124,7 +124,7 @@ const init = { }, sidebar: () => { stellar.jQuery(() => { - $(".toc#toc a.toc-link").click(function (e) { + $("#data-toc a.toc-link").click(function (e) { l_body.classList.remove("sidebar"); }); })