doc: update butterfly theme

This commit is contained in:
Leon Xu committed 2022-01-26 09:51:45 -08:00
1 parent 5123048924
commit eafa4afbc3
118 files changed
+2158 -2564

No files matched your search

@@ -17,6 +17,63 @@
text-rendering: auto
-webkit-font-smoothing: antialiased
// card hover
.cardHover
border-radius: 8px
background: var(--card-bg)
box-shadow: var(--card-box-shadow)
transition: all .3s
&:hover
box-shadow: var(--card-hover-box-shadow)
.imgHover
width: 100%
height: 100%
transition: filter 375ms ease-in .2s, transform .6s
object-fit: cover
&:hover
transform: scale(1.1)
.postImgHover
&:hover
img
opacity: .8
transform: scale(1.1)
img
position: absolute
width: 100%
height: 100%
opacity: .4
transition: all .6s, filter 375ms ease-in .2s
object-fit: cover
.list-beauty
list-style: none
li
position: relative
padding 0.12em 0.4em 0.12em 1.4em
&:hover
&:before
border-color: var(--pseudo-hover)
&:before
position: absolute
top: .67em
left: 0
width: w = .43em
height: h = w
border: .5 * w solid $light-blue
border-radius: w
background: transparent
content: ''
cursor: pointer
transition: all .3s ease-out
maxWidth600()
@media screen and (max-width: 600px)
{block}
@@ -60,7 +117,7 @@ if hexo-config('enter_transitions')
#site-title,
#site-subtitle
animation: titlescale 1s
animation: titleScale 1s
#nav.show
animation: headerNoOpacity 1s
@@ -123,14 +180,14 @@ if hexo-config('avatar.effect') == true
@keyframes bottom-top
0%
opacity: 0
margin-top: 50px
opacity: 0
100%
opacity: 1
margin-top: 0
opacity: 1
@keyframes titlescale
@keyframes titleScale
0%
opacity: 0
transform: scale(.7)
@@ -207,4 +264,4 @@ if hexo-config('avatar.effect') == true
transform: translateX(200px)
100%
transform: translateX(0)
transform: translateX(0)
+37 -40
View File
@@ -21,18 +21,18 @@
--btn-bg: $button-bg
--text-bg-hover: rgba($text-bg-hover, .7)
--light-grey: $light-grey
--dark-grey: $dark-grey
--white: $white
--text-highlight-color: $text-highlight-color
--blockquote-color: $blockquote-color
--blockquote-bg: $blockquote-background-color
--reward-pop: $reward-pop-up-bg
--toc-link-color: $toc-link-color
--card-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .06)
--card-hover-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .15)
html
height: 100%
font-size: 20px
--card-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .05)
--card-hover-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .09)
--pseudo-hover: $pseudo-hover
--headline-presudo: #a0a0a0
--scrollbar-color: $scrollbar-color
body
position: relative
@@ -47,16 +47,22 @@ body
if !hexo-config('copy.enable')
user-select: none
// scrollbar - chrome/safari
*::-webkit-scrollbar
width: 8px
height: 8px
*::-webkit-scrollbar-thumb
background: var(--btn-bg)
background: var(--scrollbar-color)
*::-webkit-scrollbar-track
background-color: transparent
// scrollbar - firefox
*
scrollbar-width: thin
scrollbar-color: var(--scrollbar-color) transparent
input::placeholder
color: var(--font-color)
@@ -79,7 +85,7 @@ h4,
h5,
h6
position: relative
margin: 1rem 0 .7rem
margin: 20px 0 14px
color: var(--text-highlight-color)
font-weight: bold
@@ -91,7 +97,7 @@ h6
hr
position: relative
margin: 2rem auto
margin: 40px auto
border: 2px dashed var(--hr-border)
if hexo-config('hr_icon.enable')
@@ -115,7 +121,7 @@ hr
.table-wrap
overflow-x: scroll
margin: 0 0 1rem
margin: 0 0 20px
table
display: table
@@ -129,7 +135,7 @@ table
th,
td
padding: .3rem .6rem
padding: 6px 12px
border: 1px solid var(--light-grey)
vertical-align: middle
@@ -143,6 +149,7 @@ button
border: none
background: none
cursor: pointer
touch-action: manipulation
a
color: $a-link-color
@@ -175,33 +182,7 @@ if $site-name-font
.pull-right
float: right
.button--animated
position: relative
z-index: 1
transition: color 1s
&:before
position: absolute
top: 0
right: 0
bottom: 0
left: 0
z-index: -1
background: var(--btn-hover-color)
content: ''
transition: transform .5s ease-out
transform: scaleX(0)
transform-origin: 0 50%
&:hover
&:before
transition-timing-function: cubic-bezier(.45, 1.64, .47, .66)
transform: scaleX(1)
img
max-width: 100%
transition: all .2s
&[src=''],
&:not([src])
opacity: 0
@@ -210,14 +191,30 @@ img
if hexo-config('lazyload.enable') && hexo-config('lazyload.blur') && !hexo-config('lazyload.placeholder')
img
&[data-lazy-src]:not(.loaded)
filter: blur(10px) brightness(1)
filter: blur(8px) brightness(1)
&[data-lazy-src].error
filter: none
.img-alt
margin: -.5rem 0 .5rem
margin: -10px 0 10px
color: #858585
&:hover
text-decoration: none !important
text-decoration: none !important
blockquote
margin: 0 0 20px
padding: 12px 15px
border-left: 3px solid $blockquote-padding-color
background-color: var(--blockquote-bg)
color: var(--blockquote-color)
footer
cite
&:before
padding: 0 5px
content: '—'
& > :last-child
margin-bottom: 0 !important
@@ -1,7 +1,5 @@
$highlight_theme = hexo-config('highlight_theme')
$highlighEnable = hexo-config('highlight_settings') && hexo-config('highlight_settings.enable')
$prismjsEnable = hexo-config('prismjs_settings') && hexo-config('prismjs_settings.enable')
wordWrap = !hexo-config('highlight_settings.line_number') && hexo-config('code_word_wrap')
wordWrap = $highlight_enable && !$highlight_line_number && hexo-config('code_word_wrap')
@require 'theme'
@@ -15,15 +13,15 @@ wordWrap = !hexo-config('highlight_settings.line_number') && hexo-config('code_w
--hlscrollbar-bg: $highlight-scrollbar
--hlexpand-bg: linear-gradient(180deg, rgba($highlight-background, .6), rgba($highlight-background, .9))
if $highlighEnable
if $highlight_enable
@require 'highlight/index'
if $prismjsEnable
if $prismjs_enable
@require 'prismjs/index'
$code-block
overflow: auto
margin: 0 0 1rem
margin: 0 0 20px
padding: 0
background: var(--hl-bg)
color: var(--hl-color)
@@ -33,28 +31,6 @@ $code-block
counter-reset: line
white-space: pre-wrap
blockquote
margin: 0 0 1rem
padding: .1rem .8rem
border-left: .2rem solid $blockquote-padding-color
background-color: var(--blockquote-bg)
color: var(--blockquote-color)
a
word-break: break-all
p
margin: 0 !important
padding: .5rem 0
footer
padding: 0 0 .5rem
cite
&:before
padding: 0 .3em
content: '—'
#article-container
pre,
code
@@ -62,7 +38,7 @@ blockquote
font-family: $code-font-family !important
code
padding: .1rem .2rem
padding: 2px 4px
background: $code-background
color: $code-foreground
@@ -87,7 +63,7 @@ blockquote
figcaption,
.caption
padding: .3rem 0 .1rem .7rem
padding: 6px 0 2px 14px
font-size: $code-font-size
line-height: 1em
@@ -104,7 +80,7 @@ blockquote
display: flex
align-items: center
overflow: hidden
min-height: 1.2rem
min-height: 24px
height: 2.15em
background: var(--hltools-bg)
color: var(--hltools-color)
@@ -115,12 +91,12 @@ blockquote
.expand
position: absolute
padding: .4rem .7rem
padding: .57em .7em
cursor: pointer
transition: transform .3s
& + .code-lang
left: 1.7rem
left: 1.6em
&.closed
transition: all .3s
@@ -128,7 +104,7 @@ blockquote
.code-lang
position: absolute
left: .7rem
left: 14px
text-transform: uppercase
font-weight: bold
font-size: 1.15em
@@ -136,13 +112,13 @@ blockquote
.copy-notice
position: absolute
right: 1.7rem
right: 2.1em
opacity: 0
transition: opacity .4s
.copy-button
position: absolute
right: .7rem
right: 14px
cursor: pointer
transition: color .2s
@@ -160,7 +136,7 @@ blockquote
if $highlight_theme == 'mac' || ($highlight_theme == 'mac light')
figure.highlight
margin: 0 0 1.2rem
margin: 0 0 24px
border-radius: 7px
box-shadow: 0 5px 10px 0 $highlight-mac-border
-webkit-transform: translateZ(0)
@@ -168,7 +144,7 @@ blockquote
.highlight-tools
&:after
position: absolute
left: .7rem
left: 14px
width: 12px
height: 12px
border-radius: 50%
@@ -184,13 +160,13 @@ blockquote
transform: rotate(90deg) !important
& ~ .copy-notice
right: 2.8rem
right: 3.3em
& ~ .copy-button
right: 1.8rem
right: 2.1em
.code-lang
left: 3.8rem !important
left: 75px
if hexo-config('highlight_height_limit')
.code-expand-btn
@@ -204,12 +180,17 @@ blockquote
cursor: pointer
i
padding: .3rem 0
padding: 6px 0
color: var(--hlnumber-color)
animation: code-expand-key 1.2s infinite
&.expand-done
display: none !important
& > i
transform: rotate(180deg)
& + table,
& + pre
margin-bottom: 1.8em
&:not(.expand-done)
& ~ table,
@@ -1,5 +1,7 @@
figure.highlight
table
scrollbar-color: var(--hlscrollbar-bg) transparent
&::-webkit-scrollbar-thumb
background: var(--hlscrollbar-bg)
@@ -7,8 +7,8 @@ if $highlight_theme != false
if wordWrap
&:before
display: inline-block
padding: 0 .3rem 0 0
min-width: 1.6rem
padding: 0 6px 0 0
min-width: 30px
color: var(--hlnumber-color)
content: counter(line)
counter-increment: line
@@ -27,13 +27,13 @@ if $highlight_theme != false
border: none
.gutter pre
padding-right: .5rem
padding-left: .5rem
padding-right: 10px
padding-left: 10px
background-color: var(--hlnumber-bg)
color: var(--hlnumber-color)
text-align: right
.code pre
padding-right: .5rem
padding-left: .5rem
padding-right: 10px
padding-left: 10px
width: 100%
@@ -1,4 +1,4 @@
if hexo-fonfig('prismjs_settings.line_number')
if $prismjs_line_number
@require 'line-number'
if $highlight_theme != false
@@ -6,6 +6,8 @@ if $highlight_theme != false
#article-container
pre[class*='language-']
scrollbar-color: var(--hlscrollbar-bg) transparent
&::-webkit-scrollbar-thumb
background: var(--hlscrollbar-bg)
@@ -14,7 +16,7 @@ if $highlight_theme != false
.caption
margin-left: -3.8em
padding: .2rem .8rem !important
padding: 4px 16px !important
a
padding: 0 !important
@@ -11,9 +11,9 @@ if $highlight_theme == 'darker' || ($highlight_theme == 'mac')
color: alpha($highlight-foreground, .8),
bg-color: darken($highlight-background, 2)
}
$highlight-scrollbar = darken($highlight-background, 6)
$highlight-scrollbar = lighten($highlight-background, 8)
if $highlighEnable
if $highlight_enable
$highlight-comment = #969896
$highlight-red = #FF5370
$highlight-orange = #F78C6C
@@ -37,9 +37,9 @@ if $highlight_theme == 'pale night'
color: $highlight-foreground,
bg-color: darken($highlight-background, 2)
}
$highlight-scrollbar = darken($highlight-background, 6)
$highlight-scrollbar = lighten($highlight-background, 8)
if $highlighEnable
if $highlight_enable
$highlight-comment = #676E95
$highlight-red = #FF5370
$highlight-orange = #F78C6C
@@ -63,9 +63,9 @@ if $highlight_theme == 'ocean'
color: $highlight-foreground,
bg-color: darken($highlight-background, 2)
}
$highlight-scrollbar = darken($highlight-background, 5)
$highlight-scrollbar = lighten($highlight-background, 8)
if $highlighEnable
if $highlight_enable
$highlight-comment = rgba(101, 115, 126, .8)
$highlight-red = #FF5370
$highlight-orange = #F78C6C
@@ -92,7 +92,7 @@ if $highlight_theme == 'light' || ($highlight_theme == 'mac light')
}
$highlight-scrollbar = darken($highlight-background, 8)
if $highlighEnable
if $highlight_enable
$highlight-comment = rgba(149, 165, 166, .8)
$highlight-red = #E53935
$highlight-orange = #F76D47
+68 -70
View File
@@ -1,5 +1,5 @@
#aside-content
width: 25%
width: 26%
+minWidth900()
if hexo-config('aside.position') == 'right'
@@ -14,20 +14,14 @@
margin-top: 0
+maxWidth900()
margin-top: 1rem
margin-top: 20px
.card-widget
@extend .cardHover
position: relative
overflow: hidden
margin-top: 1rem
padding: 1rem 1.2rem
border-radius: 8px
background: var(--card-bg)
box-shadow: var(--card-box-shadow)
transition: box-shadow .3s
&:hover
box-shadow: var(--card-hover-box-shadow)
margin-top: 20px
padding: 20px 24px
if hexo-config('aside.mobile') == false
+maxWidth768()
@@ -41,11 +35,11 @@
font-size: 1.57em
&__description
margin-top: -.3rem
margin-top: -.42em
.card-info-data
display: table
margin: .7rem 0 .2rem
margin: 14px 0 4px
width: 100%
table-layout: fixed
@@ -59,18 +53,17 @@
font-size: 1em
.length-num
margin-top: -.3rem
margin-top: -.42em
color: var(--text-highlight-color)
font-size: 1.4em
.card-info-social-icons
margin: .3rem 0 -.3rem
margin: 6px 0 -6px
.social-icon
margin: 0 .5rem
margin: 0 10px
color: var(--font-color)
font-size: 1.4em
cursor: pointer
i
transition: all .3s
@@ -80,21 +73,24 @@
#card-info-btn
display: block
margin-top: .7rem
margin-top: 14px
background-color: var(--btn-bg)
color: var(--btn-color)
text-align: center
line-height: 2.4
&:hover
background-color: var(--btn-hover-color)
span
padding-left: .5rem
padding-left: 10px
.item-headline
padding-bottom: .3rem
padding-bottom: 6px
font-size: 1.2em
span
margin-left: .3rem
margin-left: 6px
.sticky_layout
+minWidth900()
@@ -106,7 +102,7 @@
.card-tag-cloud
a
display: inline-block
padding: 0 .2rem
padding: 0 4px
&:hover
color: $text-hover !important
@@ -114,13 +110,13 @@
.aside-list
& > span
display: block
margin-bottom: .5rem
margin-bottom: 10px
text-align: center
& > .aside-list-item
display: flex
align-items: center
padding: .3rem 0
padding: 6px 0
&:first-child
padding-top: 0
@@ -137,13 +133,7 @@
height: w
& > img
width: 100%
height: 100%
transition: all .6s
object-fit: cover
&:hover
transform: scale(1.1)
@extend .imgHover
.content
flex: 1
@@ -183,32 +173,26 @@
.card-archives ul.card-archive-list > .card-archive-list-item,
.card-categories ul.card-category-list > .card-category-list-item
a
display: inline-block
padding: .15rem .5rem
width: 100%
display: flex
flex-direction: row
padding: 3px 10px
color: var(--font-color)
transition: all .4s
&:hover
padding: .15rem .85rem
padding: 3px 17px
background-color: var(--text-bg-hover)
span
@extend .limit-one-line
display: inline-block
vertical-align: bottom
&:first-child
width: 80%
&:last-child
width: 20%
text-align: right
flex: 1
.card-categories
.card-category-list
&.child
padding: 0 0 0 .8rem
padding: 0 0 0 16px
> .parent
> a
@@ -222,8 +206,8 @@
i
float: right
margin-right: -.35rem
padding: .35rem
margin-right: -.5em
padding: .5em
transition: transform .3s
transform: rotate(0)
@@ -239,12 +223,12 @@
.webinfo-item
display: flex
align-items: center
padding: .1rem .5rem 0
padding: 2px 10px 0
div
&:first-child
flex: 1
padding-right: 1rem
padding-right: 20px
// toc
#card-toc
@@ -256,28 +240,48 @@
right: -100%
bottom: 30px
z-index: 100
max-width: $toc-mobile-maxWidth
max-height: calc(100% - 60px)
width: $toc-mobile-width
opacity: 0
transition: initial
transform-origin: right bottom
.toc-percentage
float: right
margin-top: -9px
color: #a9a9a9
font-style: italic
font-size: 140%
.toc-content
overflow-y: auto
overflow-y: scroll
overflow-y: overlay
margin: 0 -24px
max-height: calc(100vh - 120px)
+maxWidth900()
max-height: calc(100vh - 140px)
.toc-child
display: none
& > *
margin: 0 20px !important
+maxWidth900()
display: block !important
& > .toc-item > .toc-child
margin-left: 10px
padding-left: 10px
border-left: 1px solid var(--dark-grey)
.toc-item
&.active
.toc-child
display: block
&:not(.is-expand)
.toc-child
display: none
+maxWidth900()
display: block !important
.toc-item
&.active
.toc-child
display: block
ol,
li
@@ -288,29 +292,22 @@
ol
margin: 0
padding-left: .4rem
padding-left: 18px
.toc-link
display: block
padding-left: .3rem
border-left: 3px solid transparent
margin: 4px 0
padding: 1px 6px
color: var(--toc-link-color)
transition: all .2s ease-in-out
&:hover
color: $theme-color
&.active
border-left-color: darken($theme-toc-color, 20%)
background: $theme-toc-color
color: $toc-active-color
&:before
position: absolute
top: .6rem
right: 1.2rem
color: #a9a9a9
content: attr(progress-percentage)
font-style: italic
font-size: 1.2rem
:only-child
> .card-widget
margin-top: 0
@@ -330,8 +327,9 @@
border-radius: 70px
img
width: 100%
height: 100%
transition: all .5s
transition: filter 375ms ease-in .2s, transform .3s
object-fit: cover
&:hover
@@ -1,6 +1,6 @@
#post-comment
.comment-head
margin-bottom: 1rem
margin-bottom: 20px
.comment-headline
display: inline-block
@@ -13,8 +13,8 @@
if hexo-config('comments.text')
float: right
margin: .1rem auto 0
padding: .2rem .8rem
margin: 2px auto 0
padding: 4px 16px
width: max-content
border-radius: 8px
background: $comments-switch-bg
@@ -33,7 +33,7 @@
.switch-btn
position: relative
display: inline-block
margin: -4px .4rem 0
margin: -4px 8px 0
width: 42px
height: 22px
border-radius: 34px
@@ -1,104 +0,0 @@
if hexo-config('envelope_comment.enable')
$hoverHeight = hexo-config('envelope_comment.height') ? convert(hexo-config('envelope_comment.height')) : 1050px
@media screen and (max-width: 600px)
#beforeimg,
#afterimg
display none !important
@media screen and (min-width: 600px)
#article-container
img
margin 0 auto 0rem
#form-wrap
overflow hidden
height 447px
position relative
top 0px
transition all 1s ease-in-out .3s
z-index 0
&:hover
height $hoverHeight
top -200px
#maincontent
width 530px
margin 20px auto 0
#beforeimg
position absolute
bottom 126px
left 0px
background-repeat no-repeat
width 530px
height 317px
z-index -100
pointer-events none
#afterimg
position absolute
bottom -2px
left 0
background-repeat no-repeat
width 530px
height 259px
z-index 100
pointer-events none
#envelope
position relative
overflow visible
width 500px
margin 0px auto
transition all 1s ease-in-out .3s
padding-top 200px
.headerimg
width 100%
overflow hidden
pointer-events none
.formmain
background white
width 95%
max-width 800px
margin auto auto
border-radius 5px
border 1px solid
overflow hidden
-webkit-box-shadow 0px 0px 20px 0px rgba(0, 0, 0, 0.12)
box-shadow 0px 0px 20px 0px rgba(0, 0, 0, 0.18)
.comments-main
padding 5px 20px
.title3
text-decoration none
color $theme-color
text-align center
.comments
text-align center
border-bottom #ddd 1px solid
border-left #ddd 1px solid
padding-bottom 20px
background-color #eee
margin 15px 0px
padding-left 20px
padding-right 20px
border-top #ddd 1px solid
border-right #ddd 1px solid
padding-top 20px
.bottomcontent
text-align center
margin-top 40px
.bottomimg
width 100%
margin 5px auto 5px auto
display block
pointer-events none
.bottomhr
font-size 12px
text-align center
color #999
[data-theme='dark']
.formmain
background rgb(50, 50, 50)
.comments
background rgba(90, 90, 90, 0.8)
@@ -1,7 +1,7 @@
#footer
position: relative
background: $light-blue
background-attachment: local
background-attachment: scroll
background-position: bottom
background-size: cover
@@ -15,7 +15,7 @@
#footer-wrap
position: relative
padding: 2rem 1rem
padding: 40px 20px
color: var(--light-grey)
text-align: center
@@ -26,10 +26,10 @@
text-decoration: underline
.footer-separator
margin: 0 .2rem
margin: 0 4px
.icp-icon
padding: 0 4px
vertical-align: text-bottom
max-height: 1.4em
width auto
width: auto
vertical-align: text-bottom
+50 -54
View File
@@ -7,6 +7,13 @@
background-repeat: no-repeat
transition: all .5s
&:not(.not-top-img):before
position: absolute
width: 100%
height: 100%
background-color: alpha($dark-black, .3)
content: ''
// index
&.full_page
height: $index_top_img_height
@@ -15,14 +22,14 @@
#site-info
position: absolute
top: $index_site_info_top
padding: 0 .5rem
padding: 0 10px
width: 100%
#site-title,
#site-subtitle,
#scroll-down .scroll-down-effects
text-align: center
text-shadow: .1rem .1rem .2rem rgba(0, 0, 0, .15)
text-shadow: 2px 2px 4px rgba(0, 0, 0, .15)
line-height: 1.5
#site-title
@@ -43,18 +50,17 @@
#site_social_icons
display: none
margin: 0 auto
width: 15rem
width: 300px
text-align: center
+maxWidth768()
display: block
.social-icon
margin: 0 .5rem
margin: 0 10px
color: var(--light-grey)
text-shadow: .1rem .1rem .2rem rgba(0, 0, 0, .15)
text-shadow: 2px 2px 4px rgba(0, 0, 0, .15)
font-size: 1.43em
cursor: pointer
#scroll-down
position: absolute
@@ -70,54 +76,47 @@
// page
&.not-home-page
height: 20rem
height: 400px
+maxWidth768()
height: 14rem
height: 280px
#page-site-info
position: absolute
top: 10rem
padding: 0 .5rem
top: 200px
padding: 0 10px
width: 100%
+maxWidth768()
top: 7rem
top: 140px
// post
&.post-bg
height: 20rem
height: 400px
+maxWidth768()
height: 18rem
height: 360px
&:before
position: absolute
top: 0
left: 0
display: block
width: 100%
height: 100%
background-color: alpha($dark-black, .5)
content: ''
#post-info
position: absolute
bottom: 5rem
bottom: 100px
padding: 0 8%
width: 100%
text-align: center
+maxWidth900()
bottom: 1.5rem
bottom: 30px
text-align: left
+maxWidth768()
bottom: 1.1rem
padding: 0 1.1rem
bottom: 22px
padding: 0 22px
&.not-top-img
margin-bottom: .5rem
margin-bottom: 10px
height: 60px
background: 0
@@ -157,21 +156,17 @@
top: 70px
transition: top .5s
.apple
#page-header.full_page
background-attachment: scroll !important
#page
h1.page-title
margin: .4rem 0 1rem
margin: 8px 0 20px
// for not top_img
#post
& > #post-info
margin-bottom: 1.5rem
margin-bottom: 30px
.post-title
padding-bottom: .2rem
padding-bottom: 4px
border-bottom: 1px solid var(--light-grey)
color: var(--text-highlight-color)
@@ -185,7 +180,7 @@
#post-info
.post-title
@extend .limit-more-line
margin-bottom: .4rem
margin-bottom: 8px
color: var(--white)
font-weight: normal
font-size: 2.5em
@@ -193,10 +188,10 @@
-webkit-line-clamp: 3
+maxWidth768()
font-size: 1.72em
font-size: 2.1em
.post-edit-link
padding-left: .5rem
padding-left: 10px
#post-meta
color: var(--light-grey)
@@ -216,14 +211,14 @@
.post-meta
&-separator
margin: 0 .25rem
margin: 0 5px
&-icon
margin-right: .2rem
margin-right: 4px
&-label
if hexo-config('post_meta.post.label')
margin-right: .2rem
margin-right: 4px
else
display: none
@@ -244,7 +239,6 @@
top: 0
z-index: 90
display: flex
flex-wrap: wrap
align-items: center
padding: 0 36px
width: 100%
@@ -264,7 +258,7 @@
#toggle-menu
display: none
padding: .1rem 0 0 .3rem
padding: 2px 0 0 6px
vertical-align: top
&:hover
@@ -277,7 +271,7 @@
color: var(--white)
#site-name
text-shadow: .1rem .1rem .2rem rgba($dark-black, .15)
text-shadow: 2px 2px 4px rgba($dark-black, .15)
font-weight: bold
cursor: pointer
@@ -287,16 +281,16 @@
.menus_item
position: relative
display: inline-block
padding: 0 0 0 .7rem
padding: 0 0 0 14px
&:hover
.menus_item_child
display: block
i.expand
transform: rotate(180deg) !important
& > a > i:last-child
transform: rotate(180deg)
i.expand
& > a > i:last-child
padding: 4px
transition: transform .3s
@@ -310,6 +304,7 @@
background-color: var(--sidebar-bg)
box-shadow: 0 5px 20px -4px rgba($dark-black, .5)
animation: sub_menus .3s .1s ease both
border-radius: 5px
&:before
position: absolute
@@ -325,9 +320,13 @@
&:hover
background: var(--text-bg-hover)
&:first-child
border-radius: 5px 5px 0 0
&:last-child
border-radius: 0 0 5px 5px
a
display: inline-block
padding: .3rem .7rem
padding: 8px 16px
width: 100%
color: var(--font-color) !important
text-shadow: none !important
@@ -340,22 +339,19 @@
font-size: inherit
.menus_items
position: absolute
left: 0
visibility: hidden
opacity: 0
display: none
#search-button span
display: none !important
display: none
#search-button
display: inline
padding: 0 0 0 .7rem
padding: 0 0 0 14px
.site-page
position: relative
padding-bottom: .3rem
text-shadow: .05rem .05rem .1rem rgba($dark-black, .3)
padding-bottom: 6px
text-shadow: 1px 1px 2px rgba($dark-black, .3)
font-size: .78em
cursor: pointer
@@ -43,7 +43,7 @@ if hexo-config('preloader')
.loading-word
position: absolute
color: var(--preloader-color)
font-size: .8rem
font-size: 16px
.configure-core
width: 100%
@@ -1,38 +1,17 @@
#pagination
overflow: hidden
margin-top: 1rem
width: 100%
.pagination
margin-top: 20px
text-align: center
.page-number
display: inline-block
margin: 0 .2rem
min-width: w = 1.2rem
height: w
text-align: center
line-height: w
cursor: pointer
&.current
background: $theme-paginator-color
color: var(--white)
cursor: default
img.prev-cover,
img.next-cover
position: absolute
width: 100%
height: 100%
opacity: .4
transition: all .6s
object-fit: cover
.pagination-info
position: absolute
top: 50%
padding: 1rem 2rem
padding: 20px 40px
width: 100%
transform: translate(0, -50%)
@@ -57,6 +36,7 @@
.prev-post,
.next-post
@extend .postImgHover
width: 50%
+maxWidth768()
@@ -68,12 +48,35 @@
overflow: hidden
height: 150px
&:hover
img.prev-cover,
img.next-cover
opacity: .8
transform: scale(1.1)
&.pagination-post
margin-top: 2rem
background: $dark-black
overflow: hidden
margin-top: 40px
background: $dark-black
.layout
& > .recent-posts
.pagination
& > *
display: inline-block
margin: 0 6px
width: w = 2.5em
height: w
line-height: w
& > *:not(.space)
@extend .cardHover
&:hover
background: var(--btn-hover-color)
color: var(--btn-color)
& > div:not(.recent-posts)
.pagination
.page-number
display: inline-block
margin: 0 4px
min-width: w = 24px
height: w
text-align: center
line-height: w
cursor: pointer
+81 -119
View File
@@ -1,16 +1,13 @@
beautify()
headStyle(fontsize)
padding-left: unit(fontsize + .4, 'rem')
code
font-size: unit(fontsize, 'rem')
padding-left: unit(fontsize + 12, 'px')
&:before
margin-left: unit((-(fontsize + .2)), 'rem')
font-size: unit(fontsize, 'rem')
margin-left: unit((-(fontsize + 6)), 'px')
font-size: unit(fontsize, 'px')
&:hover
padding-left: unit(fontsize + .6, 'rem')
padding-left: unit(fontsize + 18, 'px')
h1,
h2,
@@ -22,7 +19,7 @@ beautify()
&:before
position: absolute
top: calc(50% - .35rem)
top: calc(50% - 7px)
color: $title-prefix-icon-color
content: $title-prefix-icon
line-height: 1
@@ -34,112 +31,40 @@ beautify()
color: $light-blue
h1
headStyle(1)
headStyle(20)
h2
headStyle(.9)
headStyle(18)
h3
headStyle(.8)
headStyle(16)
h4
headStyle(.7)
headStyle(14)
h5
headStyle(.6)
headStyle(12)
h6
headStyle(.6)
headStyle(12)
ol,
ul
margin-top: .4rem
padding: 0 0 0 .8rem
list-style: none
counter-reset: li
+maxWidth768()
padding: 0 0 0 .4rem
p
margin: 0 0 .5rem
margin: 0 0 8px
ol,
ul
padding-left: .6rem
li
&::marker
color: $light-blue
font-weight: 600
font-size: 1.05em
+maxWidth768()
padding-left: .2rem
&:hover
&::marker
color: var(--pseudo-hover)
li
&:not(.tab)
position: relative
margin: .2rem 0
&:hover
&:before
transform: rotate(360deg)
&:before
position: absolute
top: 0
left: 0
background: $light-blue
color: $white
cursor: pointer
transition: all .3s ease-out
ol
> li
&:not(.tab)
padding: .2em .2em .2em 1.8em
&:before
margin-top: .65em
width: w = 1.45em
height: h = w
border-radius: .5 * w
content: counter(li)
counter-increment: li
text-align: center
font-size: .85em
line-height: h
ul
> li:not(.tab)
padding: .2em .2em .2em 1.4em
&:hover
&:before
border-color: $pseudo-hover
&:before
$w = .42em
top: .78em
width: w = $w
height: h = w
border: .5 * w solid $light-blue
border-radius: w
background: transparent
content: ''
line-height: h
no-beautify()
ol,
ul
margin-top: .4rem
p
margin: 0 0 .5rem
ol,
ul
padding-left: .5rem
li
position: relative
margin: .3rem 0
padding-left: .3rem
ul > li
list-style-type: circle
#article-container
word-wrap: break-word
@@ -153,13 +78,15 @@ no-beautify()
img
display: block
margin: 0 auto .8rem
margin: 0 auto 20px
max-width: 100%
transition: filter 375ms ease-in .2s
p
margin: 0 0 .8rem
margin: 0 0 16px
iframe
margin: 0 0 1rem
margin: 0 0 20px
kbd
margin: 0 3px
@@ -175,15 +102,50 @@ no-beautify()
font-family: Monaco, 'Ubuntu Mono', monospace
line-height: 1em
if hexo-config('beautify.enable') && hexo-config('beautify.field') == 'site'
beautify()
else if hexo-config('beautify.enable') && hexo-config('beautify.field') == 'post'
no-beautify()
if hexo-config('anchor')
a.headerlink
&:after
@extend .fontawesomeIcon
float: right
color: var(--headline-presudo)
content: '\f0c1'
font-size: .95em
opacity: 0
transition: all .3s
&.post-content
&:hover
&:after
color: var(--pseudo-hover)
h1,
h2,
h3,
h4,
h5,
h6
&:hover
a.headerlink
&:after
opacity: 1
ol,
ul
ol,
ul
padding-left: 20px
li
margin: 4px 0
p
margin: 0 0 8px
if hexo-config('beautify.enable')
if hexo-config('beautify.field') == 'site'
beautify()
else
no-beautify()
else if hexo-config('beautify.field') == 'post'
&.post-content
beautify()
> :last-child
margin-bottom: 0 !important
@@ -196,11 +158,11 @@ no-beautify()
&__tags
display: inline-block
margin: .4rem .4rem .4rem 0
padding: 0 .6rem
margin: 8px 8px 8px 0
padding: 0 12px
width: fit-content
border: 1px solid $light-blue
border-radius: .6rem
border-radius: 12px
color: $light-blue
font-size: .85em
transition: all .2s ease-in-out
@@ -212,7 +174,7 @@ no-beautify()
.post_share
display: inline-block
float: right
margin: .4rem 0
margin: 8px 0
width: fit-content
.social-share
@@ -227,19 +189,19 @@ no-beautify()
.post-copyright
position: relative
margin: 2rem 0 .5rem
padding: .5rem .8rem
margin: 40px 0 10px
padding: 10px 16px
border: 1px solid var(--light-grey)
transition: box-shadow .3s ease-in-out
&:before
@extend .fontawesomeIcon
position: absolute
top: .1rem
right: .6rem
top: 2px
right: 12px
color: $theme-color
content: '\f1f9'
font-size: 1rem
font-size: 1.3em
&:hover
box-shadow: 0 0 8px 0 rgba(232, 237, 250, .6), 0 2px 4px 0 rgba(232, 237, 250, .5)
@@ -250,7 +212,7 @@ no-beautify()
font-weight: bold
&-info
padding-left: .3rem
padding-left: 6px
a
text-decoration: underline
@@ -261,7 +223,7 @@ no-beautify()
.post-outdate-notice
position: relative
margin: 0 0 1rem
margin: 0 0 20px
padding: .5em 1.2em
border-radius: 3px
background-color: $noticeOutdate-bg
@@ -281,4 +243,4 @@ no-beautify()
transform: translateY(-50%)
.ads-wrap
margin: 2rem 0
margin: 40px 0
@@ -1,5 +1,5 @@
.relatedPosts
margin-top: 2rem
margin-top: 40px
& > .headline
margin-bottom: 5px
@@ -16,11 +16,7 @@
height: 200px
background: $dark-black
vertical-align: bottom
&:hover
.cover
opacity: .8
transform: scale(1.1)
@extend .postImgHover
+maxWidth768()
margin: 2px
@@ -30,17 +26,10 @@
+maxWidth600()
width: calc(100% - 4px)
.cover
width: 100%
height: 100%
opacity: .4
transition: all .6s
object-fit: cover
.content
position: absolute
top: 50%
padding: 0 1rem
padding: 0 20px
width: 100%
transform: translate(0, -50%)
@@ -1,18 +1,24 @@
.post-reward
position: relative
margin-top: 4rem
margin-top: 80px
width: 100%
text-align: center
pointer-events: none
& > *
pointer-events: auto
.reward-button
display: inline-block
padding: .2rem 1.2rem
padding: 4px 24px
background: var(--btn-bg)
color: var(--btn-color)
cursor: pointer
transition: all .4s
&:hover
.reward-button
background: var(--btn-hover-color)
& > .reward-main
display: block
@@ -28,7 +34,7 @@
.reward-all
display: inline-block
margin: 0
padding: 1rem .5rem
padding: 20px 10px
border-radius: 4px
background: var(--reward-pop)
@@ -64,6 +70,5 @@
height: 130px
.post-qr-code-desc
padding-top: .4rem
width: 130px
color: $reward-pop-up-color
@@ -1,29 +1,39 @@
#rightside
position: fixed
right: -38px
right: -48px
bottom: $rightside-bottom
z-index: 100
opacity: 0
transition: all .5s
#rightside-config-hide
height: 0
opacity: 0
transition: transform .4s
transform: translate(35px, 0)
transform: translate(45px, 0)
&.show
transform: translate(0, 0) !important
height: auto
opacity: 1
transform: translate(0, 0)
&.status
height: auto
opacity: 1
& > div
& > button,
& > a
display: block
margin-bottom: 2px
width: 30px
height: 30px
margin-bottom: 5px
width: w = 35px
height: w
border-radius: 5px
background-color: var(--btn-bg)
color: var(--btn-color)
text-align: center
font-size: 16px
line-height: w
&:hover
background-color: var(--btn-hover-color)
@@ -1,26 +0,0 @@
/*电子钟字体*/
@font-face
font-family 'UnidreamLED'
src url('https://cdn.jsdelivr.net/gh/Akilarlxh/Akilarlxh.github.io@v3.3.3_3/clock/fonts/UnidreamLED.ttf')
font-display swap
//页脚计时器
div#runtime
width 180px
margin auto
color white
padding-inline 5px
border-radius 10px
background-color rgba(0,0,0,0.7)
font-family 'UnidreamLED'
// 夜间全局透明度
[data-theme="dark"]
div#runtime
color rgb(40, 180, 200)
box-shadow 0 0 5px rgba(28, 69, 218, 0.71)
animation flashlight 1s linear infinite alternate
@keyframes flashlight
from
box-shadow 0 0 5px rgb(20, 120, 210)
to
box-shadow 0 0 2px rgb(20, 120, 210)
@@ -23,39 +23,38 @@
transform: translate3d(-100%, 0, 0)
& > .avatar-img
margin: 1rem auto
margin: 20px auto
.site-data
display: table
padding: 0 .5rem
padding: 0 10px
width: 100%
table-layout: fixed
.data-item
display: table-cell
.data-item-link
& > a > div
@extend .limit-one-line
& > a > div
@extend .limit-one-line
.length-num
color: var(--text-highlight-color)
font-size: 1.28em
.length-num
color: var(--text-highlight-color)
font-size: 1.28em
.headline
color: var(--font-color)
.headline
color: var(--font-color)
hr
margin: 1rem auto
margin: 20px auto
.menus_items
padding: 0 .5rem 2rem
padding: 0 10px 40px
.site-page
@extend .limit-one-line
position: relative
display: block
padding: .3rem 1.5rem .3rem 1.1rem
padding: 6px 30px 6px 22px
color: var(--font-color)
font-size: 1.15em
@@ -66,18 +65,20 @@
width: 15%
text-align: left
.expand
position: absolute
top: .78em
right: .9rem
transition: transform .3s
&.group
& > i:last-child
position: absolute
top: .78em
right: 18px
transition: transform .3s
&.hide
transform: rotate(90deg) !important
&.hide
& > i:last-child
transform: rotate(90deg)
& + .menus_item_child
display: none
.menus_item_child
margin: 0
list-style: none
if hexo-config('hide_sidebar_menu_child')
display: none
list-style: none
@@ -24,7 +24,6 @@
--waline-font-size: 1.1em
--waline-theme-color: $button-bg
--waline-active-color: $button-hover-color
--waline-avatar-size: 2.75rem
.vuser
transition: all .5s
@@ -62,16 +61,9 @@ if hexo-config('waline.bg')
.medium-zoom-overlay
z-index: 99999 !important
.mermaid
overflow: auto
margin: 0 0 1rem
background: $white
.mermaid-wrap
margin: 0 0 20px
text-align: center
opacity: 0
transition: all .3s
&[data-processed]
opacity: 1
.utterances,
.fb-comments iframe
@@ -80,7 +72,7 @@ if hexo-config('waline.bg')
#gitalk-container
.gt-meta
margin: 0 0 .8em
padding: .3rem 0 .8em
padding: 6px 0 16px
.katex-wrap
overflow: auto
@@ -100,7 +92,7 @@ mjx-container[display],
#article-container
.aplayer
margin: 0 0 1rem
margin: 0 0 20px
if hexo-config('beautify.enable')
ol,
@@ -21,6 +21,7 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
--btn-bg: lighten(#121212, 5)
--text-bg-hover: lighten(#121212, 15)
--light-grey: alpha(#FFFFFF, .7)
--dark-grey: alpha(#FFFFFF, .2)
--white: alpha(#FFFFFF, .9)
--text-highlight-color: alpha(#FFFFFF, .9)
--blockquote-color: alpha(#FFFFFF, .7)
@@ -35,6 +36,8 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
--hlnumber-color: alpha(#FFFFFF, .4)
--hlscrollbar-bg: lighten(#121212, 5)
--hlexpand-bg: linear-gradient(180deg, rgba(lighten(#121212, 2), .6), rgba(lighten(#121212, 2), .9))
--scrollbar-color: lighten(#121212, 5)
--timeline-bg: lighten(#121212, 5)
#web_bg:before,
#footer:before,
@@ -90,7 +93,6 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
// hide-tags
.hide-button,
.btn-beautify,
.mermaid,
.hl-label,
.post-outdate-notice,
.error-img,
@@ -11,6 +11,7 @@ if hexo-config('readmode')
--exit-btn-bg: #C0C0C0
--exit-btn-color: #fff
--exit-btn-hover: darken(#C0C0C0, 20)
--pseudo-hover: none
[data-theme='dark']
.read-mode
@@ -33,6 +34,7 @@ if hexo-config('readmode')
position: fixed
top: 30px
right: 30px
z-index: 100
width: 40px
height: 40px
border-radius: 8px
@@ -41,6 +43,10 @@ if hexo-config('readmode')
font-size: 16px
transition: background .3s
+maxWidth768()
top: initial
bottom: 30px
&:hover
background: var(--exit-btn-hover)
@@ -131,7 +137,7 @@ if hexo-config('readmode')
ul
>li
&:before
border: .15rem solid var(--gray) !important
border-color: var(--gray) !important
.tabs
border: 2px solid var(--tab-border-color)
@@ -160,7 +166,7 @@ if hexo-config('readmode')
color: var(--font-color)
blockquote
border-left: .2rem solid var(--gray)
border-color: var(--gray)
background-color: var(--readmode-light-color)
kbd
@@ -179,9 +185,6 @@ if hexo-config('readmode')
background: var(--readmode-light-color) !important
color: var(--font-color) !important
.button--animated:before
background: var(--readmode-light-color) !important
.note
border: 2px solid var(--gray)
border-left-color: var(--gray) !important
+25 -42
View File
@@ -6,81 +6,64 @@ if hexo-config('error_404.enable')
right: 0
left: 0
margin: 0 auto
padding: 0 1rem
padding: 60px 20px 0
max-width: 1000px
transform: translate(0, -50%)
.error-content
display: flex
flex-direction: row
justify-content: center
align-items: center
margin: 0 1rem
height: 18rem
border-radius: 8px
background: var(--card-bg)
box-shadow: var(--card-box-shadow)
transition: all .3s
&:hover
box-shadow: var(--card-hover-box-shadow)
@extend .cardHover
overflow: hidden
margin: 0 20px
height: 360px
+maxWidth768()
flex-direction: column
margin: 0
height: 25rem
height: 500px
.error-img
flex: 1
display: inline-block
overflow: hidden
width: 50%
height: 100%
border-top-left-radius: 8px
border-bottom-left-radius: 8px
background-color: $theme-color
background-position: center
background-size: cover
+maxWidth768()
flex: 1
width: 100%
border-top-right-radius: 8px
border-bottom-left-radius: 0
height: 45%
img
@extend .imgHover
background-color: $theme-color
.error-info
flex: 1
padding: .5rem
display: inline-flex
flex-direction: column
justify-content: center
align-content: center
width: 50%
height: 100%
vertical-align: top
text-align: center
font-size: 14px
if $site-name-font
font-family: $site-name-font
+maxWidth768()
flex: 1.1
width: 100%
height: 55%
.error_title
margin-top: -4rem
margin-top: -.6em
font-size: 9em
+maxWidth768()
margin-top: -3rem
font-size: 8em
.error_subtitle
@extend .limit-more-line
margin-top: -3.5rem
margin-top: -3em
word-break: break-word
font-size: 1.6em
-webkit-line-clamp: 2
a
display: inline-block
margin-top: .5rem
padding: .3rem 1.5rem
background: var(--btn-bg)
color: var(--btn-color)
i
padding-right: .3rem
& + #rightside
display: none
+18 -24
View File
@@ -1,25 +1,25 @@
.article-sort
margin-left: .5rem
padding-left: 1rem
margin-left: 10px
padding-left: 20px
border-left: 2px solid lighten($light-blue, 20)
&-title
position: relative
margin-left: .5rem
padding-bottom: 1rem
padding-left: 1rem
margin-left: 10px
padding-bottom: 20px
padding-left: 20px
font-size: 1.72em
&:hover
&:before
border-color: $pseudo-hover
border-color: var(--pseudo-hover)
&:before
position: absolute
top: calc(((100% - 1.8rem) / 2))
left: -.45rem
top: calc(((100% - 36px) / 2))
left: -9px
z-index: 1
width: w = .5rem
width: w = 10px
height: h = w
border: .5 * w solid $light-blue
border-radius: w
@@ -33,7 +33,7 @@
bottom: 0
left: 0
z-index: 0
width: .1rem
width: 2px
height: 1.5em
background: lighten($light-blue, 20)
content: ''
@@ -42,17 +42,17 @@
position: relative
display: flex
align-items: center
margin: 0 0 1rem .5rem
margin: 0 0 20px 10px
transition: all .2s ease-in-out
&:hover
&:before
border-color: $pseudo-hover
border-color: var(--pseudo-hover)
&:before
$w = .3rem
$w = 6px
position: absolute
left: calc(-1rem - 17px)
left: calc(-20px - 17px)
width: w = $w
height: h = w
border: .5 * w solid $light-blue
@@ -75,14 +75,14 @@
border-color: $light-blue
&:before
border-color: $pseudo-hover
border-color: var(--pseudo-hover)
&-time
color: $theme-meta-color
font-size: 95%
time
padding-left: .3rem
padding-left: 6px
cursor: default
&-title
@@ -102,14 +102,8 @@
height: 80px
img
width: 100%
height: 100%
transition: all .6s
object-fit: cover
&:hover
transform: scale(1.1)
@extend .imgHover
&-info
flex: 1
padding: 0 .8rem
padding: 0 16px
@@ -1,62 +1,37 @@
#page
.category-lists
padding: 1rem 0 1.5rem
.category-lists
.category-title
font-size: 2.57em
+maxWidth768()
padding: 0
font-size: 2em
.category-title
font-size: 2.57em
.category-list
margin-bottom: 0
+maxWidth768()
font-size: 2em
a
color: var(--font-color)
.category-list
a
color: var(--font-color)
&:hover
color: $text-hover
&:hover
color: $text-hover
.category-list-count
margin-left: 8px
color: $theme-meta-color
.category-list-count
margin-left: .4rem
color: $theme-meta-color
&:before
content: '('
&:before
content: '('
&:after
content: ')'
&:after
content: ')'
ul
padding: 0 0 0 20px
@extend .list-beauty
ul
margin-top: .4rem
padding: 0 0 0 1rem
list-style: none
counter-reset: li
padding-left: 4px
ul
padding-left: .2rem
li
position: relative
margin: .3rem 0
padding: .12em .4em .12em 1.4em
&:before
position: absolute
left: 0
cursor: pointer
transition: all .3s ease-out
$w = .43em
top: .7em
width: w = $w
height: h = w
border: .5 * w solid $light-blue
border-radius: w
background: transparent
content: ''
// line-height: h
&:hover
&:before
border-color: $pseudo-hover
li
position: relative
margin: 6px 0
padding: .12em .4em .12em 1.4em
+15 -10
View File
@@ -7,7 +7,7 @@
display: flex
flex: 1 auto
margin: 0 auto
padding: 2rem 15px
padding: 40px 15px
max-width: 1200px
width: 100%
@@ -15,26 +15,21 @@
flex-direction: column
+maxWidth768()
padding: 1rem 5px
padding: 20px 5px
+minWidth2000()
max-width: 1500px
& > div:first-child:not(.recent-posts)
@extend .cardHover
align-self: flex-start
padding: 50px 40px
border-radius: 8px
background: var(--card-bg)
box-shadow: var(--card-box-shadow)
&:hover
box-shadow: var(--card-hover-box-shadow)
+maxWidth768()
padding: 1.8rem .7rem !important
padding: 36px 14px
& > div:first-child
width: 75%
width: 74%
transition: all .3s
+maxWidth900()
@@ -53,3 +48,13 @@
& > div
width: 100% !important
// for apple device
.apple
#page-header.full_page
background-attachment: scroll !important
.recent-post-item,
.avatar-img,
.flink-item-icon
transform: translateZ(0)
+2 -4
View File
@@ -1,8 +1,5 @@
#article-container
.flink
.flink-desc
margin: .2rem 0 .5rem
.flink-list
overflow: auto
padding: 10px 10px 0
@@ -61,7 +58,8 @@
img
width: 100%
height: 100%
transition: all .3s
object-fit: cover
transition: filter 375ms ease-in 0.2s, transform .3s
.img-alt
display: none
+36 -80
View File
@@ -1,89 +1,75 @@
#recent-posts
& > .recent-post-item:not(:first-child)
margin-top: 1rem
margin-top: 20px
& > .recent-post-item
@extend .cardHover
display: flex
flex-direction: row
align-items: center
height: 20em
border-radius: 12px 8px 8px 12px
background: var(--card-bg)
box-shadow: var(--card-box-shadow)
transition: all .3s
overflow: hidden
height: 18em
+maxWidth768()
border-radius: 12px 12px 8px 8px
flex-direction: column
height: auto
&:hover
box-shadow: var(--card-hover-box-shadow)
img.post_bg
transform: scale(1.1)
if hexo-config('cover.position') == 'both'
.left_radius
border-radius: 8px 0 0 8px
.right_radius
order: 2
border-radius: 0 8px 8px 0
else if hexo-config('cover.position') == 'left'
.left_radius
border-radius: 8px 0 0 8px
.right_radius
border-radius: 8px 0 0 8px
else if hexo-config('cover.position') == 'right'
.left_radius
order: 2
border-radius: 0 8px 8px 0
.right_radius
order: 2
border-radius: 0 8px 8px 0
&.ads-wrap
display: block !important
height: auto !important
.post_cover
overflow: hidden
width: 45%
width: 44%
height: 100%
-webkit-mask-image: -webkit-radial-gradient(white, black)
+maxWidth768()
width: 100%
height: 230px
img.post_bg
width: 100%
height: 100%
transition: all .6s
object-fit: cover
@extend .imgHover
&:hover
transform: scale(1.1)
&.right
order: 1
+maxWidth768()
order: 0
& >.recent-post-info
display: inline-block
overflow: hidden
padding: 0 40px
width: 55%
width: 57%
+maxWidth768()
padding: 20px 20px 30px
width: 100%
&.no-cover
width: 100%
+maxWidth768()
padding: 30px 20px
& > .article-title
@extend .limit-more-line
margin-bottom: .3rem
color: var(--text-highlight-color)
font-size: 1.72em
line-height: 1.4
transition: all .2s ease-in-out
-webkit-line-clamp: 2
+maxWidth768()
font-size: 1.43em
&:hover
color: $text-hover
& > .article-meta-wrap
margin: 6px 0
color: $theme-meta-color
font-size: 90%
@@ -94,22 +80,19 @@
color: $sticky-color
i
margin: 0 .2rem 0 0
margin: 0 4px 0 0
.article-meta-label
if hexo-config('post_meta.page.label')
padding-right: .2rem
padding-right: 4px
else
display: none
.article-meta__separator
margin: 0 .3rem
.article-meta-separator
margin: 0 6px
.article-meta__link
margin: 0 .2rem
.fa-angle-right
margin: 0 .2rem
.article-meta-link
margin: 0 4px
if hexo-config('post_meta.page.date_format') == 'relative'
time
@@ -124,31 +107,4 @@
& > .content
@extend .limit-more-line
margin-top: .3rem
-webkit-line-clamp: 3
+maxWidth768()
#recent-posts
.recent-post-item
flex-direction: column
height: auto !important
.post_cover
order: 1 !important
width: 100%
height: 230px
border-radius: 8px 8px 0 0
.recent-post-info
order: 2 !important
padding: 1rem 1rem 1.5rem
width: 100%
&.no-cover
padding: 1.5rem 1rem
.article-title
font-size: 1.43em
.content
height: auto
-webkit-line-clamp: 2
+5 -1
View File
@@ -2,7 +2,7 @@
&-list
a
display: inline-block
padding: 0 .4rem
padding: 0 8px
transition: all .3s
&:hover
@@ -17,3 +17,7 @@
+maxWidth768()
font-size: 2em
h1.page-title
& + .tag-cloud-list
text-align: left
@@ -1,69 +1,52 @@
#algolia-search
.search-dialog
.ais-search-box
margin: 0 auto
max-width: 100%
width: 100%
.ais-SearchBox
input
padding: .25rem .7rem
padding: 5px 14px
width: 100%
outline: none
border: 2px solid $search-color
border-radius: 2rem
border-radius: 40px
background: var(--search-bg)
color: var(--search-input-color)
.ais-hits--item.algolia-hit-item
position: relative
padding-left: 1.2rem
&:hover
&:before
border-color: $pseudo-hover
&:before
$w = .5em
position: absolute
top: .53em
left: 0
width: w = $w
height: h = w
border: .15rem solid $search-color
border-radius: w
background: transparent
content: ''
line-height: h
transition: all .2s ease-in-out
.ais-Hits-list
padding-left: 24px
@extend .list-beauty
a
display: block
color: var(--search-result-title)
cursor: pointer
&:hover
color: $search-color
em
mark
background: transparent
color: $search-keyword-highlight
font-weight: bold
.ais-pagination.pagination
margin: .8rem 0 0
.ais-Pagination
margin: 16px 0 0
padding: 0
text-align: center
.ais-pagination--item
margin: 0 .2rem
.ais-Pagination-list
padding: 0
list-style: none
.ais-Pagination-item
display: inline
margin: 0 4px
padding: 0
a
.ais-Pagination-link
display: inline-block
min-width: 1.2rem
height: 1.2rem
min-width: 24px
height: 24px
text-align: center
line-height: 1.2rem
line-height: 24px
.ais-pagination--item.current
.ais-Pagination-item--selected
a
background: $theme-paginator-color
color: #eee
@@ -71,5 +54,5 @@
.algolia-logo
padding-top: 2px
width: 4rem
height: 1.5rem
width: 80px
height: 30px
+18 -21
View File
@@ -1,15 +1,14 @@
.search-dialog
position: fixed
top: 5rem
top: 100px
left: 50%
z-index: 1001
display: none
margin-left: -15rem
padding: 1rem
width: 30rem
margin-left: -300px
padding: 20px
width: 600px
border-radius: 8px
background: var(--search-bg)
animation: titlescale .5s
+maxWidth768()
top: 0
@@ -20,27 +19,25 @@
border-radius: 0
hr
margin: 1rem auto
margin: 20px auto
span.search-close-button
position: absolute
top: .8rem
right: 1rem
color: $grey
font-size: 1.4em
line-height: 1
cursor: pointer
transition: color .2s ease-in-out
&:hover
color: $search-color
&__title
padding: 0 0 .7rem
.search-nav
margin: 0 0 14px
color: $search-color
font-size: 1.4em
line-height: 1
.search-dialog-title
margin-right: 10px
.search-close-button
float: right
color: $grey
transition: color .2s ease-in-out
&:hover
color: $search-color
#search-mask
position: fixed
top: 0
@@ -6,23 +6,26 @@
width: 100%
input
padding: .25rem .7rem
padding: 5px 14px
width: 100%
outline: none
border: 2px solid $search-color
border-radius: 2rem
border-radius: 40px
background: var(--search-bg)
color: var(--search-input-color)
-webkit-appearance: none
.search-wrap
display: none
.local-search__hit-item
position: relative
padding-left: 1.2rem
padding-left: 24px
line-height: 1.7
&:hover
&:before
border-color: $pseudo-hover
border-color: var(--pseudo-hover)
&:before
$w = .5em
@@ -31,7 +34,7 @@
left: 0
width: w = $w
height: h = w
border: .15rem solid $search-color
border: 3px solid $search-color
border-radius: w
background: transparent
content: ''
@@ -48,7 +51,7 @@
color: $search-color
.search-result
margin: 0 0 .4rem
margin: 0 0 8px
word-break: break-all
.search-keyword
@@ -57,8 +60,8 @@
.search-result-list
overflow-y: auto
max-height: 10.5rem
max-height: 210px
+maxWidth768()
padding-bottom: 2rem
padding-bottom: 40px
max-height: 75vh !important
+21 -27
View File
@@ -1,61 +1,55 @@
#article-container
.btn-center
margin: 0 0 1rem
margin: 0 0 20px
text-align: center
.btn-beautify
display: inline-block
margin: 0 .2rem .3rem
padding: 0 1rem
background-color: $btn-default-color
margin: 0 4px 6px
padding: 0 15px
background-color: var(--btn-beautify-color, $btn-default-color)
color: $btn-color
line-height: 2
for $type in $color-types
&.{$type}
--btn-beautify-color: lookup('$tagsP-' + $type + '-color')
&:hover
background-color: var(--btn-hover-color)
i + span
margin-left: .3rem
margin-left: 6px
&:not(.block) + .btn-beautify:not(.block)
margin: 0 .2rem 1rem
margin: 0 4px 20px
&.block
display: block
margin: 0 0 1rem
margin: 0 0 20px
width: fit-content
width: -moz-fit-content
&.center
margin: 0 auto 1rem
margin: 0 auto 20px
&.right
margin: 0 0 1rem auto
margin: 0 0 20px auto
&.larger
padding: .3rem 1.3rem
padding: 6px 15px
&:hover
text-decoration: none
for $type in $tagsP-types
&.{$type}
background-color: lookup('$tagsP-' + $type + '-color')
&.outline
border: 1px solid transparent
border-color: $btn-default-color
border-color: var(--btn-beautify-color, $btn-default-color)
background-color: transparent
color: $btn-default-color
transition: all .3s
color: var(--btn-beautify-color, $btn-default-color)
&.button--animated:before
background: $btn-default-color
&:hover
background-color: var(--btn-beautify-color, $btn-default-color)
&:hover
color: white !important
for $type in $tagsP-types
&.{$type}
border-color: lookup('$tagsP-' + $type + '-color')
color: lookup('$tagsP-' + $type + '-color')
&.button--animated:before
background: lookup('$tagsP-' + $type + '-color')
+89 -94
View File
@@ -1,107 +1,102 @@
figure.gallery-group
position: relative
float: left
overflow: hidden
margin: .3rem .2rem
width: calc(50% - .4rem)
height: 250px
border-radius: 8px
background: $dark-black
-webkit-transform: translate3d(0, 0, 0)
+maxWidth600()
width: calc(100% - .4rem)
&:hover
img
opacity: .4
transform: translate3d(0, 0, 0)
.gallery-group-name::after
transform: translate3d(0, 0, 0)
p
opacity: 1
transform: translate3d(0, 0, 0)
img
#article-container
figure.gallery-group
position: relative
margin: 0 !important
max-width: none
width: calc(100% + 20px)
float: left
overflow: hidden
margin: 6px 4px
width: calc(50% - 8px)
height: 250px
backface-visibility: hidden
opacity: .8
transition: opacity .35s, transform .35s
transform: translate3d(-10px, 0, 0)
object-fit: cover
border-radius: 8px
background: $dark-black
-webkit-transform: translate3d(0, 0, 0)
figcaption
position: absolute
top: 0
left: 0
padding: 1.5rem
width: 100%
height: 100%
color: $gallery-color
text-transform: uppercase
backface-visibility: hidden
+maxWidth600()
width: calc(100% - 8px)
& > a
&:hover
img
opacity: .4
transform: translate3d(0, 0, 0)
.gallery-group-name::after
transform: translate3d(0, 0, 0)
p
opacity: 1
transform: translate3d(0, 0, 0)
img
position: relative
margin: 0
max-width: none
width: calc(100% + 20px)
height: 250px
backface-visibility: hidden
opacity: .8
transition: all .3s, filter 375ms ease-in .2s
transform: translate3d(-10px, 0, 0)
object-fit: cover
figcaption
position: absolute
top: 0
right: 0
bottom: 0
left: 0
z-index: 1000
opacity: 0
p
@extend .limit-more-line
margin: 0
padding: .4rem 0 0
letter-spacing: 1px
font-size: 1.1em
line-height: 1.5
opacity: 0
transition: opacity .35s, transform .35s
transform: translate3d(100%, 0, 0)
-webkit-line-clamp: 4
.gallery-group-name
@extend .limit-more-line
position: relative
margin: 0
padding: .4rem 0
font-weight: bold
font-size: 1.65em
line-height: 1.5
-webkit-line-clamp: 2
&:after
position: absolute
bottom: 0
left: 0
padding: 30px
width: 100%
height: 2px
background: $gallery-color
content: ''
transition: transform .35s
transform: translate3d(-100%, 0, 0)
height: 100%
color: $gallery-color
text-transform: uppercase
backface-visibility: hidden
.gallery-group-main
overflow: auto
padding: 0 0 .8rem
& > a
position: absolute
top: 0
right: 0
bottom: 0
left: 0
z-index: 1000
opacity: 0
.justified-gallery
margin: 0 0 .8rem
p
@extend .limit-more-line
margin: 0
padding: 8px 0 0
letter-spacing: 1px
font-size: 1.1em
line-height: 1.5
opacity: 0
transition: opacity .35s, transform .35s
transform: translate3d(100%, 0, 0)
-webkit-line-clamp: 4
img
.gallery-group-name
@extend .limit-more-line
position: relative
margin: 0
padding: 8px 0
font-weight: bold
font-size: 1.65em
line-height: 1.5
-webkit-line-clamp: 2
&:after
position: absolute
bottom: 0
left: 0
width: 100%
height: 2px
background: $gallery-color
content: ''
transition: transform .35s
transform: translate3d(-100%, 0, 0)
.gallery-group-main
overflow: auto
padding: 0 0 16px
.fj-gallery
margin: 0 0 16px
opacity: 0
.img-alt
display: none
.fancybox
width: auto
text-align: inherit
.img-alt
display: none
+2 -2
View File
@@ -11,13 +11,13 @@ blockquote
&.right
float: right
margin: 1em 0 0 .5rem
margin: 1em 0 0 .5em
// hexo tag video
.video-container
position: relative
overflow: hidden
margin-bottom: .8rem
margin-bottom: 16px
padding-top: 56.25%
height: 0
+10 -7
View File
@@ -3,10 +3,13 @@
.hide-block
& > .hide-button
display: inline-block
padding: .3rem 1rem
padding: 6px 20px
background: $tag-hide-bg
color: var(--white)
&:hover
background-color: var(--btn-hover-color)
&.open
display: none
@@ -21,20 +24,20 @@
.hide-inline
& > .hide-button
margin: 0 .3rem
margin: 0 6px
& > .hide-content
margin: 0 .3rem
margin: 0 6px
.hide-block
margin: 0 0 .8rem
margin: 0 0 16px
.hide-toggle
margin-bottom: 1rem
margin-bottom: 20px
border: 1px solid $tag-hide-toggle-bg
& > .hide-button
padding: .3rem .5rem
padding: 6px 10px
background: $tag-hide-toggle-bg
color: #1F2D3D
cursor: pointer
@@ -52,4 +55,4 @@
& > .hide-content
display: none
margin: 1.5rem 1.2rem
margin: 30px 24px
+1 -1
View File
@@ -6,6 +6,6 @@
&.default
background-color: $btn-default-color
for $type in $tagsP-types
for $type in $color-types
&.{$type}
background-color: lookup('$tagsP-' + $type + '-color')
+8 -8
View File
@@ -1,22 +1,22 @@
.note
$note-icons = hexo-config('note.icons')
position: relative
margin: 0 0 1rem
margin: 0 0 20px
padding: 15px
if hexo-config('note.border_radius') is a 'unit'
border-radius: unit(hexo-config('note.border_radius'), px)
&.icon
padding-left: 2.25rem
padding-left: 3em
& > .note-icon
position: absolute
top: calc(50% - .4rem)
left: .7rem
top: calc(50% - .5em)
left: .8em
font-size: larger
for $type in $tagsP-types
for $type in $color-types
&.{$type}
&:not(.disabled)
border-left-color: lookup('$tagsP-' + $type + '-color') !important
@@ -75,12 +75,12 @@
if $note-icons
&:not(.no-icon)
padding-left: 2.25rem
padding-left: 3em
&::before
position: absolute
top: calc(50% - .8rem)
left: .7rem
top: calc(50% - .95em)
left: .8em
font-size: larger
@extend .fontawesomeIcon
+4 -4
View File
@@ -2,7 +2,7 @@
#article-container
.tabs
position: relative
margin: 0 0 1rem
margin: 0 0 20px
border-right: 1px solid var(--tab-border-color)
border-bottom: 1px solid var(--tab-border-color)
border-left: 1px solid var(--tab-border-color)
@@ -24,7 +24,7 @@
button
display: block
padding: .5rem 1rem
padding: 8px 18px
width: 100%
border-top: 2px solid var(--tab-border-color)
background: var(--tab-botton-bg)
@@ -51,10 +51,10 @@
.tab-item-content
position: relative
display: none
padding: 1.8rem 1.2rem
padding: 36px 24px
+maxWidth768()
padding: 1.2rem .7rem
padding: 24px 14px
&.active
display: block
@@ -0,0 +1,68 @@
#article-container
.timeline
margin: 0 0 20px 10px
padding: 14px 20px 5px
border-left: 2px solid var(--timeline-color, $theme-color)
for $type in $color-types
&.{$type}
--timeline-color: lookup('$tagsP-' + $type + '-color')
--timeline-bg: s('rgba(%s,%s,%s, 0.2)', red(lookup('$tagsP-' + $type + '-color')), green(lookup('$tagsP-' + $type + '-color')), blue(lookup('$tagsP-' + $type + '-color')))
.timeline-item
margin: 0 0 15px
&:hover
.item-circle
&:before
border-color: var(--timeline-color, $theme-color)
&.headline
.timeline-item-title
.item-circle
> p
font-weight: 600
font-size: 1.2em
&:before
left: -28px
border: 4px solid var(--timeline-color, $theme-color)
&:hover
.item-circle
&:before
border-color: var(--pseudo-hover)
.timeline-item-title
position: relative
.item-circle
&:before
position: absolute
top: 50%
left: -27px
width: 6px
height: 6px
border: 3px solid var(--pseudo-hover)
border-radius: 50%
background: var(--card-bg)
content: ''
transition: all .3s
transform: translate(0, -50%)
> p
margin: 0 0 8px
font-weight: 500
.timeline-item-content
position: relative
padding: 12px 15px
border-radius: 8px
background: var(--timeline-bg, lighten($theme-color, 85%))
font-size: .93em
& > :last-child
margin-bottom: 0
& + .timeline
margin-top: -20px
-27
View File
@@ -1,27 +0,0 @@
[data-theme="dark"]
#post .post-copyright {
background-color: rgb(7 8 10);
text-shadow: #bfbeb8 1px 0 4px;
}
[data-theme="dark"]
#post .post-copyright {
border: 1px solid rgb(19 18 18 / 35%);
}
[data-theme="dark"]
.post-copyright-info {
color: #e0e0e4;
}
[data-theme="dark"]
.copyright {
color: #e0e0e4;
}
[data-theme="dark"]
.footer_custom_text {
color: #e0e0e4;
}
#post .post-copyright__title{
font-size:22px;
}
#post .post-copyright__notice{
font-size:15px;
}
-63
View File
@@ -1,63 +0,0 @@
.xdsoft_flipcountdown{display:inline-block;}
.xdsoft_flipcountdown .xdsoft_digit{float:left;background-repeat:no-repeat;}
.xdsoft_flipcountdown .xdsoft_clearex{clear:both;float:none;}
.xdsoft_flipcountdown .xdsoft_digit{
background-position:0px 0px;
}
.xdsoft_flipcountdown .xdsoft_digit.xdsoft_separator,.xdsoft_flipcountdown .xdsoft_digit.xdsoft_dot{
opacity:0.9;
}
.xdsoft_flipcountdown.xdsoft_size_lg .xdsoft_digit{
width:53px;
height:76px;
background-image:url(/img/digit-lg.png);
}
.xdsoft_flipcountdown.xdsoft_size_lg .xdsoft_digit.xdsoft_space,
.xdsoft_flipcountdown.xdsoft_size_lg .xdsoft_digit.xdsoft_separator,
.xdsoft_flipcountdown.xdsoft_size_lg .xdsoft_digit.xdsoft_dot{
width:14px;
background-position:-19px -4620px;
}
.xdsoft_flipcountdown.xdsoft_size_lg .xdsoft_digit.xdsoft_dot{
background-position:-41px -4620px;
}
.xdsoft_flipcountdown.xdsoft_size_lg .xdsoft_digit.xdsoft_space{
background-position:-100px -4620px;
}
.xdsoft_flipcountdown.xdsoft_size_md .xdsoft_digit{
width:36px;
height:51px;
background-image:url(/img/digit-md.png);
}
.xdsoft_flipcountdown.xdsoft_size_md .xdsoft_digit.xdsoft_space,
.xdsoft_flipcountdown.xdsoft_size_md .xdsoft_digit.xdsoft_separator,
.xdsoft_flipcountdown.xdsoft_size_md .xdsoft_digit.xdsoft_dot{
width:10px;
background-position:-13px -3120px;
}
.xdsoft_flipcountdown.xdsoft_size_sm .xdsoft_digit{
width:24px;
height:34px;
background-image:url(/img/digit-sm.png);
}
.xdsoft_flipcountdown.xdsoft_size_sm .xdsoft_digit.xdsoft_space,
.xdsoft_flipcountdown.xdsoft_size_sm .xdsoft_digit.xdsoft_separator,
.xdsoft_flipcountdown.xdsoft_size_sm .xdsoft_digit.xdsoft_dot{
width:10px;
background-position:-6px -2100px;
}
.xdsoft_flipcountdown.xdsoft_size_xs .xdsoft_digit{
width:16px;
height:23px;
background-image:url(/img/digit-xs.png);
}
.xdsoft_flipcountdown.xdsoft_size_xs .xdsoft_digit.xdsoft_space,
.xdsoft_flipcountdown.xdsoft_size_xs .xdsoft_digit.xdsoft_separator,
.xdsoft_flipcountdown.xdsoft_size_xs .xdsoft_digit.xdsoft_dot{
width:5px;
background-position:-5px -1440px;
}
+11 -6
View File
@@ -24,13 +24,12 @@ $hr-icon = $hrEnable && hexo-config('hr_icon.icon') ? hexo-config('hr_icon.icon'
$hr-icon-top = $hrEnable && hexo-config('hr_icon.icon-top') ? convert(hexo-config('hr_icon.icon-top')) : -10px
// page beatutify
$beautifyEnable = hexo-config('beautify.enable')
$title-prefix-icon = $beautifyEnable ? hexo-config('beautify.title-prefix-icon') : '\f0c1'
$title-prefix-icon-color = $beautifyEnable ? convert(hexo-config('beautify.title-prefix-icon-color')) : $light-red
$title-prefix-icon = $beautifyEnable && hexo-config('beautify.title-prefix-icon') ? hexo-config('beautify.title-prefix-icon') : '\f0c1'
$title-prefix-icon-color = $beautifyEnable && hexo-config('beautify.title-prefix-icon-color') ? convert(hexo-config('beautify.title-prefix-icon-color')) : $light-red
// Global Variables
$font-size = hexo-config('font.global-font-size') ? convert(hexo-config('font.global-font-size')) : 14px
$code-font-size = hexo-config('font.code-font-size') ? convert(hexo-config('font.code-font-size')) : var(--global-font-size)
$font-color = #1F2D3D
$rem = 20px
$text-line-height = 2
$web-bg = hexo-config('background') && unquote(hexo-config('background'))
$index_top_img_height = hexo-config('index_top_img_height') ? convert(hexo-config('index_top_img_height')) : 100vh
@@ -40,6 +39,7 @@ $light-blue = $theme-color
$dark-black = #000000
$light-grey = #EEEEEE
$grey = #858585
$dark-grey = #cacaca
$white = #FFFFFF
$whitesmoke = #f5f5f5
$font-black = #4C4948
@@ -62,13 +62,16 @@ $sidebar-background = #f6f8fa
$sidebar-width = 300px
// aside
$toc-link-color = #666261
$toc-mobile-width = 300px
$toc-mobile-width = calc(100% - 80px)
$toc-mobile-maxWidth = 380px
$toc-active-color = #fff
// Button
$button-color = #fff
$button-hover-color = $themeColorEnable && hexo-config('theme_color.button_hover') ? convert(hexo-config('theme_color.button_hover')) : $light-orange
$button-bg = $theme-color
$pseudo-hover = $button-hover-color
// scrollbar
$scrollbar-color= $themeColorEnable && hexo-config('theme_color.scrollbar_color') ? convert(hexo-config('theme_color.scrollbar_color')) : $theme-color
// table
$table-thead-bg = #99a9bf
// reward
@@ -159,7 +162,7 @@ $note-modern-danger-bg = lighten(spin($note-modern-danger-border, 10), 35% + ($l
$note-modern-danger-text = #a94442
$note-modern-danger-hover = darken(spin($note-modern-danger-text, -10), 22%)
// Tag Plugins - Button/note
$tagsP-types = 'blue' 'pink' 'red' 'purple' 'orange' 'green'
$color-types = 'blue' 'pink' 'red' 'purple' 'orange' 'green'
$btn-color = #fff
$btn-default-color = #777
$tagsP-blue-color = #428bca
@@ -175,4 +178,6 @@ $tab-botton-color = $font-color
$tab-button-hover-bg = darken($tab-border-color, 8)
$tab-active-border-color = $theme-color
$tab-button-active-bg = $card-bg
$tab-to-top-color = #99a9bf
$tab-to-top-color = #99a9bf
// Tag Plugins - timeline
$timeline-default-color = $theme-color
-9
View File
@@ -1,9 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1366 362">
<linearGradient id="a" x1="428.258" x2="434.145" y1="404.15" y2="409.85" gradientUnits="userSpaceOnUse" gradientTransform="matrix(94.045 0 0 -94.072 -40381.527 38479.52)">
<stop offset="0" stop-color="#00aeff"/>
<stop offset="1" stop-color="#3369e7"/>
</linearGradient>
<path fill="url(#a)" d="M61.8 15.4h242.8c23.9 0 43.4 19.4 43.4 43.4v242.9c0 23.9-19.4 43.4-43.4 43.4H61.8c-23.9 0-43.4-19.4-43.4-43.4v-243c0-23.9 19.4-43.3 43.4-43.3z"/>
<path fill="#FFF" d="M187 98.7c-51.4 0-93.1 41.7-93.1 93.2S135.6 285 187 285s93.1-41.7 93.1-93.2-41.6-93.1-93.1-93.1zm0 158.8c-36.2 0-65.6-29.4-65.6-65.6s29.4-65.6 65.6-65.6 65.6 29.4 65.6 65.6-29.3 65.6-65.6 65.6zm0-117.8v48.9c0 1.4 1.5 2.4 2.8 1.7l43.4-22.5c1-.5 1.3-1.7.8-2.7-9-15.8-25.7-26.6-45-27.3-1 0-2 .8-2 1.9zm-60.8-35.9l-5.7-5.7c-5.6-5.6-14.6-5.6-20.2 0l-6.8 6.8c-5.6 5.6-5.6 14.6 0 20.2l5.6 5.6c.9.9 2.2.7 3-.2 3.3-4.5 6.9-8.8 10.9-12.8 4.1-4.1 8.3-7.7 12.9-11 1-.6 1.1-2 .3-2.9zM217.5 89V77.7c0-7.9-6.4-14.3-14.3-14.3h-33.3c-7.9 0-14.3 6.4-14.3 14.3v11.6c0 1.3 1.2 2.2 2.5 1.9 9.3-2.7 19.1-4.1 29-4.1 9.5 0 18.9 1.3 28 3.8 1.2.3 2.4-.6 2.4-1.9z"/>
<path fill="#182359" d="M842.5 267.6c0 26.7-6.8 46.2-20.5 58.6-13.7 12.4-34.6 18.6-62.8 18.6-10.3 0-31.7-2-48.8-5.8l6.3-31c14.3 3 33.2 3.8 43.1 3.8 15.7 0 26.9-3.2 33.6-9.6s10-15.9 10-28.5v-6.4c-3.9 1.9-9 3.8-15.3 5.8-6.3 1.9-13.6 2.9-21.8 2.9-10.8 0-20.6-1.7-29.5-5.1-8.9-3.4-16.6-8.4-22.9-15-6.3-6.6-11.3-14.9-14.8-24.8s-5.3-27.6-5.3-40.6c0-12.2 1.9-27.5 5.6-37.7 3.8-10.2 9.2-19 16.5-26.3 7.2-7.3 16-12.9 26.3-17s22.4-6.7 35.5-6.7c12.7 0 24.4 1.6 35.8 3.5 11.4 1.9 21.1 3.9 29 6.1v155.2zm-108.7-77.2c0 16.4 3.6 34.6 10.8 42.2 7.2 7.6 16.5 11.4 27.9 11.4 6.2 0 12.1-.9 17.6-2.6 5.5-1.7 9.9-3.7 13.4-6.1v-97.1c-2.8-.6-14.5-3-25.8-3.3-14.2-.4-25 5.4-32.6 14.7-7.5 9.3-11.3 25.6-11.3 40.8zm294.3 0c0 13.2-1.9 23.2-5.8 34.1s-9.4 20.2-16.5 27.9c-7.1 7.7-15.6 13.7-25.6 17.9s-25.4 6.6-33.1 6.6c-7.7-.1-23-2.3-32.9-6.6-9.9-4.3-18.4-10.2-25.5-17.9-7.1-7.7-12.6-17-16.6-27.9s-6-20.9-6-34.1c0-13.2 1.8-25.9 5.8-36.7 4-10.8 9.6-20 16.8-27.7s15.8-13.6 25.6-17.8c9.9-4.2 20.8-6.2 32.6-6.2s22.7 2.1 32.7 6.2c10 4.2 18.6 10.1 25.6 17.8 7.1 7.7 12.6 16.9 16.6 27.7 4.2 10.8 6.3 23.5 6.3 36.7zm-40 .1c0-16.9-3.7-31-10.9-40.8-7.2-9.9-17.3-14.8-30.2-14.8-12.9 0-23 4.9-30.2 14.8-7.2 9.9-10.7 23.9-10.7 40.8 0 17.1 3.6 28.6 10.8 38.5 7.2 10 17.3 14.9 30.2 14.9 12.9 0 23-5 30.2-14.9 7.2-10 10.8-21.4 10.8-38.5zm127.1 86.4c-64.1.3-64.1-51.8-64.1-60.1L1051 32l39.1-6.2v183.6c0 4.7 0 34.5 25.1 34.6v32.9zm68.9 0h-39.3V108.1l39.3-6.2v175zm-19.7-193.5c13.1 0 23.8-10.6 23.8-23.7S1177.6 36 1164.4 36s-23.8 10.6-23.8 23.7 10.7 23.7 23.8 23.7zm117.4 18.6c12.9 0 23.8 1.6 32.6 4.8 8.8 3.2 15.9 7.7 21.1 13.4s8.9 13.5 11.1 21.7c2.3 8.2 3.4 17.2 3.4 27.1v100.6c-6 1.3-15.1 2.8-27.3 4.6s-25.9 2.7-41.1 2.7c-10.1 0-19.4-1-27.7-2.9-8.4-1.9-15.5-5-21.5-9.3-5.9-4.3-10.5-9.8-13.9-16.6-3.3-6.8-5-16.4-5-26.4 0-9.6 1.9-15.7 5.6-22.3 3.8-6.6 8.9-12 15.3-16.2 6.5-4.2 13.9-7.2 22.4-9s17.4-2.7 26.6-2.7c4.3 0 8.8.3 13.6.8s9.8 1.4 15.2 2.7v-6.4c0-4.5-.5-8.8-1.6-12.8-1.1-4.1-3-7.6-5.6-10.7-2.7-3.1-6.2-5.5-10.6-7.2s-10-3-16.7-3c-9 0-17.2 1.1-24.7 2.4-7.5 1.3-13.7 2.8-18.4 4.5l-4.7-32.1c4.9-1.7 12.2-3.4 21.6-5.1s19.5-2.6 30.3-2.6zm3.3 141.9c12 0 20.9-.7 27.1-1.9v-39.8c-2.2-.6-5.3-1.3-9.4-1.9-4.1-.6-8.6-1-13.6-1-4.3 0-8.7.3-13.1 1-4.4.6-8.4 1.8-11.9 3.5s-6.4 4.1-8.5 7.2c-2.2 3.1-3.2 4.9-3.2 9.6 0 9.2 3.2 14.5 9 18 5.9 3.6 13.7 5.3 23.6 5.3zM512.9 103c12.9 0 23.8 1.6 32.6 4.8 8.8 3.2 15.9 7.7 21.1 13.4 5.3 5.8 8.9 13.5 11.1 21.7 2.3 8.2 3.4 17.2 3.4 27.1v100.6c-6 1.3-15.1 2.8-27.3 4.6-12.2 1.8-25.9 2.7-41.1 2.7-10.1 0-19.4-1-27.7-2.9-8.4-1.9-15.5-5-21.5-9.3-5.9-4.3-10.5-9.8-13.9-16.6-3.3-6.8-5-16.4-5-26.4 0-9.6 1.9-15.7 5.6-22.3 3.8-6.6 8.9-12 15.3-16.2 6.5-4.2 13.9-7.2 22.4-9s17.4-2.7 26.6-2.7c4.3 0 8.8.3 13.6.8 4.7.5 9.8 1.4 15.2 2.7v-6.4c0-4.5-.5-8.8-1.6-12.8-1.1-4.1-3-7.6-5.6-10.7-2.7-3.1-6.2-5.5-10.6-7.2-4.4-1.7-10-3-16.7-3-9 0-17.2 1.1-24.7 2.4-7.5 1.3-13.7 2.8-18.4 4.5l-4.7-32.1c4.9-1.7 12.2-3.4 21.6-5.1 9.4-1.8 19.5-2.6 30.3-2.6zm3.4 142c12 0 20.9-.7 27.1-1.9v-39.8c-2.2-.6-5.3-1.3-9.4-1.9-4.1-.6-8.6-1-13.6-1-4.3 0-8.7.3-13.1 1-4.4.6-8.4 1.8-11.9 3.5s-6.4 4.1-8.5 7.2c-2.2 3.1-3.2 4.9-3.2 9.6 0 9.2 3.2 14.5 9 18s13.7 5.3 23.6 5.3zm158.5 31.9c-64.1.3-64.1-51.8-64.1-60.1L610.6 32l39.1-6.2v183.6c0 4.7 0 34.5 25.1 34.6v32.9z"/>
</svg>

Before

Width:  |  Height:  |  Size: 4.3 KiB

-190
View File
@@ -1,190 +0,0 @@
/**
* @preserve jQuery flipcountdown plugin v3.0.4
* @homepage http://xdsoft.net/jqplugins/flipcountdown/
* (c) 2013, Chupurnov Valeriy.
*/
(function($){
jQuery.fn.flipCountDown = jQuery.fn.flipcountdown = function( _options ){
var default_options = {
showHour :true,
showMinute :true,
showSecond :true,
am :false,
tzoneOffset :0,
speedFlip :60,
period :1000,
tick :function(){
return new Date();
},
autoUpdate :true,
size :'md'
},
sizes = {
lg:77,
md:52,
sm:35,
xs:24
},
createFlipCountDown = function( $box ){
let $flipcountdown = $('<div class="xdsoft_flipcountdown"></div>'),
$clearex = $('<div class="xdsoft_clearex"></div>'),
options = $.extend({},default_options),
timer = 0,
_animateRange = function( box,a,b ){
_animateOne( box,a,(a>b&&!(a==9&&b==0))?-1:1,!(a==9&&b==0)?Math.abs(a-b):1 );
},
_animateOne = function( box,a,arrow,range ){
if( range<1 )
return;
_setMargin(box,-(a*6*sizes[options.size]+1),1,arrow,function(){
_animateOne(box,a+arrow,arrow,range-1);
},range);
},
_setMargin = function( box, marginTop, rec, arrow,callback,range){
if( marginTop<=-sizes[options.size]*60 )
marginTop = -1;
box.css('background-position','0px '+marginTop+'px' );
if( rec<=6 ){
setTimeout(function(){
_setMargin(box, marginTop-arrow*sizes[options.size], ++rec, arrow, callback,range);
},parseInt(options.speedFlip/range));
}else
callback();
},
blocks = [],
_typeCompare = function ( a,b ){
return a&&b&&(
(a==b)||
(/^[0-9]+$/.test(a+''+b))||
(/^[:.\s]+$/.test(a+''+b))
);
},
_generate = function( chars ){
if( !(chars instanceof Array) || !chars.length )
return false;
for( var i = 0, n = chars.length;i<n;i++ ){
if( !blocks[i] ){
blocks[i] = $('<div class="xdsoft_digit"></div>');
$clearex.before(blocks[i]);
}
if( blocks[i].data('value')!=chars[i] ){
if( !_typeCompare(blocks[i].data('value'),chars[i]) ){
blocks[i]
.removeClass('xdsoft_separator')
.removeClass('xdsoft_dot');
switch( chars[i] ){
case ':':blocks[i].addClass('xdsoft_separator');break;
case '.':blocks[i].addClass('xdsoft_dot');break;
case ' ':blocks[i].addClass('xdsoft_space');break;
}
}
if( !isNaN(chars[i]) ){
var old = parseInt(blocks[i].data('value')),
ii = parseInt(blocks[i].data('i')),
crnt = parseInt(chars[i]);
if( isNaN(old)||i!=ii ){
old = (crnt-1)<0?9:crnt-1;
}
_animateRange(blocks[i],old,crnt);
}
blocks[i].data('value',chars[i]);
blocks[i].data('i',i);
}
}
if( blocks.length>chars.length ){
for(;i<blocks.length;i++ ){
blocks[i][0].parentNode.removeChild(blocks[i][0]);
delete blocks[i];
}
blocks.splice(chars.length);
}
},
counter = 0,
_calcMoment = function(){
var value = '1',chars = [];
if(options.tick)
value = (options.tick instanceof Function)?options.tick.call($box,counter):options.tick;
if( typeof value!=='undefined' ){
switch( value.constructor ){
case Date:
var h = (value.getHours()+options.tzoneOffset)%(options.am?12:24);
if( options.showHour ){
chars.push(parseInt(h/10));
chars.push(h%10);
}
if( options.showHour && (options.showMinute || options.showSecond) )
chars.push(':');
if( options.showMinute ){
chars.push(parseInt(value.getMinutes()/10));
chars.push(value.getMinutes() % 10);
}
if( options.showMinute && options.showSecond )
chars.push(':');
if( options.showSecond ){
chars.push(parseInt(value.getSeconds()/10));
chars.push(value.getSeconds() % 10);
}
break;
case String:
chars = value.replace(/[^0-9\:\.\s]/g,'').split('');
break;
case Number:
chars = value.toString().split('');
break;
}
_generate(chars);
}
};
$flipcountdown
.append($clearex)
.on('xdinit.xdsoft',function(){
clearInterval(timer);
if( options.autoUpdate )
timer = setInterval( _calcMoment,options.period );
_calcMoment();
});
$box.data('setOptions',function( _options ){
options = $.extend({},options,_options);
if( !sizes[options.size] )
options.size = 'lg';
$flipcountdown
.addClass('xdsoft_size_'+options.size)
.trigger('xdinit.xdsoft');
});
$box.append($flipcountdown);
};
return this.each(function(){
var $box = $(this);
if( !$box.data('setOptions') ){
$box.addClass('xdsoft')
createFlipCountDown($box);
}
$box.data('setOptions')&&
$.isFunction($box.data('setOptions'))&&
$box.data('setOptions')(_options);
});
}
})(jQuery);
+207 -293
View File
@@ -1,23 +1,23 @@
document.addEventListener('DOMContentLoaded', function () {
const $blogName = document.getElementById('site-name')
let blogNameWidth = $blogName && $blogName.offsetWidth
const $menusEle = document.querySelector('#menus .menus_items')
let menusWidth = $menusEle && $menusEle.offsetWidth
const $searchEle = document.querySelector('#search-button')
let searchWidth = $searchEle && $searchEle.offsetWidth
let blogNameWidth, menusWidth, searchWidth, $nav
let mobileSidebarOpen = false
const adjustMenu = (change = false) => {
if (change) {
blogNameWidth = $blogName && $blogName.offsetWidth
menusWidth = $menusEle && $menusEle.offsetWidth
searchWidth = $searchEle && $searchEle.offsetWidth
const adjustMenu = (init) => {
if (init) {
blogNameWidth = document.getElementById('site-name').offsetWidth
const $menusEle = document.querySelectorAll('#menus .menus_item')
menusWidth = 0
$menusEle.length && $menusEle.forEach(i => { menusWidth += i.offsetWidth })
const $searchEle = document.querySelector('#search-button')
searchWidth = $searchEle ? $searchEle.offsetWidth : 0
$nav = document.getElementById('nav')
}
const $nav = document.getElementById('nav')
let t
if (window.innerWidth < 768) t = true
else t = blogNameWidth + menusWidth + searchWidth > $nav.offsetWidth - 120
if (t) {
let hideMenuIndex = ''
if (window.innerWidth < 768) hideMenuIndex = true
else hideMenuIndex = blogNameWidth + menusWidth + searchWidth > $nav.offsetWidth - 120
if (hideMenuIndex) {
$nav.classList.add('hide-menu')
} else {
$nav.classList.remove('hide-menu')
@@ -26,49 +26,32 @@ document.addEventListener('DOMContentLoaded', function () {
// 初始化header
const initAdjust = () => {
adjustMenu()
document.getElementById('nav').classList.add('show')
adjustMenu(true)
$nav.classList.add('show')
}
// sidebar menus
const sidebarFn = () => {
const $toggleMenu = document.getElementById('toggle-menu')
const $mobileSidebarMenus = document.getElementById('sidebar-menus')
const $menuMask = document.getElementById('menu-mask')
const $body = document.body
function openMobileSidebar () {
const sidebarFn = {
open: () => {
btf.sidebarPaddingR()
$body.style.overflow = 'hidden'
btf.fadeIn($menuMask, 0.5)
$mobileSidebarMenus.classList.add('open')
}
function closeMobileSidebar () {
document.body.style.overflow = 'hidden'
btf.animateIn(document.getElementById('menu-mask'), 'to_show 0.5s')
document.getElementById('sidebar-menus').classList.add('open')
mobileSidebarOpen = true
},
close: () => {
const $body = document.body
$body.style.overflow = ''
$body.style.paddingRight = ''
btf.fadeOut($menuMask, 0.5)
$mobileSidebarMenus.classList.remove('open')
btf.animateOut(document.getElementById('menu-mask'), 'to_hide 0.5s')
document.getElementById('sidebar-menus').classList.remove('open')
mobileSidebarOpen = false
}
$toggleMenu.addEventListener('click', openMobileSidebar)
$menuMask.addEventListener('click', e => {
if ($mobileSidebarMenus.classList.contains('open')) {
closeMobileSidebar()
}
})
window.addEventListener('resize', e => {
if (btf.isHidden($toggleMenu)) {
if ($mobileSidebarMenus.classList.contains('open')) closeMobileSidebar()
}
})
}
/**
* 首頁top_img底下的箭頭
*/
* 首頁top_img底下的箭頭
*/
const scrollDownInIndex = () => {
const $scrollDownEle = document.getElementById('scroll-down')
$scrollDownEle && $scrollDownEle.addEventListener('click', function () {
@@ -77,9 +60,9 @@ document.addEventListener('DOMContentLoaded', function () {
}
/**
* 代碼
* 只適用於Hexo默認的代碼渲染
*/
* 代碼
* 只適用於Hexo默認的代碼渲染
*/
const addHighlightTool = function () {
const highLight = GLOBAL_CONFIG.highlight
if (!highLight) return
@@ -220,115 +203,64 @@ document.addEventListener('DOMContentLoaded', function () {
}
/**
* PhotoFigcaption
*/
* PhotoFigcaption
*/
function addPhotoFigcaption () {
document.querySelectorAll('#article-container img').forEach(function (item) {
const parentEle = item.parentNode
if (!parentEle.parentNode.classList.contains('justified-gallery')) {
const altValue = item.title || item.alt
if (altValue && !parentEle.parentNode.classList.contains('justified-gallery')) {
const ele = document.createElement('div')
ele.className = 'img-alt is-center'
ele.textContent = item.getAttribute('alt')
ele.textContent = altValue
parentEle.insertBefore(ele, item.nextSibling)
}
})
}
/**
* justified-gallery 圖庫排版
* 需要 jQuery
*/
let detectJgJsLoad = false
const runJustifiedGallery = function (ele) {
const $justifiedGallery = $(ele)
const $imgList = $justifiedGallery.find('img')
$imgList.unwrap()
if ($imgList.length) {
$imgList.each(function (i, o) {
if ($(o).attr('data-lazy-src')) $(o).attr('src', $(o).attr('data-lazy-src'))
$(o).wrap('<div></div>')
})
}
if (detectJgJsLoad) btf.initJustifiedGallery($justifiedGallery)
else {
$('head').append(`<link rel="stylesheet" type="text/css" href="${GLOBAL_CONFIG.source.justifiedGallery.css}">`)
$.getScript(`${GLOBAL_CONFIG.source.justifiedGallery.js}`, function () {
btf.initJustifiedGallery($justifiedGallery)
})
detectJgJsLoad = true
}
* Lightbox
*/
const runLightbox = () => {
btf.loadLightbox(document.querySelectorAll('#article-container img:not(.no-lightbox)'))
}
/**
* fancybox和 mediumZoom
*/
const addFancybox = function (ele) {
const runFancybox = (ele) => {
ele.each(function (i, o) {
const $this = $(o)
const lazyloadSrc = $this.attr('data-lazy-src') || $this.attr('src')
const dataCaption = $this.attr('alt') || ''
$this.wrap(`<a href="${lazyloadSrc}" data-fancybox="group" data-caption="${dataCaption}" class="fancybox"></a>`)
})
* justified-gallery 圖庫排版
*/
const runJustifiedGallery = function (ele) {
ele.forEach(item => {
const $imgList = item.querySelectorAll('img')
$().fancybox({
selector: '[data-fancybox]',
loop: true,
transitionEffect: 'slide',
protect: true,
buttons: ['slideShow', 'fullScreen', 'thumbs', 'close'],
hash: false
})
}
if (typeof $.fancybox === 'undefined') {
$('head').append(`<link rel="stylesheet" type="text/css" href="${GLOBAL_CONFIG.source.fancybox.css}">`)
$.getScript(`${GLOBAL_CONFIG.source.fancybox.js}`, function () {
runFancybox($(ele))
})
} else {
runFancybox($(ele))
}
}
const addMediumZoom = () => {
const zoom = mediumZoom(document.querySelectorAll('#article-container :not(a):not(.flink-item-icon) > img'))
zoom.on('open', e => {
const photoBg = document.documentElement.getAttribute('data-theme') === 'dark' ? '#121212' : '#fff'
zoom.update({
background: photoBg
$imgList.forEach(i => {
const dataLazySrc = i.getAttribute('data-lazy-src')
if (dataLazySrc) i.src = dataLazySrc
btf.wrap(i, 'div', { class: 'fj-gallery-item' })
})
})
}
const jqLoadAndRun = () => {
const $fancyboxEle = GLOBAL_CONFIG.lightbox === 'fancybox'
? document.querySelectorAll('#article-container :not(a):not(.gallery-group):not(.flink-item-icon) > img, #article-container > img')
: []
const fbLengthNoZero = $fancyboxEle.length > 0
const $jgEle = document.querySelectorAll('#article-container .justified-gallery')
const jgLengthNoZero = $jgEle.length > 0
if (jgLengthNoZero || fbLengthNoZero) {
btf.isJqueryLoad(() => {
jgLengthNoZero && runJustifiedGallery($jgEle)
fbLengthNoZero && addFancybox($fancyboxEle)
})
if (window.fjGallery) {
setTimeout(() => { btf.initJustifiedGallery(ele) }, 100)
return
}
const newEle = document.createElement('link')
newEle.rel = 'stylesheet'
newEle.href = GLOBAL_CONFIG.source.justifiedGallery.css
document.body.appendChild(newEle)
getScript(`${GLOBAL_CONFIG.source.justifiedGallery.js}`).then(() => { btf.initJustifiedGallery(ele) })
}
/**
* 滾動處理
*/
* 滾動處理
*/
const scrollFn = function () {
const $rightside = document.getElementById('rightside')
const innerHeight = window.innerHeight + 56
// 當滾動條小于 56 的時候
if (document.body.scrollHeight <= innerHeight) {
$rightside.style.cssText = 'opacity: 1; transform: translateX(-38px)'
$rightside.style.cssText = 'opacity: 1; transform: translateX(-58px)'
return
}
@@ -365,7 +297,7 @@ document.addEventListener('DOMContentLoaded', function () {
}
$header.classList.add('nav-fixed')
if (window.getComputedStyle($rightside).getPropertyValue('opacity') === '0') {
$rightside.style.cssText = 'opacity: 1; transform: translateX(-38px)'
$rightside.style.cssText = 'opacity: 0.8; transform: translateX(-58px)'
}
} else {
if (currentTop === 0) {
@@ -375,7 +307,7 @@ document.addEventListener('DOMContentLoaded', function () {
}
if (document.body.scrollHeight <= innerHeight) {
$rightside.style.cssText = 'opacity: 1; transform: translateX(-38px)'
$rightside.style.cssText = 'opacity: 0.8; transform: translateX(-58px)'
}
}, 200)()
}
@@ -384,86 +316,69 @@ document.addEventListener('DOMContentLoaded', function () {
}
/**
* toc
*/
const tocFn = function () {
const $cardTocLayout = document.getElementById('card-toc')
const $cardToc = $cardTocLayout.getElementsByClassName('toc-content')[0]
const $tocLink = $cardToc.querySelectorAll('.toc-link')
* toc,anchor
*/
const scrollFnToDo = function () {
const isToc = GLOBAL_CONFIG_SITE.isToc
const isAnchor = GLOBAL_CONFIG.isAnchor
const $article = document.getElementById('article-container')
// main of scroll
window.tocScrollFn = function () {
return btf.throttle(function () {
const currentTop = window.scrollY || document.documentElement.scrollTop
scrollPercent(currentTop)
findHeadPosition(currentTop)
}, 100)()
}
window.addEventListener('scroll', tocScrollFn)
if (!($article && (isToc || isAnchor))) return
const scrollPercent = function (currentTop) {
const docHeight = $article.clientHeight
const winHeight = document.documentElement.clientHeight
const headerHeight = $article.offsetTop
const contentMath = (docHeight > winHeight) ? (docHeight - winHeight) : (document.documentElement.scrollHeight - winHeight)
const scrollPercent = (currentTop - headerHeight) / (contentMath)
const scrollPercentRounded = Math.round(scrollPercent * 100)
const percentage = (scrollPercentRounded > 100) ? 100 : (scrollPercentRounded <= 0) ? 0 : scrollPercentRounded
$cardToc.setAttribute('progress-percentage', percentage)
}
let $tocLink, $cardToc, scrollPercent, autoScrollToc, isExpand
// anchor
const isAnchor = GLOBAL_CONFIG.isanchor
const updateAnchor = function (anchor) {
if (window.history.replaceState && anchor !== window.location.hash) {
if (!anchor) anchor = location.pathname
const title = GLOBAL_CONFIG_SITE.title
window.history.replaceState({
url: location.href,
title: title
}, title, anchor)
if (isToc) {
const $cardTocLayout = document.getElementById('card-toc')
$cardToc = $cardTocLayout.getElementsByClassName('toc-content')[0]
$tocLink = $cardToc.querySelectorAll('.toc-link')
const $tocPercentage = $cardTocLayout.querySelector('.toc-percentage')
isExpand = $cardToc.classList.contains('is-expand')
scrollPercent = currentTop => {
const docHeight = $article.clientHeight
const winHeight = document.documentElement.clientHeight
const headerHeight = $article.offsetTop
const contentMath = (docHeight > winHeight) ? (docHeight - winHeight) : (document.documentElement.scrollHeight - winHeight)
const scrollPercent = (currentTop - headerHeight) / (contentMath)
const scrollPercentRounded = Math.round(scrollPercent * 100)
const percentage = (scrollPercentRounded > 100) ? 100 : (scrollPercentRounded <= 0) ? 0 : scrollPercentRounded
$tocPercentage.textContent = percentage
}
}
const mobileToc = {
open: () => {
$cardTocLayout.style.cssText = 'animation: toc-open .3s; opacity: 1; right: 45px'
},
window.mobileToc = {
open: () => {
$cardTocLayout.style.cssText = 'animation: toc-open .3s; opacity: 1; right: 55px'
},
close: () => {
$cardTocLayout.style.animation = 'toc-close .2s'
setTimeout(() => {
$cardTocLayout.style.cssText = "opacity:''; animation: ''; right: ''"
}, 100)
close: () => {
$cardTocLayout.style.animation = 'toc-close .2s'
setTimeout(() => {
$cardTocLayout.style.cssText = "opacity:''; animation: ''; right: ''"
}, 100)
}
}
}
document.getElementById('mobile-toc-button').addEventListener('click', () => {
if (window.getComputedStyle($cardTocLayout).getPropertyValue('opacity') === '0') mobileToc.open()
else mobileToc.close()
})
// toc元素點擊
$cardToc.addEventListener('click', e => {
e.preventDefault()
const $target = e.target.classList.contains('toc-link')
? e.target
: e.target.parentElement
btf.scrollToDest(btf.getEleTop(document.getElementById(decodeURI($target.getAttribute('href')).replace('#', ''))), 300)
if (window.innerWidth < 900) {
window.mobileToc.close()
}
})
// toc元素點擊
$cardToc.addEventListener('click', (e) => {
e.preventDefault()
const $target = e.target.classList.contains('toc-link')
? e.target
: e.target.parentElement
btf.scrollToDest(btf.getEleTop(document.getElementById(decodeURI($target.getAttribute('href')).replace('#', ''))), 300)
if (window.innerWidth < 900) {
mobileToc.close()
}
})
const autoScrollToc = function (item) {
const activePosition = item.getBoundingClientRect().top
const sidebarScrollTop = $cardToc.scrollTop
if (activePosition > (document.documentElement.clientHeight - 100)) {
$cardToc.scrollTop = sidebarScrollTop + 150
}
if (activePosition < 100) {
$cardToc.scrollTop = sidebarScrollTop - 150
autoScrollToc = item => {
const activePosition = item.getBoundingClientRect().top
const sidebarScrollTop = $cardToc.scrollTop
if (activePosition > (document.documentElement.clientHeight - 100)) {
$cardToc.scrollTop = sidebarScrollTop + 150
}
if (activePosition < 100) {
$cardToc.scrollTop = sidebarScrollTop - 150
}
}
}
@@ -471,7 +386,7 @@ document.addEventListener('DOMContentLoaded', function () {
const list = $article.querySelectorAll('h1,h2,h3,h4,h5,h6')
let detectItem = ''
const findHeadPosition = function (top) {
if ($tocLink.length === 0 || top === 0) {
if (top === 0) {
return false
}
@@ -480,42 +395,55 @@ document.addEventListener('DOMContentLoaded', function () {
list.forEach(function (ele, index) {
if (top > btf.getEleTop(ele) - 80) {
currentId = '#' + encodeURI(ele.getAttribute('id'))
const id = ele.id
currentId = id ? '#' + encodeURI(id) : ''
currentIndex = index
}
})
if (detectItem === currentIndex) return
if (isAnchor) updateAnchor(currentId)
if (currentId === '') {
$cardToc.querySelectorAll('.active').forEach(i => { i.classList.remove('active') })
detectItem = currentIndex
return
}
if (isAnchor) btf.updateAnchor(currentId)
detectItem = currentIndex
$cardToc.querySelectorAll('.active').forEach(item => { item.classList.remove('active') })
const currentActive = $tocLink[currentIndex]
currentActive.classList.add('active')
if (isToc) {
$cardToc.querySelectorAll('.active').forEach(i => { i.classList.remove('active') })
setTimeout(() => {
autoScrollToc(currentActive)
}, 0)
if (currentId === '') {
return
}
let parent = currentActive.parentNode
const currentActive = $tocLink[currentIndex]
currentActive.classList.add('active')
for (; !parent.matches('.toc'); parent = parent.parentNode) {
if (parent.matches('li')) parent.classList.add('active')
setTimeout(() => {
autoScrollToc(currentActive)
}, 0)
if (isExpand) return
let parent = currentActive.parentNode
for (; !parent.matches('.toc'); parent = parent.parentNode) {
if (parent.matches('li')) parent.classList.add('active')
}
}
}
// main of scroll
window.tocScrollFn = function () {
return btf.throttle(function () {
const currentTop = window.scrollY || document.documentElement.scrollTop
isToc && scrollPercent(currentTop)
findHeadPosition(currentTop)
}, 100)()
}
window.addEventListener('scroll', tocScrollFn)
}
/**
* Rightside
*/
* Rightside
*/
const rightSideFn = {
switchReadMode: () => { // read-mode
const $body = document.body
@@ -546,11 +474,21 @@ document.addEventListener('DOMContentLoaded', function () {
}
// handle some cases
typeof utterancesTheme === 'function' && utterancesTheme()
typeof changeGiscusTheme === 'function' && changeGiscusTheme()
typeof FB === 'object' && window.loadFBComment()
window.DISQUS && document.getElementById('disqus_thread').children.length && setTimeout(() => window.disqusReset(), 200)
typeof runMermaid === 'function' && window.runMermaid()
},
showOrHideBtn: () => { // rightside 點擊設置 按鈕 展開
document.getElementById('rightside-config-hide').classList.toggle('show')
showOrHideBtn: (e) => { // rightside 點擊設置 按鈕 展開
const rightsideHideClassList = document.getElementById('rightside-config-hide').classList
rightsideHideClassList.toggle('show')
if (e.classList.contains('show')) {
rightsideHideClassList.add('status')
setTimeout(() => {
rightsideHideClassList.remove('status')
}, 300)
}
e.classList.toggle('show')
},
scrollToTop: () => { // Back to top
btf.scrollToDest(0, 500)
@@ -563,34 +501,23 @@ document.addEventListener('DOMContentLoaded', function () {
$htmlDom.toggle('hide-aside')
},
adjustFontSize: (plus) => {
const fontSizeVal = parseInt(window.getComputedStyle(document.documentElement).getPropertyValue('--global-font-size'))
let newValue = ''
if (plus) {
if (fontSizeVal >= 20) return
newValue = fontSizeVal + 1
document.documentElement.style.setProperty('--global-font-size', newValue + 'px')
!document.getElementById('nav').classList.contains('hide-menu') && adjustMenu(true)
} else {
if (fontSizeVal <= 10) return
newValue = fontSizeVal - 1
document.documentElement.style.setProperty('--global-font-size', newValue + 'px')
document.getElementById('nav').classList.contains('hide-menu') && adjustMenu(true)
}
saveToLocal.set('global-font-size', newValue, 2)
// document.getElementById('font-text').innerText = newValue
runMobileToc: () => {
if (window.getComputedStyle(document.getElementById('card-toc')).getPropertyValue('opacity') === '0') window.mobileToc.open()
else window.mobileToc.close()
}
}
document.getElementById('rightside').addEventListener('click', function (e) {
const $target = e.target.id || e.target.parentNode.id
switch ($target) {
const $target = e.target.id ? e.target : e.target.parentNode
switch ($target.id) {
case 'go-up':
rightSideFn.scrollToTop()
break
case 'rightside_config':
rightSideFn.showOrHideBtn()
rightSideFn.showOrHideBtn($target)
break
case 'mobile-toc-button':
rightSideFn.runMobileToc()
break
case 'readmode':
rightSideFn.switchReadMode()
@@ -601,46 +528,26 @@ document.addEventListener('DOMContentLoaded', function () {
case 'hide-aside-btn':
rightSideFn.hideAsideBtn()
break
case 'font-plus':
rightSideFn.adjustFontSize(true)
break
case 'font-minus':
rightSideFn.adjustFontSize()
break
default:
break
}
})
/**
* menu
* 側邊欄sub-menu 展開/收縮
* 解決menus在觸摸屏下,滑動屏幕menus_item_child不消失的問題(手機hover的bug)
*/
const clickFnOfSubMenu = function () {
document.querySelectorAll('#sidebar-menus .expand').forEach(function (e) {
e.addEventListener('click', function () {
* menu
* 側邊欄sub-menu 展開/收縮
*/
const clickFnOfSubMenu = () => {
document.querySelectorAll('#sidebar-menus .site-page.group').forEach(function (item) {
item.addEventListener('click', function () {
this.classList.toggle('hide')
const $dom = this.parentNode.nextElementSibling
if (btf.isHidden($dom)) {
$dom.style.display = 'block'
} else {
$dom.style.display = 'none'
}
})
})
window.addEventListener('touchmove', function (e) {
const $menusChild = document.querySelectorAll('#nav .menus_item_child')
$menusChild.forEach(item => {
if (!btf.isHidden(item)) item.style.display = 'none'
})
})
}
/**
* 複製時加上版權信息
*/
* 複製時加上版權信息
*/
const addCopyright = () => {
const copyright = GLOBAL_CONFIG.copyright
document.body.oncopy = (e) => {
@@ -664,8 +571,8 @@ document.addEventListener('DOMContentLoaded', function () {
}
/**
* 網頁運行時間
*/
* 網頁運行時間
*/
const addRuntime = () => {
const $runtimeCount = document.getElementById('runtimeshow')
if ($runtimeCount) {
@@ -675,8 +582,8 @@ document.addEventListener('DOMContentLoaded', function () {
}
/**
* 最後一次更新時間
*/
* 最後一次更新時間
*/
const addLastPushDate = () => {
const $lastPushDateItem = document.getElementById('last-push-date')
if ($lastPushDateItem) {
@@ -686,9 +593,9 @@ document.addEventListener('DOMContentLoaded', function () {
}
/**
* table overflow
*/
const addTableWrap = function () {
* table overflow
*/
const addTableWrap = () => {
const $table = document.querySelectorAll('#article-container :not(.highlight) > table, #article-container > table')
if ($table.length) {
$table.forEach(item => {
@@ -698,8 +605,8 @@ document.addEventListener('DOMContentLoaded', function () {
}
/**
* tag-hide
*/
* tag-hide
*/
const clickFnOfTagHide = function () {
const $hideInline = document.querySelectorAll('#article-container .hide-button')
if ($hideInline.length) {
@@ -709,8 +616,8 @@ document.addEventListener('DOMContentLoaded', function () {
const $hideContent = $this.nextElementSibling
$this.classList.toggle('open')
if ($this.classList.contains('open')) {
if ($hideContent.querySelectorAll('.justified-gallery').length > 0) {
btf.initJustifiedGallery($hideContent.querySelectorAll('.justified-gallery'))
if ($hideContent.querySelectorAll('.fj-gallery').length > 0) {
btf.initJustifiedGallery($hideContent.querySelectorAll('.fj-gallery'))
}
}
})
@@ -736,7 +643,7 @@ document.addEventListener('DOMContentLoaded', function () {
if (item.id === tabId) item.classList.add('active')
else item.classList.remove('active')
})
const $isTabJustifiedGallery = $tabContent.querySelectorAll(`#${tabId} .justified-gallery`)
const $isTabJustifiedGallery = $tabContent.querySelectorAll(`#${tabId} .fj-gallery`)
if ($isTabJustifiedGallery.length > 0) {
btf.initJustifiedGallery($isTabJustifiedGallery)
}
@@ -826,8 +733,12 @@ document.addEventListener('DOMContentLoaded', function () {
}
const unRefreshFn = function () {
window.addEventListener('resize', adjustMenu)
window.addEventListener('orientationchange', () => { setTimeout(adjustMenu(true), 100) })
window.addEventListener('resize', () => {
adjustMenu(false)
btf.isHidden(document.getElementById('toggle-menu')) && mobileSidebarOpen && sidebarFn.close()
})
document.getElementById('menu-mask').addEventListener('click', e => { sidebarFn.close() })
clickFnOfSubMenu()
GLOBAL_CONFIG.islazyload && lazyloadImg()
@@ -838,7 +749,6 @@ document.addEventListener('DOMContentLoaded', function () {
initAdjust()
if (GLOBAL_CONFIG_SITE.isPost) {
GLOBAL_CONFIG_SITE.isToc && tocFn()
GLOBAL_CONFIG.noticeOutdate !== undefined && addPostOutdateNotice()
GLOBAL_CONFIG.relativeDate.post && relativeDate(document.querySelectorAll('#post-meta time'))
} else {
@@ -848,18 +758,22 @@ document.addEventListener('DOMContentLoaded', function () {
toggleCardCategory()
}
sidebarFn()
scrollFnToDo()
GLOBAL_CONFIG_SITE.isHome && scrollDownInIndex()
addHighlightTool()
GLOBAL_CONFIG.isPhotoFigcaption && addPhotoFigcaption()
jqLoadAndRun()
GLOBAL_CONFIG.lightbox === 'mediumZoom' && addMediumZoom()
scrollFn()
const $jgEle = document.querySelectorAll('#article-container .fj-gallery')
$jgEle.length && runJustifiedGallery($jgEle)
runLightbox()
addTableWrap()
clickFnOfTagHide()
tabsFn.clickFnOfTabs()
tabsFn.backToTop()
switchComments()
document.getElementById('toggle-menu').addEventListener('click', () => { sidebarFn.open() })
}
refreshFn()
-39
View File
@@ -1,39 +0,0 @@
setInterval(() => {
let create_time = Math.round(new Date('2021-07-02 00:00:00').getTime() / 1000); //在此行修改建站时间
let timestamp = Math.round((new Date().getTime()) / 1000);
let second = timestamp - create_time;
let time = new Array(0, 0, 0, 0, 0);
//格式规范化,个位数前面加0
var nol = function(h){
return h>9?h:'0'+h;
}
if (second >= 365 * 24 * 3600) {
time[0] = parseInt(second / (365 * 24 * 3600));
second %= 365 * 24 * 3600;
}//年
if (second >= 24 * 3600) {
time[1] = parseInt(second / (24 * 3600));
second %= 24 * 3600;
}//天
if (second >= 3600) {
time[2] = nol(parseInt(second / 3600));
second %= 3600;
}//时
if (second >= 60) {
time[3] = nol(parseInt(second / 60));
second %= 60;
}//分
if (second > 0) {
time[4] = nol(second);
}//秒
//早上7点到晚上10点营业
if ((Number(time[2])<22) && (Number(time[2])>7)){
currentTimeHtml ="<img class='boardsign' src='https://img.shields.io/badge/Leon的技术阁-营业中-6adea8?style=social&logo=cakephp' title='距离百年老店也就差不到一百年~'><div id='runtime'>" + time[0] + ' YEAR ' + time[1] + ' DAYS ' + time[2] + ' : ' + time[3] + ' : ' + time[4] + '</div>';
} //徽标内容参考站内教程
//其余时间打烊
else{
currentTimeHtml ="<img class='boardsign' src='https://img.shields.io/badge/Leon的技术阁-打烊了-6adea8?style=social&logo=coffeescript' title='这个点了应该去睡觉啦,熬夜对身体不好哦'><div id='runtime'>" + time[0] + ' YEAR ' + time[1] + ' DAYS ' + time[2] + ' : ' + time[3] + ' : ' + time[4] + '</div>'; //徽标内容参考站内教程
}
//覆写挂载标签的内容
document.getElementById("workboard").innerHTML = currentTimeHtml;
}, 1000);
+42 -56
View File
@@ -1,9 +1,12 @@
window.addEventListener('load', () => {
const openSearch = () => {
document.body.style.cssText = 'width: 100%;overflow: hidden'
document.querySelector('#algolia-search .search-dialog').style.display = 'block'
document.querySelector('#algolia-search .ais-search-box--input').focus()
btf.fadeIn(document.getElementById('search-mask'), 0.5)
const bodyStyle = document.body.style
bodyStyle.width = '100%'
bodyStyle.overflow = 'hidden'
btf.animateIn(document.getElementById('search-mask'), 'to_show 0.5s')
btf.animateIn(document.querySelector('#algolia-search .search-dialog'), 'titleScale 0.5s')
setTimeout(() => { document.querySelector('#algolia-search .ais-SearchBox-input').focus() }, 100)
// shortcut: ESC
document.addEventListener('keydown', function f (event) {
if (event.code === 'Escape') {
@@ -14,11 +17,11 @@ window.addEventListener('load', () => {
}
const closeSearch = () => {
document.body.style.cssText = "width: '';overflow: ''"
const $searchDialog = document.querySelector('#algolia-search .search-dialog')
$searchDialog.style.animation = 'search_close .5s'
setTimeout(() => { $searchDialog.style.cssText = "display: none; animation: ''" }, 500)
btf.fadeOut(document.getElementById('search-mask'), 0.5)
const bodyStyle = document.body.style
bodyStyle.width = ''
bodyStyle.overflow = ''
btf.animateOut(document.querySelector('#algolia-search .search-dialog'), 'search_close .5s')
btf.animateOut(document.getElementById('search-mask'), 'to_hide 0.5s')
}
const searchClickFn = () => {
@@ -40,41 +43,38 @@ window.addEventListener('load', () => {
return console.error('Algolia setting is invalid!')
}
const searchClient = window.algoliasearch(algolia.appId, algolia.apiKey)
const search = instantsearch({
appId: algolia.appId,
apiKey: algolia.apiKey,
indexName: algolia.indexName,
searchParameters: {
hitsPerPage: algolia.hits.per_page || 10
},
searchFunction: function (helper) {
const searchInput = document.querySelector('#algolia-search-input input')
if (searchInput.value) {
helper.search()
}
}
searchClient
})
search.addWidget(
search.addWidgets([
instantsearch.widgets.configure({
hitsPerPage: 5
})
])
search.addWidgets([
instantsearch.widgets.searchBox({
container: '#algolia-search-input',
reset: false,
magnifier: false,
placeholder: GLOBAL_CONFIG.algolia.languages.input_placeholder
showReset: false,
showSubmit: false,
placeholder: GLOBAL_CONFIG.algolia.languages.input_placeholder,
showLoadingIndicator: true
})
)
search.addWidget(
])
search.addWidgets([
instantsearch.widgets.hits({
container: '#algolia-hits',
templates: {
item: function (data) {
const link = data.permalink ? data.permalink : (GLOBAL_CONFIG.root + data.path)
return (
'<a href="' + link + '" class="algolia-hit-item-link">' +
data._highlightResult.title.value +
'</a>'
)
return `
<a href="${link}" class="algolia-hit-item-link">
${data._highlightResult.title.value || 'no-title'}
</a>`
},
empty: function (data) {
return (
@@ -83,53 +83,39 @@ window.addEventListener('load', () => {
'</div>'
)
}
},
cssClasses: {
item: 'algolia-hit-item'
}
})
)
])
search.addWidget(
search.addWidgets([
instantsearch.widgets.stats({
container: '#algolia-stats',
templates: {
body: function (data) {
text: function (data) {
const icon = '<svg viewBox="0 0 1366 362" xmlns="http://www.w3.org/2000/svg"><linearGradient id="a" x1="428.26" x2="434.14" y1="404.15" y2="409.85" gradientTransform="matrix(94.045 0 0 -94.072 -40382 38480)" gradientUnits="userSpaceOnUse"><stop stop-color="#00aeff" offset="0"/><stop stop-color="#3369e7" offset="1"/></linearGradient><path d="M61.8 15.4h242.8c23.9 0 43.4 19.4 43.4 43.4v242.9c0 23.9-19.4 43.4-43.4 43.4H61.8c-23.9 0-43.4-19.4-43.4-43.4v-243c0-23.9 19.4-43.3 43.4-43.3z" fill="url(#a)"/><path d="M187 98.7c-51.4 0-93.1 41.7-93.1 93.2S135.6 285 187 285s93.1-41.7 93.1-93.2-41.6-93.1-93.1-93.1zm0 158.8c-36.2 0-65.6-29.4-65.6-65.6s29.4-65.6 65.6-65.6 65.6 29.4 65.6 65.6-29.3 65.6-65.6 65.6zm0-117.8v48.9c0 1.4 1.5 2.4 2.8 1.7l43.4-22.5c1-.5 1.3-1.7.8-2.7-9-15.8-25.7-26.6-45-27.3-1 0-2 .8-2 1.9zm-60.8-35.9l-5.7-5.7c-5.6-5.6-14.6-5.6-20.2 0l-6.8 6.8c-5.6 5.6-5.6 14.6 0 20.2l5.6 5.6c.9.9 2.2.7 3-.2 3.3-4.5 6.9-8.8 10.9-12.8 4.1-4.1 8.3-7.7 12.9-11 1-.6 1.1-2 .3-2.9zM217.5 89V77.7c0-7.9-6.4-14.3-14.3-14.3h-33.3c-7.9 0-14.3 6.4-14.3 14.3v11.6c0 1.3 1.2 2.2 2.5 1.9 9.3-2.7 19.1-4.1 29-4.1 9.5 0 18.9 1.3 28 3.8 1.2.3 2.4-.6 2.4-1.9z" fill="#FFF"/><path d="m842.5 267.6c0 26.7-6.8 46.2-20.5 58.6s-34.6 18.6-62.8 18.6c-10.3 0-31.7-2-48.8-5.8l6.3-31c14.3 3 33.2 3.8 43.1 3.8 15.7 0 26.9-3.2 33.6-9.6s10-15.9 10-28.5v-6.4c-3.9 1.9-9 3.8-15.3 5.8-6.3 1.9-13.6 2.9-21.8 2.9-10.8 0-20.6-1.7-29.5-5.1s-16.6-8.4-22.9-15-11.3-14.9-14.8-24.8-5.3-27.6-5.3-40.6c0-12.2 1.9-27.5 5.6-37.7 3.8-10.2 9.2-19 16.5-26.3 7.2-7.3 16-12.9 26.3-17s22.4-6.7 35.5-6.7c12.7 0 24.4 1.6 35.8 3.5s21.1 3.9 29 6.1v155.2zm-108.7-77.2c0 16.4 3.6 34.6 10.8 42.2s16.5 11.4 27.9 11.4c6.2 0 12.1-0.9 17.6-2.6s9.9-3.7 13.4-6.1v-97.1c-2.8-0.6-14.5-3-25.8-3.3-14.2-0.4-25 5.4-32.6 14.7-7.5 9.3-11.3 25.6-11.3 40.8zm294.3 0c0 13.2-1.9 23.2-5.8 34.1s-9.4 20.2-16.5 27.9-15.6 13.7-25.6 17.9-25.4 6.6-33.1 6.6c-7.7-0.1-23-2.3-32.9-6.6s-18.4-10.2-25.5-17.9-12.6-17-16.6-27.9-6-20.9-6-34.1 1.8-25.9 5.8-36.7 9.6-20 16.8-27.7 15.8-13.6 25.6-17.8c9.9-4.2 20.8-6.2 32.6-6.2s22.7 2.1 32.7 6.2c10 4.2 18.6 10.1 25.6 17.8 7.1 7.7 12.6 16.9 16.6 27.7 4.2 10.8 6.3 23.5 6.3 36.7zm-40 0.1c0-16.9-3.7-31-10.9-40.8-7.2-9.9-17.3-14.8-30.2-14.8s-23 4.9-30.2 14.8-10.7 23.9-10.7 40.8c0 17.1 3.6 28.6 10.8 38.5 7.2 10 17.3 14.9 30.2 14.9s23-5 30.2-14.9c7.2-10 10.8-21.4 10.8-38.5zm127.1 86.4c-64.1 0.3-64.1-51.8-64.1-60.1l-0.1-184.8 39.1-6.2v183.6c0 4.7 0 34.5 25.1 34.6v32.9zm68.9 0h-39.3v-168.8l39.3-6.2v175zm-19.7-193.5c13.1 0 23.8-10.6 23.8-23.7s-10.6-23.7-23.8-23.7-23.8 10.6-23.8 23.7 10.7 23.7 23.8 23.7zm117.4 18.6c12.9 0 23.8 1.6 32.6 4.8s15.9 7.7 21.1 13.4 8.9 13.5 11.1 21.7c2.3 8.2 3.4 17.2 3.4 27.1v100.6c-6 1.3-15.1 2.8-27.3 4.6s-25.9 2.7-41.1 2.7c-10.1 0-19.4-1-27.7-2.9-8.4-1.9-15.5-5-21.5-9.3-5.9-4.3-10.5-9.8-13.9-16.6-3.3-6.8-5-16.4-5-26.4 0-9.6 1.9-15.7 5.6-22.3 3.8-6.6 8.9-12 15.3-16.2 6.5-4.2 13.9-7.2 22.4-9s17.4-2.7 26.6-2.7c4.3 0 8.8 0.3 13.6 0.8s9.8 1.4 15.2 2.7v-6.4c0-4.5-0.5-8.8-1.6-12.8-1.1-4.1-3-7.6-5.6-10.7-2.7-3.1-6.2-5.5-10.6-7.2s-10-3-16.7-3c-9 0-17.2 1.1-24.7 2.4s-13.7 2.8-18.4 4.5l-4.7-32.1c4.9-1.7 12.2-3.4 21.6-5.1s19.5-2.6 30.3-2.6zm3.3 141.9c12 0 20.9-0.7 27.1-1.9v-39.8c-2.2-0.6-5.3-1.3-9.4-1.9s-8.6-1-13.6-1c-4.3 0-8.7 0.3-13.1 1-4.4 0.6-8.4 1.8-11.9 3.5s-6.4 4.1-8.5 7.2c-2.2 3.1-3.2 4.9-3.2 9.6 0 9.2 3.2 14.5 9 18 5.9 3.6 13.7 5.3 23.6 5.3zm-772.2-140.9c12.9 0 23.8 1.6 32.6 4.8s15.9 7.7 21.1 13.4c5.3 5.8 8.9 13.5 11.1 21.7 2.3 8.2 3.4 17.2 3.4 27.1v100.6c-6 1.3-15.1 2.8-27.3 4.6s-25.9 2.7-41.1 2.7c-10.1 0-19.4-1-27.7-2.9-8.4-1.9-15.5-5-21.5-9.3-5.9-4.3-10.5-9.8-13.9-16.6-3.3-6.8-5-16.4-5-26.4 0-9.6 1.9-15.7 5.6-22.3 3.8-6.6 8.9-12 15.3-16.2 6.5-4.2 13.9-7.2 22.4-9s17.4-2.7 26.6-2.7c4.3 0 8.8 0.3 13.6 0.8 4.7 0.5 9.8 1.4 15.2 2.7v-6.4c0-4.5-0.5-8.8-1.6-12.8-1.1-4.1-3-7.6-5.6-10.7-2.7-3.1-6.2-5.5-10.6-7.2s-10-3-16.7-3c-9 0-17.2 1.1-24.7 2.4s-13.7 2.8-18.4 4.5l-4.7-32.1c4.9-1.7 12.2-3.4 21.6-5.1 9.4-1.8 19.5-2.6 30.3-2.6zm3.4 142c12 0 20.9-0.7 27.1-1.9v-39.8c-2.2-0.6-5.3-1.3-9.4-1.9s-8.6-1-13.6-1c-4.3 0-8.7 0.3-13.1 1-4.4 0.6-8.4 1.8-11.9 3.5s-6.4 4.1-8.5 7.2c-2.2 3.1-3.2 4.9-3.2 9.6 0 9.2 3.2 14.5 9 18s13.7 5.3 23.6 5.3zm158.5 31.9c-64.1 0.3-64.1-51.8-64.1-60.1l-0.1-184.8 39.1-6.2v183.6c0 4.7 0 34.5 25.1 34.6v32.9z" fill="#182359"/></svg>'
const stats = GLOBAL_CONFIG.algolia.languages.hits_stats
.replace(/\$\{hits}/, data.nbHits)
.replace(/\$\{time}/, data.processingTimeMS)
return (
'<hr>' +
stats +
'<span class="algolia-logo pull-right">' +
' <img src="' + GLOBAL_CONFIG.root + 'img/algolia.svg" alt="Algolia" />' +
'</span>'
`<hr>${stats}<span class="algolia-logo pull-right">${icon}</span>`
)
}
}
})
)
])
search.addWidget(
search.addWidgets([
instantsearch.widgets.pagination({
container: '#algolia-pagination',
scrollTo: false,
showFirstLast: false,
labels: {
totalPages: 5,
templates: {
first: '<i class="fas fa-angle-double-left"></i>',
last: '<i class="fas fa-angle-double-right"></i>',
previous: '<i class="fas fa-angle-left"></i>',
next: '<i class="fas fa-angle-right"></i>'
},
cssClasses: {
root: 'pagination',
item: 'pagination-item',
link: 'page-number',
active: 'current',
disabled: 'disabled-item'
}
})
)
])
search.start()
window.pjax && search.on('render', () => {
+122 -104
View File
@@ -1,10 +1,12 @@
window.addEventListener('load', () => {
let loadFlag = false
const openSearch = function () {
document.body.style.cssText = 'width: 100%;overflow: hidden'
document.querySelector('#local-search .search-dialog').style.display = 'block'
document.querySelector('#local-search-input input').focus()
btf.fadeIn(document.getElementById('search-mask'), 0.5)
const openSearch = () => {
const bodyStyle = document.body.style
bodyStyle.width = '100%'
bodyStyle.overflow = 'hidden'
btf.animateIn(document.getElementById('search-mask'), 'to_show 0.5s')
btf.animateIn(document.querySelector('#local-search .search-dialog'), 'titleScale 0.5s')
setTimeout(() => { document.querySelector('#local-search-input input').focus() }, 100)
if (!loadFlag) {
search(GLOBAL_CONFIG.localSearch.path)
loadFlag = true
@@ -18,12 +20,12 @@ window.addEventListener('load', () => {
})
}
const closeSearch = function () {
document.body.style.cssText = "width: '';overflow: ''"
const $searchDialog = document.querySelector('#local-search .search-dialog')
$searchDialog.style.animation = 'search_close .5s'
setTimeout(() => { $searchDialog.style.cssText = "display: none; animation: ''" }, 500)
btf.fadeOut(document.getElementById('search-mask'), 0.5)
const closeSearch = () => {
const bodyStyle = document.body.style
bodyStyle.width = ''
bodyStyle.overflow = ''
btf.animateOut(document.querySelector('#local-search .search-dialog'), 'search_close .5s')
btf.animateOut(document.getElementById('search-mask'), 'to_hide 0.5s')
}
// click function
@@ -41,106 +43,122 @@ window.addEventListener('load', () => {
searchClickFn()
})
function search (path) {
fetch(GLOBAL_CONFIG.root + path)
.then(response => response.text())
.then(str => new window.DOMParser().parseFromString(str, 'text/xml'))
.then(data => {
const datas = [...data.querySelectorAll('entry')].map(function (item) {
return {
title: item.querySelector('title').textContent,
content: item.querySelector('content').textContent,
url: item.querySelector('url').textContent
}
})
async function search (path) {
let datas = []
const typeF = path.split('.')[1]
const response = await fetch(GLOBAL_CONFIG.root + path)
if (typeF === 'json') {
datas = await response.json()
} else if (typeF === 'xml') {
const res = await response.text()
const t = await new window.DOMParser().parseFromString(res, 'text/xml')
const a = await t
datas = [...a.querySelectorAll('entry')].map(function (item) {
return {
title: item.querySelector('title').textContent,
content: item.querySelector('content').textContent,
url: item.querySelector('url').textContent
}
})
}
if (response.ok) {
const $loadDataItem = document.getElementById('loading-database')
$loadDataItem.nextElementSibling.style.display = 'block'
$loadDataItem.remove()
}
const $input = document.querySelector('#local-search-input input')
const $resultContent = document.getElementById('local-search-results')
$input.addEventListener('input', function () {
let str = '<div class="search-result-list">'
const keywords = this.value.trim().toLowerCase().split(/[\s]+/)
$resultContent.innerHTML = ''
if (this.value.trim().length <= 0) return
let count = 0
// perform local searching
datas.forEach(function (data) {
let isMatch = true
if (!data.title || data.title.trim() === '') {
data.title = 'Untitled'
}
let dataTitle = data.title.trim().toLowerCase()
const dataContent = data.content.trim().replace(/<[^>]+>/g, '').toLowerCase()
const dataUrl = data.url.startsWith('/') ? data.url : GLOBAL_CONFIG.root + data.url
let indexTitle = -1
let indexContent = -1
let firstOccur = -1
// only match artiles with not empty titles and contents
if (dataTitle !== '' || dataContent !== '') {
keywords.forEach(function (keyword, i) {
indexTitle = dataTitle.indexOf(keyword)
indexContent = dataContent.indexOf(keyword)
if (indexTitle < 0 && indexContent < 0) {
isMatch = false
} else {
if (indexContent < 0) {
indexContent = 0
}
if (i === 0) {
firstOccur = indexContent
}
}
})
} else {
const $input = document.querySelector('#local-search-input input')
const $resultContent = document.getElementById('local-search-results')
const $loadingStatus = document.getElementById('loading-status')
$input.addEventListener('input', function () {
const keywords = this.value.trim().toLowerCase().split(/[\s]+/)
if (keywords[0] !== '') $loadingStatus.innerHTML = '<i class="fas fa-spinner fa-pulse"></i>'
$resultContent.innerHTML = ''
let str = '<div class="search-result-list">'
if (this.value.trim().length <= 0) return
let count = 0
// perform local searching
datas.forEach(function (data) {
let isMatch = true
if (!data.title || data.title.trim() === '') {
data.title = ''
}
let dataTitle = data.title.trim().toLowerCase()
const dataContent = data.content ? data.content.trim().replace(/<[^>]+>/g, '').toLowerCase() : ''
const dataUrl = data.url.startsWith('/') ? data.url : GLOBAL_CONFIG.root + data.url
let indexTitle = -1
let indexContent = -1
let firstOccur = -1
// only match artiles with not empty titles and contents
if (dataTitle !== '' || dataContent !== '') {
keywords.forEach(function (keyword, i) {
indexTitle = dataTitle.indexOf(keyword)
indexContent = dataContent.indexOf(keyword)
if (indexTitle < 0 && indexContent < 0) {
isMatch = false
}
// show search results
if (isMatch) {
const content = data.content.trim().replace(/<[^>]+>/g, '')
if (firstOccur >= 0) {
// cut out 130 characters
let start = firstOccur - 30
let end = firstOccur + 100
if (start < 0) {
start = 0
}
if (start === 0) {
end = 100
}
if (end > content.length) {
end = content.length
}
let matchContent = content.substring(start, end)
// highlight all keywords
keywords.forEach(function (keyword) {
const regS = new RegExp(keyword, 'gi')
matchContent = matchContent.replace(regS, '<span class="search-keyword">' + keyword + '</span>')
dataTitle = dataTitle.replace(regS, '<span class="search-keyword">' + keyword + '</span>')
})
str += '<div class="local-search__hit-item"><a href="' + dataUrl + '" class="search-result-title">' + dataTitle + '</a>'
count += 1
if (dataContent !== '') {
str += '<p class="search-result">' + matchContent + '...</p>'
}
} else {
if (indexContent < 0) {
indexContent = 0
}
if (i === 0) {
firstOccur = indexContent
}
str += '</div>'
}
})
if (count === 0) {
str += '<div id="local-search__hits-empty">' + GLOBAL_CONFIG.localSearch.languages.hits_empty.replace(/\$\{query}/, this.value.trim()) +
'</div>'
} else {
isMatch = false
}
// show search results
if (isMatch) {
const content = data.content.trim().replace(/<[^>]+>/g, '')
if (firstOccur >= 0) {
// cut out 130 characters
// let start = firstOccur - 30 < 0 ? 0 : firstOccur - 30
// let end = firstOccur + 50 > content.length ? content.length : firstOccur + 50
let start = firstOccur - 30
let end = firstOccur + 100
if (start < 0) {
start = 0
}
if (start === 0) {
end = 100
}
if (end > content.length) {
end = content.length
}
let matchContent = content.substring(start, end)
// highlight all keywords
keywords.forEach(function (keyword) {
const regS = new RegExp(keyword, 'gi')
matchContent = matchContent.replace(regS, '<span class="search-keyword">' + keyword + '</span>')
dataTitle = dataTitle.replace(regS, '<span class="search-keyword">' + keyword + '</span>')
})
str += '<div class="local-search__hit-item"><a href="' + dataUrl + '" class="search-result-title">' + dataTitle + '</a>'
count += 1
if (dataContent !== '') {
str += '<p class="search-result">' + matchContent + '...</p>'
}
}
str += '</div>'
$resultContent.innerHTML = str
window.pjax && window.pjax.refresh($resultContent)
})
}
})
if (count === 0) {
str += '<div id="local-search__hits-empty">' + GLOBAL_CONFIG.localSearch.languages.hits_empty.replace(/\$\{query}/, this.value.trim()) +
'</div>'
}
str += '</div>'
$resultContent.innerHTML = str
if (keywords[0] !== '') $loadingStatus.innerHTML = ''
window.pjax && window.pjax.refresh($resultContent)
})
}
})
+82 -56
View File
@@ -58,34 +58,18 @@ const btf = {
}
},
snackbarShow: (text, showAction, duration) => {
const sa = (typeof showAction !== 'undefined') ? showAction : false
const dur = (typeof duration !== 'undefined') ? duration : 2000
const position = GLOBAL_CONFIG.Snackbar.position
const bg = document.documentElement.getAttribute('data-theme') === 'light' ? GLOBAL_CONFIG.Snackbar.bgLight : GLOBAL_CONFIG.Snackbar.bgDark
snackbarShow: (text, showAction = false, duration = 2000) => {
const { position, bgLight, bgDark } = GLOBAL_CONFIG.Snackbar
const bg = document.documentElement.getAttribute('data-theme') === 'light' ? bgLight : bgDark
Snackbar.show({
text: text,
backgroundColor: bg,
showAction: sa,
duration: dur,
showAction: showAction,
duration: duration,
pos: position
})
},
initJustifiedGallery: function (selector) {
if (!(selector instanceof jQuery)) {
selector = $(selector)
}
selector.each(function (i, o) {
if ($(this).is(':visible')) {
$(this).justifiedGallery({
rowHeight: 220,
margins: 4
})
}
})
},
diffDate: (d, more = false) => {
const dateNow = new Date()
const datePost = new Date(d)
@@ -135,15 +119,11 @@ const btf = {
}
},
scrollToDest: (pos, time) => {
if (pos < 0 || time < 0) {
return
}
const currentPos = window.scrollY || window.screenTop
scrollToDest: (pos, time = 500) => {
const currentPos = window.pageYOffset
if (currentPos > pos) pos = pos - 70
if ('CSS' in window && CSS.supports('scroll-behavior', 'smooth')) {
if ('scrollBehavior' in document.documentElement.style) {
window.scrollTo({
top: pos,
behavior: 'smooth'
@@ -152,39 +132,35 @@ const btf = {
}
let start = null
time = time || 500
pos = +pos
window.requestAnimationFrame(function step (currentTime) {
start = !start ? currentTime : start
const progress = currentTime - start
if (currentPos < pos) {
const progress = currentTime - start
window.scrollTo(0, ((pos - currentPos) * progress / time) + currentPos)
if (progress < time) {
window.requestAnimationFrame(step)
} else {
window.scrollTo(0, pos)
}
} else {
const progress = currentTime - start
window.scrollTo(0, currentPos - ((currentPos - pos) * progress / time))
if (progress < time) {
window.requestAnimationFrame(step)
} else {
window.scrollTo(0, pos)
}
}
if (progress < time) {
window.requestAnimationFrame(step)
} else {
window.scrollTo(0, pos)
}
})
},
fadeIn: (ele, time) => {
ele.style.cssText = `display:block;animation: to_show ${time}s`
animateIn: (ele, text) => {
ele.style.display = 'block'
ele.style.animation = text
},
fadeOut: (ele, time) => {
animateOut: (ele, text) => {
ele.addEventListener('animationend', function f () {
ele.style.cssText = "display: none; animation: '' "
ele.style.display = ''
ele.style.animation = ''
ele.removeEventListener('animationend', f)
})
ele.style.animation = `to_hide ${time}s`
ele.style.animation = text
},
getParents: (elem, selector) => {
@@ -204,7 +180,6 @@ const btf = {
},
/**
*
* @param {*} selector
* @param {*} eleType the type of create element
* @param {*} options object key: value
@@ -226,14 +201,6 @@ const btf = {
}
},
isJqueryLoad: fn => {
if (typeof jQuery === 'undefined') {
getScript(GLOBAL_CONFIG.source.jQuery).then(fn)
} else {
fn()
}
},
isHidden: ele => ele.offsetHeight === 0 && ele.offsetWidth === 0,
getEleTop: ele => {
@@ -246,6 +213,65 @@ const btf = {
}
return actualTop
}
},
loadLightbox: ele => {
const service = GLOBAL_CONFIG.lightbox
if (service === 'mediumZoom') {
const zoom = mediumZoom(ele)
zoom.on('open', e => {
const photoBg = document.documentElement.getAttribute('data-theme') === 'dark' ? '#121212' : '#fff'
zoom.update({
background: photoBg
})
})
}
if (service === 'fancybox') {
ele.forEach(i => {
if (i.parentNode.tagName !== 'A') {
const dataSrc = i.dataset.lazySrc || i.src
const dataCaption = i.title || i.alt || ''
btf.wrap(i, 'a', { href: dataSrc, 'data-fancybox': 'gallery', 'data-caption': dataCaption, 'data-thumb': dataSrc })
}
})
if (!window.fancyboxRun) {
Fancybox.bind('[data-fancybox]', {
Hash: false,
Thumbs: {
autoStart: false
}
})
window.fancyboxRun = true
}
}
},
initJustifiedGallery: function (selector) {
selector.forEach(function (i) {
if (!btf.isHidden(i)) {
fjGallery(i, {
itemSelector: '.fj-gallery-item',
rowHeight: 220,
gutter: 4,
onJustify: function () {
this.$container.style.opacity = '1'
}
})
}
})
},
updateAnchor: (anchor) => {
if (anchor !== window.location.hash) {
if (!anchor) anchor = location.pathname
const title = GLOBAL_CONFIG_SITE.title
window.history.replaceState({
url: location.href,
title: title
}, title, anchor)
}
}
}