feat: twikoo 增加 option 配置

feat: aside widget 增加排序(只對page頁和sticky內的有效)
feat: aside 增加自定義 widget
improvement: readmode 優化
improvement: html結構優化
This commit is contained in:
Jerry
2020-12-24 01:29:09 +08:00
Unverified
parent 25cf081250
commit d5d5681981
25 changed files with 242 additions and 169 deletions

View File

@@ -157,8 +157,8 @@ if $site-name-font
#site-title,
#site-subtitle,
#site-name,
#aside_content .author-info__name,
#aside_content .author-info__description
#aside-content .author-info__name,
#aside-content .author-info__description
font-family: $site-name-font
.is-center

View File

@@ -1,4 +1,4 @@
#aside_content
#aside-content
width: 25%
+minWidth900()
@@ -20,6 +20,7 @@
position: relative
overflow: hidden
margin-top: 1rem
padding: 1rem 1.2rem
border-radius: 8px
background: var(--card-bg)
box-shadow: 0 4px 8px 6px rgba(7, 17, 27, .06)
@@ -96,9 +97,6 @@
span
padding-left: .5rem
.card-content
padding: 1rem 1.2rem
.item-headline
padding-bottom: .3rem
font-size: 1.2em
@@ -353,8 +351,37 @@
.layout
justify-content: center
> .aside_content
> .aside-content
display: none
> div:first-child
width: 80%
width: 80%
.page
.sticky_layout
display: flex
flex-direction: column
if hexo-config('aside.card_recent_post.sort_order')
.card-recent-post
order: hexo-config('aside.card_recent_post.sort_order')
if hexo-config('newest_comments.sort_order')
#card-newest-comments
order: hexo-config('newest_comments.sort_order')
if hexo-config('aside.card_categories.sort_order')
.card-categories
order: hexo-config('aside.card_categories.sort_order')
if hexo-config('aside.card_tags.sort_order')
.card-tags
order: hexo-config('aside.card_tags.sort_order')
if hexo-config('aside.card_archives.sort_order')
.card-archives
order: hexo-config('aside.card-archives.sort_order')
if hexo-config('aside.card_webinfo.sort_order')
.card-webinfo
order: hexo-config('aside.card_webinfo.sort_order')

View File

@@ -110,7 +110,7 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
.ads-wrap
filter: brightness(.8)
#aside_content .aside-list > .aside-list-item:not(:last-child)
#aside-content .aside-list > .aside-list-item:not(:last-child)
border-bottom: 1px dashed alpha(#FFFFFF, .1)
//

View File

@@ -7,7 +7,10 @@ if hexo-config('readmode')
--gray: #d6dbdf
--hr-border: #d6dbdf
--hr-before-color: darken(#d6dbdf, 10)
-highlight-bg: #f7f7f7
--highlight-bg: #f7f7f7
--exit-btn-bg: #C0C0C0
--exit-btn-color: #fff
--exit-btn-hover: darken(#C0C0C0, 20)
[data-theme='dark']
.read-mode
@@ -18,12 +21,32 @@ if hexo-config('readmode')
--gray: rgba(255, 255, 255, .7)
--hr-border: rgba(255, 255, 255, .5)
--hr-before-color: rgba(255, 255, 255, .7)
-highlight-bg: #171717
--highlight-bg: #171717
--exit-btn-bg: #1f1f1f
--exit-btn-color: rgba(255, 255, 255, .9)
--exit-btn-hover: lighten(#1f1f1f, 20)
.read-mode
background: var(--readmode-light-color)
#aside_content
.exit-readmode
position: fixed
top: 30px
right: 30px
width: 40px
height: 40px
border-radius: 8px
background: var(--exit-btn-bg)
color: var(--exit-btn-color)
text-align: center
font-size: 16px
cursor: pointer
transition: background .3s
&:hover
background: var(--exit-btn-hover)
#aside-content
display: none
#body-wrap
@@ -54,22 +77,13 @@ if hexo-config('readmode')
.highlight-tools,
#footer,
#post > *:not(#post-info):not(.post-content),
#to_comment,
#mobile-toc-button,
#nav,
.post-outdate-notice,
#web_bg
#web_bg,
#rightside,
.no-top-img
display: none !important
if !hexo-config('chat_btn')
#chatra,
#tidio-chat-code,
#tidio-chat,
#daodream-container,
.gitter-chat-embed,
.gitter-open-chat-button
display: none !important
#article-container
a
color: #99a9bf

View File

@@ -490,7 +490,20 @@ document.addEventListener('DOMContentLoaded', function () {
*/
const rightSideFn = {
switchReadMode: () => { // read-mode
document.body.classList.toggle('read-mode')
const $body = document.body
$body.classList.add('read-mode')
const newEle = document.createElement('button')
newEle.type = 'button'
newEle.className = 'fas fa-sign-out-alt exit-readmode'
$body.appendChild(newEle)
function clickFn () {
$body.classList.remove('read-mode')
newEle.remove()
newEle.removeEventListener('click', clickFn)
}
newEle.addEventListener('click', clickFn)
},
switchDarkMode: () => { // Switch Between Light And Dark Mode
const nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'