'
50 | result +=
51 | '
' +
52 | ' ' +
53 | headlineLang +
54 | '
'
55 | result += '
'
56 |
57 | for (let i = 0; i < Math.min(relatedPosts.length, limitNum); i++) {
58 | const cover =
59 | relatedPosts[i].cover === false
60 | ? relatedPosts[i].randomcover
61 | : relatedPosts[i].cover
62 | result +=
63 | '
'
94 | return result
95 | }
96 | })
97 |
98 | function isTagRelated (tagName, TBDtags) {
99 | let result = false
100 | TBDtags.forEach(function (tag) {
101 | if (tagName === tag.name) {
102 | result = true
103 | }
104 | })
105 | return result
106 | }
107 |
108 | function findItem (arrayToSearch, attr, val) {
109 | for (let i = 0; i < arrayToSearch.length; i++) {
110 | if (arrayToSearch[i][attr] === val) {
111 | return i
112 | }
113 | }
114 | return -1
115 | }
116 |
117 | function compare (attr) {
118 | return function (a, b) {
119 | const val1 = a[attr]
120 | const val2 = b[attr]
121 | return val2 - val1
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/themes/Butterfly/scripts/tags/button.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Button
3 | * {% btn url text icon option %}
4 | * option: color outline center block larger
5 | * color : default/blue/pink/red/purple/orange/green
6 | */
7 |
8 | 'use strict'
9 |
10 | const urlFor = require('hexo-util').url_for.bind(hexo)
11 |
12 | function btn (args) {
13 | args = args.join(' ').split(',')
14 | let url = args[0] || ''
15 | let text = args[1] || ''
16 | let icon = args[2] || ''
17 | let option = args[3] || ''
18 |
19 | url = url.trim()
20 | text = text.trim()
21 | icon = icon.trim()
22 | option = option.trim()
23 |
24 | return `
${icon.length > 0 ? `` : ''}${text}`
26 | }
27 |
28 | hexo.extend.tag.register('btn', btn, { ends: false })
29 |
--------------------------------------------------------------------------------
/themes/Butterfly/scripts/tags/gallery.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Butterfly
3 | * galleryGroup and allery
4 | */
5 |
6 | 'use strict'
7 |
8 | const urlFor = require('hexo-util').url_for.bind(hexo)
9 |
10 | function gallery (args, content) {
11 | return `
${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
12 |
`
13 | }
14 |
15 | function galleryGroup (args) {
16 | const name = args[0]
17 | const desrc = args[1]
18 | const url = urlFor(args[2])
19 | const img = urlFor(args[3])
20 |
21 | return `
22 |
23 |
24 |
25 | ${name}
26 | ${desrc}
27 |
28 |
29 |
30 | `
31 | }
32 |
33 | hexo.extend.tag.register('gallery', gallery, { ends: true })
34 | hexo.extend.tag.register('galleryGroup', galleryGroup)
35 |
--------------------------------------------------------------------------------
/themes/Butterfly/scripts/tags/hide.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Butterfly
3 | * @example
4 | * hideInline
5 | * {% hideInline content,display,bg,color %}
6 | * content不能包含當引號,可用 '
7 | * hideBlock
8 | * {% hideBlock display,bg,color %}
9 | * content
10 | * {% endhideBlock %}
11 | * hideToggle
12 | * {% hideToggle display,bg,color %}
13 | * content
14 | * {% endhideToggle %}
15 | */
16 |
17 | 'use strict'
18 |
19 | function hideInline (args) {
20 | args = args.join(' ').split(',')
21 | const content = args[0]
22 | const display = args[1] || 'Click'
23 | const bg = args[2] || false
24 | const color = args[3] || false
25 | let group = 'style="'
26 |
27 | if (bg) group += `background-color: ${bg};`
28 | if (color) group += `color: ${color}`
29 | group += '"'
30 |
31 | return `
${content}`
33 | }
34 |
35 | function hideBlock (args, content) {
36 | args = args.join(' ').split(',')
37 | const display = args[0] || 'Click'
38 | const bg = args[1] || false
39 | const color = args[2] || false
40 | let group = 'style="'
41 |
42 | if (bg) group += `background-color: ${bg};`
43 | if (color) group += `color: ${color}`
44 | group += '"'
45 |
46 | return `
${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
`
48 | }
49 |
50 | function hideToggle (args, content) {
51 | args = args.join(' ').split(',')
52 | const display = args[0]
53 | const bg = args[1] || false
54 | const color = args[2] || false
55 | let group = 'style="'
56 | let border = ''
57 |
58 | if (bg) {
59 | border = `style="border: 1px solid ${bg}"`
60 | group += `background-color: ${bg};`
61 | }
62 | if (color) group += `color: ${color}`
63 | group += '"'
64 |
65 | return `
${display}
66 |
${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
`
67 | }
68 |
69 | hexo.extend.tag.register('hideInline', hideInline)
70 | hexo.extend.tag.register('hideBlock', hideBlock, { ends: true })
71 | hexo.extend.tag.register('hideToggle', hideToggle, { ends: true })
72 |
--------------------------------------------------------------------------------
/themes/Butterfly/scripts/tags/mermaid.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Butterfly
3 | * mermaid
4 | * https://github.com/mermaid-js/mermaid
5 | */
6 |
7 | 'use strict'
8 |
9 | function mermaid (args, content) {
10 | return `
11 | ${content}
12 |
`
13 | }
14 |
15 | hexo.extend.tag.register('mermaid', mermaid, { ends: true })
16 |
--------------------------------------------------------------------------------
/themes/Butterfly/scripts/tags/note.js:
--------------------------------------------------------------------------------
1 | /**
2 | * note.js
3 | * transplant from hexo-theme-next
4 | */
5 |
6 | 'use strict'
7 |
8 | function postNote (args, content) {
9 | return `
10 | ${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
11 |
`
12 | }
13 |
14 | hexo.extend.tag.register('note', postNote, { ends: true })
15 | hexo.extend.tag.register('subnote', postNote, { ends: true })
16 |
--------------------------------------------------------------------------------
/themes/Butterfly/scripts/tags/tabs.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Tabs
3 | * transplant from hexo-theme-next
4 | * modify by Jerry
5 | */
6 |
7 | 'use strict'
8 |
9 | function postTabs (args, content) {
10 | const tabBlock = /\n([\w\W\s\S]*?)/g
11 |
12 | args = args.join(' ').split(',')
13 | const tabName = args[0]
14 | const tabActive = Number(args[1]) || 0
15 |
16 | const matches = []
17 | let match
18 | let tabId = 0
19 | let tabNav = ''
20 | let tabContent = ''
21 |
22 | !tabName && hexo.log.warn('Tabs block must have unique name!')
23 |
24 | while ((match = tabBlock.exec(content)) !== null) {
25 | matches.push(match[1])
26 | matches.push(match[2])
27 | }
28 |
29 | for (let i = 0; i < matches.length; i += 2) {
30 | const tabParameters = matches[i].split('@')
31 | let postContent = matches[i + 1]
32 | let tabCaption = tabParameters[0] || ''
33 | let tabIcon = tabParameters[1] || ''
34 | let tabHref = ''
35 |
36 | postContent = hexo.render.renderSync({ text: postContent, engine: 'markdown' }).trim()
37 |
38 | tabId += 1
39 | tabHref = (tabName + ' ' + tabId).toLowerCase().split(' ').join('-');
40 |
41 | ((tabCaption.length === 0) && (tabIcon.length === 0)) && (tabCaption = tabName + ' ' + tabId)
42 |
43 | const isOnlyicon = tabIcon.length > 0 && tabCaption.length === 0 ? ' style="text-align: center;"' : ''
44 | const icon = tabIcon.trim()
45 | tabIcon.length > 0 && (tabIcon = `
`)
46 |
47 | const toTop = '
'
48 |
49 | const isActive = (tabActive > 0 && tabActive === tabId) || (tabActive === 0 && tabId === 1) ? ' active' : ''
50 | tabNav += `
`
51 | tabContent += `
${postContent + toTop}
`
52 | }
53 |
54 | tabNav = `
`
55 | tabContent = `
${tabContent}
`
56 |
57 | return `
${tabNav + tabContent}
`
58 | }
59 |
60 | hexo.extend.tag.register('tabs', postTabs, { ends: true })
61 | hexo.extend.tag.register('subtabs', postTabs, { ends: true })
62 | hexo.extend.tag.register('subsubtabs', postTabs, { ends: true })
63 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_global/function.styl:
--------------------------------------------------------------------------------
1 | .limit-one-line
2 | overflow: hidden
3 | text-overflow: ellipsis
4 | white-space: nowrap
5 |
6 | .limit-more-line
7 | display: -webkit-box
8 | overflow: hidden
9 | -webkit-box-orient: vertical
10 |
11 | .fontawesomeIcon
12 | display: inline-block
13 | font-weight: 600
14 | font-style: normal
15 | font-variant: normal
16 | font-family: 'Font Awesome 5 Free'
17 | text-rendering: auto
18 | -webkit-font-smoothing: antialiased
19 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_highlight/diff.styl:
--------------------------------------------------------------------------------
1 | // For diff highlight
2 | pre .deletion
3 | color: $highlight-deletion
4 |
5 | pre .addition
6 | color: $highlight-addition
7 |
8 | pre .meta
9 | color: $highlight-purple
10 |
11 | pre
12 | .comment
13 | color: $highlight-comment
14 |
15 | .variable,
16 | .attribute,
17 | .regexp,
18 | .ruby .constant,
19 | .xml .tag .title,
20 | .xml .pi,
21 | .xml .doctype,
22 | .html .doctype,
23 | .css .id,
24 | .tag .name,
25 | .css .class,
26 | .css .pseudo
27 | color: $highlight-red
28 |
29 | .tag
30 | color: $highlight-aqua
31 |
32 | .number,
33 | .preprocessor,
34 | .literal,
35 | .params,
36 | .constant,
37 | .command
38 | color: $highlight-orange
39 |
40 | .built_in
41 | color: $highlight-yellow
42 |
43 | .ruby .class .title,
44 | .css .rules .attribute,
45 | .string,
46 | .value,
47 | .inheritance,
48 | .header,
49 | .ruby .symbol,
50 | .xml .cdata,
51 | .special,
52 | .number,
53 | .formula
54 | color: $highlight-green
55 |
56 | .keyword,
57 | .title,
58 | .css .hexcolor
59 | color: $highlight-aqua
60 |
61 | .function,
62 | .python .decorator,
63 | .python .title,
64 | .ruby .function .title,
65 | .ruby .title .keyword,
66 | .perl .sub,
67 | .javascript .title,
68 | .coffeescript .title
69 | color: $highlight-blue
70 |
71 | .tag .attr,
72 | .javascript .function
73 | color: $highlight-purple
74 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/404.styl:
--------------------------------------------------------------------------------
1 | if hexo-config('error_404.enable')
2 | #error-wrap
3 | position: absolute
4 | top: 50%
5 | right: 0
6 | left: 0
7 | margin: 0 auto
8 | padding: 0 1rem
9 | max-width: 1000px
10 | transform: translate(0, -50%)
11 |
12 | .error-content
13 | display: flex
14 | flex-direction: row
15 | justify-content: center
16 | align-items: center
17 | margin: 0 1rem
18 | height: 18rem
19 | border-radius: 8px
20 | background: #fff
21 | box-shadow: 0 4px 8px 6px rgba(7, 17, 27, .06)
22 |
23 | @media screen and (max-width: 768px)
24 | flex-direction: column
25 | margin: 0
26 | height: 25rem
27 |
28 | .error-img
29 | flex: 1
30 | height: 100%
31 | border-top-left-radius: 8px
32 | border-bottom-left-radius: 8px
33 | background-color: #49b1f5
34 | background-position: center
35 | background-size: cover
36 |
37 | @media screen and (max-width: 768px)
38 | flex: 1
39 | width: 100%
40 | border-top-right-radius: 8px
41 | border-bottom-left-radius: 0
42 |
43 | .error-info
44 | flex: 1
45 | padding: .5rem
46 | text-align: center
47 | font-size: 14px
48 | font-family: $site-name-font
49 |
50 | @media screen and (max-width: 768px)
51 | flex: 1.1
52 | width: 100%
53 |
54 | .error_title
55 | margin-top: -4rem
56 | color: $font-color
57 | font-size: 9em
58 |
59 | @media screen and (max-width: 768px)
60 | margin-top: -3rem
61 |
62 | .error_subtitle
63 | @extend .limit-more-line
64 | margin-top: -3.5rem
65 | color: $font-color
66 | word-break: break-word
67 | font-size: 1.6em
68 | -webkit-line-clamp: 2
69 |
70 | a
71 | position: relative
72 | z-index: 1
73 | display: inline-block
74 | margin-top: .5rem
75 | padding: .3rem 1.5rem
76 | background: $theme-color
77 | color: white
78 |
79 | i
80 | padding-right: .3rem
81 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/calendar.styl:
--------------------------------------------------------------------------------
1 | #calendar
2 | a
3 | text-decoration none
4 |
5 | .cal-head
6 | margin-bottom: 15px
7 | position relative
8 | height 20px
9 | padding 8px 6px 2px 6px
10 |
11 | .cal-prev,.cal-next
12 | position absolute
13 | top 9px
14 | width 16px
15 | height 18px
16 | padding 3px 4px
17 | border 1px solid transparent
18 | color #333
19 | outline 0
20 |
21 | .cal-prev
22 | left 8px
23 | &:before
24 | border-right 9px solid #333
25 |
26 | .cal-next
27 | right 8px
28 | &:before
29 | border-left 9px solid #333
30 |
31 | .cal-prev:before,.cal-next:before
32 | content ''
33 | display block
34 | width 0
35 | height 0
36 | border-top 5px solid transparent
37 | border-bottom 5px solid transparent
38 |
39 | .cal-title
40 | width 120px
41 | margin 0 auto
42 | color #333
43 | font bold 14px/18px Arial
44 | text-align center
45 | a
46 | border 1px solid transparent
47 | color #9f9f9f
48 |
49 | .cal,
50 | .cal th,
51 | .cal td
52 | border 1px solid #d1d1d1
53 |
54 | .cal
55 | display: table
56 | border-collapse separate
57 | border-spacing 0
58 | border-width 1px 0 0 1px
59 | table-layout fixed
60 | width 100%
61 | margin 0
62 | th
63 | background #9f9f9f
64 | color #fff
65 | border-width 0 1px 1px 0
66 | font-weight 700
67 | td
68 | border-width 0 1px 1px 0
69 | tbody
70 | a
71 | background-color #007acc
72 | color #fff
73 | display block
74 | font-weight 700
75 | .cal-today
76 | background-color #66ecfd
77 | color #fff
78 | .cal-gray
79 | color #bbb8b8
80 |
81 | [data-theme='dark'] .cal .cal-gray
82 | color #505050
83 |
84 | .cal th,
85 | .cal td
86 | font-weight normal
87 | line-height 2.5625
88 | padding 0
89 | text-align center
90 |
91 | [data-theme='dark'] .cal .cal-foot
92 | color #9f9f9f
93 |
94 | .cal .cal-foot
95 | color #2ca6cb
96 |
97 | .cal-title a:hover,
98 | .cal-prev:hover,
99 | .cal-next:hover,
100 | .cal .cal-foot:hover,
101 | .cal .cal-foot:focus,
102 | .cal tbody a:hover,
103 | .cal tbody a:focus
104 | background-color #686868
105 | color #fff
106 | cursor pointer
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/category.styl:
--------------------------------------------------------------------------------
1 | .category-content
2 | ol,
3 | ul
4 | margin-top: .4rem
5 | padding: 0 0 0 .8rem
6 | list-style: none
7 | counter-reset: li
8 |
9 | p
10 | margin: 0
11 |
12 | ol,
13 | ul
14 | padding-left: .5rem
15 |
16 | li
17 | position: relative
18 | margin: .3rem 0
19 | padding: .1rem .5rem .1rem 1.5rem !important
20 |
21 | &:hover
22 | &:before
23 | transform: rotate(360deg)
24 |
25 | &:before
26 | position: absolute
27 | top: 0
28 | left: 0
29 | background: $light-blue
30 | color: $card-bg
31 | cursor: pointer
32 | transition: all .3s ease-out
33 |
34 | ol
35 | li
36 | &:before
37 | margin-top: .2rem
38 | width: w = 1.2rem
39 | height: h = w
40 | border-radius: .5 * w
41 | content: counter(li)
42 | counter-increment: li
43 | text-align: center
44 | font-size: .6rem
45 | line-height: h
46 |
47 | ul
48 | li
49 | &:hover
50 | &:before
51 | border-color: $theme-button-hover-color
52 |
53 | &:before
54 | $w = .3rem
55 | top: 10px
56 | margin-left: .45rem
57 | width: w = $w
58 | height: h = w
59 | border: .5 * w solid $light-blue
60 | border-radius: w
61 | background: transparent
62 | content: ''
63 | line-height: h
64 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/chat.styl:
--------------------------------------------------------------------------------
1 | // chat
2 | if hexo-config('chat_btn') == true && hexo-config('chatra.enable')
3 | #chatra:not(.chatra--expanded)
4 | visibility: hidden !important
5 | width: 1px !important
6 | height: 1px !important
7 | opacity: 0 !important
8 | pointer-events: none
9 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/comments.styl:
--------------------------------------------------------------------------------
1 | #post-comment
2 | .comment-head
3 | margin-bottom: 1rem
4 |
5 | .comment-headling
6 | display: inline-block
7 | vertical-align: middle
8 | font-weight: 700
9 | font-size: 20px
10 |
11 | .comment-switch
12 | display: inline-block
13 |
14 | if hexo-config('comments.text')
15 | float: right
16 | margin: .1rem auto 0
17 | padding: .2rem .8rem
18 | width: max-content
19 | border-radius: 8px
20 | background: $comments-switch-bg
21 | else
22 | > span
23 | display: none
24 |
25 | .first-comment
26 | color: $comments-switch-first-text
27 |
28 | .second-comment
29 | color: $comments-switch-second-text
30 |
31 | label
32 | position: relative
33 | display: inline-block
34 | margin: 0 .4rem
35 | width: 42px
36 | height: 22px
37 | vertical-align: sub
38 |
39 | input#switch-comments-btn
40 | width: 0
41 | height: 0
42 | opacity: 0
43 |
44 | &:checked + .slider
45 | background-color: $comments-switch-second-text
46 |
47 | &:checked + .slider:before
48 | transform: translateX(20px)
49 |
50 | .slider
51 | position: absolute
52 | top: 0
53 | right: 0
54 | bottom: 0
55 | left: 0
56 | border-radius: 34px
57 | background-color: $comments-switch-first-text
58 | cursor: pointer
59 | transition: .4s
60 |
61 | &:before
62 | position: absolute
63 | bottom: 4px
64 | left: 4px
65 | width: 14px
66 | height: 14px
67 | border-radius: 50%
68 | background-color: $comments-switch-round
69 | content: ''
70 | transition: .4s
71 |
72 | .comment-wrap
73 | .comments-items-2
74 | display: none
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/flink.styl:
--------------------------------------------------------------------------------
1 | .flink#article-container
2 | .flink-desc
3 | margin: .2rem 0 .5rem
4 |
5 | .flink-list
6 | overflow: auto
7 | padding: 10px 10px 0
8 | text-align: center
9 |
10 | & > .flink-list-item
11 | position: relative
12 | float: left
13 | overflow: hidden
14 | margin: 20px 7px
15 | width: calc(100% / 3 - 15px)
16 | height: 90px
17 | border-radius: 8px
18 | line-height: 17px
19 | transform: perspective(1px) translateZ(0)
20 |
21 | @media screen and (max-width: 1100px)
22 | width: calc(50% - 15px) !important
23 |
24 | @media screen and (max-width: 600px)
25 | width: calc(100% - 15px) !important
26 |
27 | &:hover
28 | img
29 | transform: rotate(360deg)
30 |
31 | &:before
32 | position: absolute
33 | top: 0
34 | right: 0
35 | bottom: 0
36 | left: 0
37 | z-index: -1
38 | background: $light-blue
39 | content: ''
40 | transition-timing-function: ease-out
41 | transition-duration: .3s
42 | transition-property: transform
43 | transform: scale(0)
44 |
45 | &:hover:before,
46 | &:focus:before,
47 | &:active:before
48 | transform: scale(1)
49 |
50 | a
51 | color: $font-color
52 | text-decoration: none
53 |
54 | img
55 | float: left
56 | margin: 13px 0 0 10px
57 | width: 65px
58 | height: 65px
59 | border-radius: 35px
60 | transition: all .3s
61 |
62 | .img-alt
63 | display: none
64 |
65 | .flink-item-name
66 | @extend .limit-one-line
67 | padding: 16px 10px 0 0
68 | height: 40px
69 | font-weight: bold
70 | font-size: 20px
71 |
72 | .flink-item-desc
73 | @extend .limit-one-line
74 | padding: 16px 10px
75 | height: 50px
76 | font-size: 13px
77 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/footer.styl:
--------------------------------------------------------------------------------
1 | #footer
2 | position: relative
3 | //background: $light-blue
4 | background-attachment: local
5 | background-position: bottom
6 | background-size: cover
7 |
8 | if hexo-config('footer_bg') != false
9 | &:before
10 | position: absolute
11 | width: 100%
12 | height: 100%
13 | background-color: alpha($dark-black, .5)
14 | content: ''
15 |
16 | #footer-wrap
17 | position: relative
18 | padding: 2rem 1rem
19 | color: $light-grey
20 | text-align: center
21 |
22 | a
23 | color: $light-grey
24 | cursor: pointer
25 |
26 | &:hover
27 | color: $theme-color
28 | text-decoration: underline
29 |
30 | .footer-separator
31 | margin: 0 .2rem
32 |
33 | .icp-icon
34 | padding: 0 4px
35 | vertical-align: text-bottom
36 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/loadding.styl:
--------------------------------------------------------------------------------
1 | if hexo-config('preloader')
2 | loading-bg()
3 | position: fixed
4 | z-index: 1000
5 | width: 50%
6 | height: 100%
7 | background-color: $preloader-bg
8 | transition: all .5s
9 |
10 | #loading-box
11 | .loading-left-bg
12 | loading-bg()
13 |
14 | .loading-right-bg
15 | loading-bg()
16 | right: 0
17 |
18 | .spinner-box
19 | position: fixed
20 | z-index: 1001
21 | display: flex
22 | justify-content: center
23 | align-items: center
24 | width: 100%
25 | height: 100vh
26 |
27 | .configure-border-1
28 | position: absolute
29 | padding: 3px
30 | width: 115px
31 | height: 115px
32 | background: #ffab91
33 | animation: configure-clockwise 3s ease-in-out 0s infinite alternate
34 |
35 | .configure-border-2
36 | left: -115px
37 | padding: 3px
38 | width: 115px
39 | height: 115px
40 | background: rgb(63, 249, 220)
41 | transform: rotate(45deg)
42 | animation: configure-xclockwise 3s ease-in-out 0s infinite alternate
43 |
44 | .loading-word
45 | position: absolute
46 | color: $white
47 | font-size: .8rem
48 |
49 | .configure-core
50 | width: 100%
51 | height: 100%
52 | background-color: $preloader-bg
53 |
54 | &.loaded
55 | .loading-left-bg
56 | transform: translate(-100%, 0)
57 |
58 | .loading-right-bg
59 | transform: translate(100%, 0)
60 |
61 | .spinner-box
62 | display: none
63 |
64 | @keyframes configure-clockwise
65 | 0%
66 | transform: rotate(0)
67 |
68 | 25%
69 | transform: rotate(90deg)
70 |
71 | 50%
72 | transform: rotate(180deg)
73 |
74 | 75%
75 | transform: rotate(270deg)
76 |
77 | 100%
78 | transform: rotate(360deg)
79 |
80 | @keyframes configure-xclockwise
81 | 0%
82 | transform: rotate(45deg)
83 |
84 | 25%
85 | transform: rotate(-45deg)
86 |
87 | 50%
88 | transform: rotate(-135deg)
89 |
90 | 75%
91 | transform: rotate(-225deg)
92 |
93 | 100%
94 | transform: rotate(-315deg)
95 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/mobile-sidebar.styl:
--------------------------------------------------------------------------------
1 | #mobile-sidebar
2 | #menu_mask
3 | position: fixed
4 | z-index: 102
5 | display: none
6 | width: 100%
7 | height: 100%
8 | background: alpha($dark-black, .8)
9 |
10 | #mobile-sidebar-menus
11 | position: fixed
12 | top: 0
13 | right: -250px
14 | z-index: 103
15 | overflow-x: hidden
16 | overflow-y: auto
17 | width: 250px
18 | height: 100%
19 | background: #f6f8fa
20 | transition: all .5s
21 |
22 | & > .mobile_author_icon
23 | padding: 1.3rem 1.5rem 0
24 | text-align: center
25 |
26 | img
27 | width: 110px
28 | height: 110px
29 | border-radius: 70px
30 | transition: all .5s
31 |
32 | &:hover
33 | transform: rotate(360deg)
34 |
35 | .mobile_post_data
36 | display: table
37 | padding: .6rem .5rem 0
38 | width: 100%
39 | table-layout: fixed
40 |
41 | .mobile_data_item
42 | display: table-cell
43 |
44 | .mobile_data_link
45 | & > a > div
46 | @extend .limit-one-line
47 |
48 | .length_num
49 | color: $dark-black
50 | font-size: .9rem
51 |
52 | .headline
53 | display: block
54 | color: $font-black
55 | font-size: .7rem
56 |
57 | hr
58 | margin: 1rem auto
59 |
60 | .menus_items
61 | padding: 0 .5rem 2rem
62 |
63 | .site-page
64 | @extend .limit-one-line
65 | position: relative
66 | display: block
67 | padding: .3rem 1.5rem
68 | color: $font-black
69 | font-size: .8rem
70 | cursor: pointer
71 |
72 | i:first-child
73 | width: 30%
74 | text-align: left
75 |
76 | span
77 | width: 70%
78 |
79 | &:hover
80 | color: $light-blue
81 |
82 | .menus-expand
83 | position: absolute
84 | right: 0
85 | padding: .4rem
86 | transition: all .3s
87 | transform: rotate(0)
88 |
89 | &.menus-closed
90 | transform: rotate(90deg) !important
91 |
92 | .menus_item_child
93 | margin: 0
94 | list-style: none
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/pagination.styl:
--------------------------------------------------------------------------------
1 | #pagination
2 | overflow: hidden
3 | margin-top: 1rem
4 | width: 100%
5 |
6 | .pagination
7 | text-align: center
8 |
9 | .page-number
10 | display: inline-block
11 | margin: 0 .2rem
12 | min-width: w = 1.2rem
13 | height: w
14 | text-align: center
15 | line-height: w
16 | cursor: pointer
17 |
18 | &.current
19 | background: $theme-paginator-color
20 | color: $button-color
21 | cursor: default
22 |
23 | img.prev-cover,
24 | img.next-cover
25 | position: absolute
26 | width: 100%
27 | height: 100%
28 | opacity: .4
29 | transition: all .6s
30 | object-fit: cover
31 |
32 | .pagination-info
33 | position: absolute
34 | top: 50%
35 | padding: 1rem 2rem
36 | width: 100%
37 | transform: translate(0, -50%)
38 |
39 | .prev_info,
40 | .next_info
41 | @extend .limit-one-line
42 | color: $button-color
43 | font-weight: 500
44 |
45 | .next-post
46 | .pagination-info
47 | text-align: right
48 |
49 | .pull-full
50 | width: 100% !important
51 |
52 | .prev-post .label,
53 | .next-post .label
54 | color: alpha($white, .9)
55 | text-transform: uppercase
56 | font-size: 90%
57 |
58 | .prev-post,
59 | .next-post
60 | width: 50%
61 |
62 | a
63 | position: relative
64 | display: block
65 | overflow: hidden
66 | height: 150px
67 |
68 | &:hover
69 | img.prev-cover,
70 | img.next-cover
71 | opacity: .8
72 | transform: scale(1.1)
73 |
74 | &.pagination-post
75 | margin: 2rem 0 !important
76 | background: $dark-black
77 |
78 | @media screen and (max-width: 768px)
79 | .prev-post,
80 | .next-post
81 | width: 100% !important
82 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/relatedposts.styl:
--------------------------------------------------------------------------------
1 | .relatedPosts
2 | margin-top: 1rem
3 |
4 | .relatedPosts_headline
5 | margin-bottom: 5px
6 | font-weight: 700
7 | font-size: 20px
8 |
9 | .relatedPosts_item
10 | position: relative
11 | display: inline-block
12 | overflow: hidden
13 | margin: 3px
14 | width: calc(33.333% - 6px)
15 | height: 200px
16 | background: $dark-black
17 | vertical-align: bottom
18 |
19 | &:hover
20 | .relatedPosts_cover
21 | opacity: .8
22 | transform: scale(1.1)
23 |
24 | @media screen and (max-width: 768px)
25 | margin: 2px
26 | width: calc(50% - 4px)
27 | height: 150px
28 |
29 | @media screen and (max-width: 480px)
30 | width: calc(100% - 4px)
31 |
32 | .relatedPosts_cover
33 | width: 100%
34 | height: 100%
35 | opacity: .4
36 | transition: all .6s
37 | object-fit: cover
38 |
39 | .relatedPosts_main
40 | position: absolute
41 | top: 50%
42 | padding: 0 1rem
43 | width: 100%
44 | color: $white
45 | transform: translate(0, -50%)
46 |
47 | .relatedPosts_date
48 | color: $light-grey
49 | font-size: 90%
50 |
51 | .relatedPosts_title
52 | @extend .limit-more-line
53 | -webkit-line-clamp: 2
54 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/reward.styl:
--------------------------------------------------------------------------------
1 | .post-reward
2 | position: relative
3 | margin-top: 4rem
4 | width: 100%
5 | text-align: center
6 |
7 | .reward-button
8 | padding: .5rem 1.2rem
9 | background: $light-blue
10 | color: $button-color
11 | transition: all .4s
12 |
13 | &:hover
14 | box-shadow: inset 9em 0 0 0 $theme-button-hover-color
15 |
16 | .reward-main
17 | display: block
18 |
19 | .reward-main
20 | position: absolute
21 | bottom: 40px
22 | left: 0
23 | z-index: 100
24 | display: none
25 | padding: 0 0 15px
26 | width: 100%
27 |
28 | .reward-all
29 | display: inline-block
30 | margin: 0
31 | padding: 1rem .5rem
32 | border-radius: 4px
33 | background: $reward-pop-up-bg
34 |
35 | &:before
36 | position: absolute
37 | bottom: -10px
38 | left: 0
39 | width: 100%
40 | height: 20px
41 | content: ''
42 |
43 | &:after
44 | position: absolute
45 | right: 0
46 | bottom: 2px
47 | left: 0
48 | margin: 0 auto
49 | width: 0
50 | height: 0
51 | border-top: 13px solid $reward-pop-up-bg
52 | border-right: 13px solid transparent
53 | border-left: 13px solid transparent
54 | content: ''
55 |
56 | .reward-item
57 | display: inline-block
58 | padding: 0 8px
59 | list-style-type: none
60 | vertical-align: top
61 |
62 | img
63 | width: 130px
64 | height: 130px
65 |
66 | .post-qr-code__desc
67 | padding-top: .4rem
68 | width: 130px
69 | color: $reward-pop-up-color
70 | text-align: center
71 | word-break: break-all
72 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/rightside.styl:
--------------------------------------------------------------------------------
1 | #rightside
2 | position: fixed
3 | right: -38px
4 | bottom: $rightside-bottom
5 | z-index: 100
6 | opacity: 0
7 | transition: all .5s
8 |
9 | #rightside-config-hide
10 | transform: translate(35px, 0)
11 |
12 | .rightside-in
13 | transform: translate(0, 0) !important
14 | animation: rightsideIn .3s
15 |
16 | .rightside-out
17 | animation: rightsideOut .3s
18 |
19 | & > div
20 | & > button,
21 | & > a
22 | display: block
23 | margin-bottom: 2px
24 | width: 30px
25 | height: 30px
26 | background-color: $light-blue
27 | color: $button-color
28 | text-align: center
29 | font-size: 16px
30 | cursor: pointer
31 |
32 | &:hover
33 | background-color: $theme-button-hover-color
34 |
35 | #rightside_config
36 | i
37 | animation: avatar_turn_around 2s linear infinite
38 |
39 | #mobile-toc-button
40 | display: none
41 |
42 | @media screen and (max-width: $bg)
43 | display: block
44 |
45 | @keyframes rightsideIn
46 | 0%
47 | transform: translate(30px, 0)
48 |
49 | 100%
50 | transform: translate(0, 0)
51 |
52 | @keyframes rightsideOut
53 | 0%
54 | transform: translate(0, 0)
55 |
56 | 100%
57 | transform: translate(30px, 0)
58 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/sidebar.styl:
--------------------------------------------------------------------------------
1 | #sidebar
2 | position: fixed
3 | top: 0
4 | left: -($sidebar-width)
5 | z-index: 10
6 | padding: 1rem 0 2rem .5rem
7 | width: $sidebar-width
8 | height: 100%
9 | background: $sidebar-background
10 | box-shadow: -.25rem 0 .25rem rgba($sidebar-background, .6) inset
11 | opacity: .9
12 |
13 | .sidebar-toc
14 | ol,
15 | li
16 | list-style: none
17 |
18 | ol
19 | margin-top: .2rem
20 | padding-left: .4rem
21 |
22 | &__title
23 | padding-right: .5rem
24 | text-align: center
25 | font-size: 1.3em
26 |
27 | &__content
28 | overflow-y: scroll
29 | padding-bottom: 5rem
30 | height: 90vh
31 |
32 | .toc-link
33 | display: block
34 | padding-left: .2rem
35 | border-right: 3px solid transparent
36 | transition: all .2s ease-in-out
37 |
38 | &.active
39 | border-right-color: darken($theme-toc-color, 20%)
40 | background: $theme-toc-color
41 | color: $sidebar-active-color
42 |
43 | &__progress
44 | position: relative
45 | margin-bottom: .3rem
46 | padding-left: .6rem
47 | color: $theme-toc-color
48 |
49 | .progress-notice
50 | margin-right: .4rem
51 |
52 | .progress-num
53 | display: inline-block
54 | min-width: .9rem
55 |
56 | &-bar
57 | width: 0
58 | height: 1px
59 | background: $theme-toc-color
60 |
61 | @media screen and (max-width: $bg)
62 | i#toggle-sidebar
63 | display: none
64 |
65 | #sidebar
66 | right: -($mobile-sidebar-width)
67 | left: auto
68 | z-index: 103
69 | width: $mobile-sidebar-width
70 | opacity: 1
71 | transition: all .4s
72 |
73 | .toc-child
74 | display: block !important
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_layout/third-party.styl:
--------------------------------------------------------------------------------
1 | if hexo-config('valine.enable')
2 | #vcomment
3 | button
4 | padding: .3rem .8rem
5 | border-color: $button-color
6 | background-color: $light-blue
7 | color: $button-color
8 | font-size: .7rem
9 | transition: all .3s
10 |
11 | &:hover
12 | background-color: $theme-button-hover-color
13 |
14 | if hexo-config('valine.bg')
15 | textarea
16 | background: url(hexo-config('valine.bg')) 100% 100% no-repeat
17 |
18 | .vimg
19 | transition: all .3s
20 |
21 | &:hover
22 | transform: rotate(360deg)
23 |
24 | .vat
25 | padding: 0 .8rem
26 | border: 1px solid $light-blue
27 | border-radius: 5px
28 | color: $light-blue
29 | font-size: .7125rem
30 | transition: all .3s
31 |
32 | &:hover
33 | background-color: $light-blue
34 | color: $button-color
35 |
36 | if hexo-config('beautify.enable')
37 | #article-container
38 | .aplayer
39 | ol,
40 | ul
41 | margin: 0
42 | padding: 0
43 |
44 | li
45 | margin: 0
46 | padding: 0 15px
47 |
48 | &:before
49 | content: none
50 |
51 | // third-party
52 | // fireworks
53 | .fireworks
54 | position: fixed
55 | top: 0
56 | left: 0
57 | z-index: $fireworks-zIndex
58 | pointer-events: none
59 |
60 | .medium-zoom-image--opened
61 | z-index: 99999 !important
62 | margin: 0 !important
63 |
64 | .medium-zoom-overlay
65 | z-index: 99999 !important
66 |
67 | .mermaid
68 | overflow: auto
69 | margin: 0 0 1rem
70 | background: $white
71 | text-align: center
72 | opacity: 0
73 | transition: all .3s
74 |
75 | &[data-processed]
76 | opacity: 1
77 |
78 | .utterances
79 | max-width: 100%
80 |
81 | #gitalk-container
82 | .gt-meta
83 | margin: 0 0 .8em
84 | padding: .3rem 0 .8em
85 |
86 | .has-jax
87 | overflow: auto
88 |
89 | #article-container
90 | .aplayer
91 | margin: 0 0 1rem
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_search/algolia.styl:
--------------------------------------------------------------------------------
1 | #algolia-search
2 | animation: titlescale .5s
3 |
4 | .ais-search-box
5 | margin: 0 auto
6 | max-width: 100%
7 | width: 100%
8 |
9 | input
10 | padding: .25rem .7rem
11 | outline: none
12 | border: 2px solid $search-color
13 | border-radius: 2rem
14 | background: $search-bg
15 | font-size: 14px
16 |
17 | .ais-hits--item.algolia-hit-item
18 | position: relative
19 | padding-left: 1.5rem
20 |
21 | &:hover
22 | &:before
23 | border-color: $theme-button-hover-color
24 |
25 | &:before
26 | $w = .3rem
27 | position: absolute
28 | top: .4rem
29 | left: 0
30 | width: w = $w
31 | height: h = w
32 | border: .5 * w solid $search-color
33 | border-radius: w
34 | background: transparent
35 | content: ''
36 | line-height: h
37 | transition: all .2s ease-in-out
38 |
39 | a
40 | display: block
41 | color: $font-black
42 | font-size: 14px
43 | cursor: pointer
44 |
45 | &:hover
46 | color: $search-color
47 |
48 | em
49 | color: $search-keyword-highlight
50 | font-weight: bold
51 |
52 | .ais-pagination.pagination
53 | margin: .8rem 0 0
54 | padding: 0
55 | text-align: center
56 |
57 | .ais-pagination--item
58 | margin: 0 .2rem
59 | padding: 0
60 |
61 | a
62 | display: inline-block
63 | min-width: 1.2rem
64 | height: 1.2rem
65 | text-align: center
66 | line-height: 1.2rem
67 |
68 | .ais-pagination--item.current
69 | a
70 | background: $theme-paginator-color
71 | color: #eee
72 | cursor: default
73 |
74 | .algolia-logo
75 | padding-top: 2px
76 | width: 4rem
77 | height: 1.5rem
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_search/index.styl:
--------------------------------------------------------------------------------
1 | .search-dialog
2 | position: fixed
3 | top: 5rem
4 | left: 50%
5 | z-index: 1001
6 | display: none
7 | margin-left: -15rem
8 | padding: 1rem
9 | width: 30rem
10 | background: $search-bg
11 |
12 | hr
13 | margin: 1rem auto
14 |
15 | span.search-close-button
16 | position: absolute
17 | top: .8rem
18 | right: 1rem
19 | color: $grey
20 | font-size: 1rem
21 | line-height: 1
22 | cursor: pointer
23 | transition: color .2s ease-in-out
24 |
25 | &:hover
26 | color: $search-color
27 |
28 | &__title
29 | padding: 0 0 .7rem
30 | color: $search-color
31 | font-size: 1rem
32 | line-height: 1
33 |
34 | .search-mask
35 | position: fixed
36 | top: 0
37 | right: 0
38 | bottom: 0
39 | left: 0
40 | z-index: 1000
41 | display: none
42 | background: rgba($dark-black, .6)
43 |
44 | @media screen and (max-width: $sm)
45 | .search-dialog
46 | top: 0
47 | left: 0
48 | margin: 0
49 | width: 100%
50 | height: 100%
51 |
52 | .search-result-list
53 | padding-bottom: 2rem
54 | max-height: 75vh !important
55 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_search/local-search.styl:
--------------------------------------------------------------------------------
1 | #local-search
2 | animation: titlescale .5s
3 |
4 | .local-search-box
5 | margin: 0 auto
6 | max-width: 100%
7 | width: 100%
8 |
9 | input
10 | padding: .25rem .7rem
11 | width: 100%
12 | outline: none
13 | border: 2px solid $search-color
14 | border-radius: 2rem
15 | background: $search-bg
16 | font-size: 14px
17 | -webkit-appearance: none
18 |
19 | .local-search__hit-item
20 | position: relative
21 | padding-left: 1.3rem
22 | line-height: 1.7
23 |
24 | &:hover
25 | &:before
26 | border-color: $theme-button-hover-color
27 |
28 | &:before
29 | $w = .3rem
30 | position: absolute
31 | top: .3rem
32 | left: 0
33 | width: w = $w
34 | height: h = w
35 | border: .5 * w solid $search-color
36 | border-radius: w
37 | background: transparent
38 | content: ''
39 | line-height: h
40 | transition: all .2s ease-in-out
41 |
42 | a
43 | display: block
44 | color: $font-black
45 | font-weight: 600
46 | font-size: 14px
47 | cursor: pointer
48 |
49 | &:hover
50 | color: $search-color
51 |
52 | .search-result
53 | margin: 0 0 .4rem
54 | word-break: break-all
55 |
56 | .search-keyword
57 | color: $search-keyword-highlight
58 | font-weight: bold
59 |
60 | .local-search-stats__hr
61 | display: none !important
62 |
63 | .search-result-list
64 | overflow-y: auto
65 | max-height: 10.5rem
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_tags/button.styl:
--------------------------------------------------------------------------------
1 | #article-container
2 | .btn-center
3 | margin: 0 0 1rem
4 | text-align: center
5 |
6 | .btn-beautify
7 | position: relative
8 | z-index: 1
9 | display: inline-block
10 | margin: 0 .2rem .3rem
11 | padding: 0 1rem
12 | background-color: $btn-default-color
13 | color: $btn-color
14 | line-height: 2
15 |
16 | &:not(.block) + .btn-beautify:not(.block)
17 | margin: 0 .2rem 1rem
18 |
19 | &.block
20 | display: block
21 | margin: 0 0 1rem
22 | width: fit-content
23 | width: -moz-fit-content
24 |
25 | &.center
26 | margin: 0 auto 1rem
27 |
28 | &.right
29 | margin: 0 0 1rem auto
30 |
31 | &.larger
32 | padding: .3rem 1.3rem
33 |
34 | &:hover
35 | text-decoration: none
36 |
37 | for $type in $btn-types
38 | &.{$type}
39 | background-color: lookup('$btn-' + $type + '-color')
40 |
41 | &.outline
42 | border: 1px solid transparent
43 | border-color: $btn-default-color
44 | background-color: transparent
45 | color: $btn-default-color
46 | transition: all .3s
47 |
48 | &.button--animated:before
49 | background: $btn-default-color
50 |
51 | &:hover
52 | color: white !important
53 |
54 | for $type in $btn-types
55 | &.{$type}
56 | border-color: lookup('$btn-' + $type + '-color')
57 | color: lookup('$btn-' + $type + '-color')
58 |
59 | &.button--animated:before
60 | background: lookup('$btn-' + $type + '-color')
61 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_tags/gallery.styl:
--------------------------------------------------------------------------------
1 | figure.gallery-group
2 | position: relative
3 | float: left
4 | overflow: hidden
5 | margin: .3rem .2rem
6 | width: calc(50% - .4rem)
7 | height: 250px
8 | border-radius: 8px
9 | background: $dark-black
10 | -webkit-transform: translate3d(0, 0, 0)
11 |
12 | @media screen and (max-width: 600px)
13 | width: calc(100% - .4rem)
14 |
15 | &:hover
16 | img
17 | opacity: .4
18 | transform: translate3d(0, 0, 0)
19 |
20 | .gallery-group-name::after
21 | transform: translate3d(0, 0, 0)
22 |
23 | p
24 | opacity: 1
25 | transform: translate3d(0, 0, 0)
26 |
27 | img
28 | position: relative
29 | margin: 0 !important
30 | max-width: none
31 | width: calc(100% + 20px)
32 | height: 250px
33 | backface-visibility: hidden
34 | opacity: .8
35 | transition: opacity .35s, transform .35s
36 | transform: translate3d(-10px, 0, 0)
37 | object-fit: cover
38 |
39 | figcaption
40 | position: absolute
41 | top: 0
42 | left: 0
43 | padding: 1.5rem
44 | width: 100%
45 | height: 100%
46 | color: $gallery-color
47 | text-transform: uppercase
48 | backface-visibility: hidden
49 |
50 | & > a
51 | position: absolute
52 | top: 0
53 | right: 0
54 | bottom: 0
55 | left: 0
56 | z-index: 1000
57 | opacity: 0
58 |
59 | p
60 | @extend .limit-more-line
61 | margin: 0
62 | padding: .4rem 0 0
63 | letter-spacing: 1px
64 | font-size: .8rem
65 | line-height: 1.5
66 | opacity: 0
67 | transition: opacity .35s, transform .35s
68 | transform: translate3d(100%, 0, 0)
69 | -webkit-line-clamp: 4
70 |
71 | .gallery-group-name
72 | @extend .limit-more-line
73 | position: relative
74 | margin: 0
75 | padding: .4rem 0
76 | font-weight: bold
77 | font-size: 1.2rem
78 | line-height: 1.5
79 | -webkit-line-clamp: 2
80 |
81 | &:after
82 | position: absolute
83 | bottom: 0
84 | left: 0
85 | width: 100%
86 | height: 2px
87 | background: $gallery-color
88 | content: ''
89 | transition: transform .35s
90 | transform: translate3d(-100%, 0, 0)
91 |
92 | .gallery-group-main
93 | overflow: auto
94 | padding: 0 0 .8rem
95 |
96 | .justified-gallery
97 | margin: 0 0 .8rem
98 |
99 | img
100 | opacity: 0
101 |
102 | .img-alt
103 | display: none
104 |
105 | .fancybox
106 | width: auto
107 | text-align: inherit
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_tags/hexo.styl:
--------------------------------------------------------------------------------
1 | // pullquote
2 | blockquote
3 | &.pullquote
4 | position: relative
5 | max-width: 45%
6 | font-size: 110%
7 |
8 | &.left
9 | float: left
10 | margin: 1em .5em 0 0
11 |
12 | &.right
13 | float: right
14 | margin: 1em 0 0 .5rem
15 |
16 | // hexo tag video
17 | .video-container
18 | position: relative
19 | overflow: hidden
20 | margin-bottom: .8rem
21 | padding-top: 56.25%
22 | height: 0
23 |
24 | iframe
25 | position: absolute
26 | top: 0
27 | left: 0
28 | margin-top: 0
29 | width: 100%
30 | height: 100%
31 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_tags/hide.styl:
--------------------------------------------------------------------------------
1 | // tag-hide
2 | .hide-inline,
3 | .hide-block
4 | & > .hide-button
5 | position: relative
6 | z-index: 1
7 | display: inline-block
8 | padding: .3rem 1rem
9 | background: $tag-hide-bg
10 | color: $white !important
11 |
12 | &.open
13 | display: none
14 |
15 | & > .hide-content
16 | display: none
17 |
18 | .hide-inline
19 | & > .hide-button
20 | margin: 0 .3rem
21 |
22 | & > .hide-content
23 | margin: 0 .3rem
24 |
25 | .hide-block
26 | margin: 0 0 .8rem
27 |
28 | .hide-toggle
29 | margin-bottom: 1rem
30 | border: 1px solid $tag-hide-toggle-bg
31 |
32 | & > .hide-button
33 | padding: .3rem .5rem
34 | background: $tag-hide-toggle-bg
35 | color: $font-color
36 | cursor: pointer
37 |
38 | & > i
39 | font-size: 1.2em
40 | transition: all .3s
41 |
42 | &.open
43 | i
44 | transform: rotate(90deg)
45 |
46 | & > .hide-content
47 | display: none
48 | margin: 1.5rem 1.2rem
49 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_tags/note.styl:
--------------------------------------------------------------------------------
1 | .note
2 | $note-icons = hexo-config('note.icons')
3 | $note-style = hexo-config('note.style')
4 | position: relative
5 | margin: 0 0 1rem
6 | padding: 15px
7 |
8 | if ($note-style == 'simple')
9 | border: 1px solid $light-grey
10 | border-left-width: 5px
11 |
12 | if ($note-style == 'modern')
13 | border: 1px solid transparent
14 | background-color: $whitesmoke
15 |
16 | if ($note-style == 'flat')
17 | border: initial
18 | border-left: 5px solid $light-grey
19 | background-color: lighten($light-grey, 65%)
20 |
21 | if hexo-config('note.border_radius') is a 'unit'
22 | border-radius: unit(hexo-config('note.border_radius'), px)
23 |
24 | h2,
25 | h3,
26 | h4,
27 | h5,
28 | h6
29 | if $note-icons
30 | margin-top: 3px
31 | else
32 | margin-top: 0
33 |
34 | margin-bottom: 0
35 | padding-top: 0 !important
36 | border-bottom: initial
37 |
38 | p,
39 | ul,
40 | ol,
41 | table,
42 | pre,
43 | blockquote,
44 | img
45 | &:first-child
46 | margin-top: 0 !important
47 |
48 | &:last-child
49 | margin-bottom: 0 !important
50 |
51 | if $note-icons
52 | &:not(.no-icon)
53 | padding-left: 45px
54 |
55 | &::before
56 | position: absolute
57 | top: 13px
58 | left: 15px
59 | font-size: larger
60 | @extend .fontawesomeIcon
61 |
62 | for $type in $note-types
63 | &.{$type}
64 | if ($note-style == 'flat')
65 | background: lookup('$note-' + $type + '-bg')
66 |
67 | if ($note-style == 'modern')
68 | border-color: lookup('$note-modern-' + $type + '-border')
69 | background: lookup('$note-modern-' + $type + '-bg')
70 | color: lookup('$note-modern-' + $type + '-text')
71 |
72 | a,
73 | span.exturl
74 | &:not(.btn)
75 | border-bottom: 1px solid lookup('$note-modern-' + $type + '-text')
76 | color: lookup('$note-modern-' + $type + '-text')
77 |
78 | &:hover
79 | border-bottom: 1px solid lookup('$note-modern-' + $type + '-hover')
80 | color: lookup('$note-modern-' + $type + '-hover')
81 |
82 | if ($note-style != 'modern')
83 | border-left-color: lookup('$note-' + $type + '-border')
84 |
85 | h2,
86 | h3,
87 | h4,
88 | h5,
89 | h6
90 | color: lookup('$note-' + $type + '-text')
91 |
92 | if $note-icons
93 | &:not(.no-icon)::before
94 | content: lookup('$note-' + $type + '-icon')
95 |
96 | if ($note-style != 'modern')
97 | color: lookup('$note-' + $type + '-text')
98 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_tags/tabs.styl:
--------------------------------------------------------------------------------
1 | #article-container
2 | .tabs
3 | position: relative
4 | margin: 0 0 1rem
5 | border: 1px solid $tab-border-color
6 | border-top: none
7 |
8 | > .nav-tabs
9 | display: flex
10 | flex-wrap: wrap
11 | margin: 0
12 | padding: 0
13 | background: $tab-botton-bg
14 |
15 | > .tab
16 | margin: 0
17 | padding: 0
18 | list-style: none
19 |
20 | @media screen and (max-width: 768px)
21 | flex-grow: 1
22 |
23 | button
24 | display: block
25 | padding: .5rem 1rem
26 | width: 100%
27 | border-top: 2px solid $tab-border-color
28 | background: $tab-botton-bg
29 | color: $font-color
30 | line-height: 2
31 | transition: all .4s
32 |
33 | &:hover
34 | border-top: 2px solid $tab-button-hover-bg
35 | background: $tab-button-hover-bg
36 |
37 | i
38 | width: 1.5em
39 |
40 | &.active
41 | button
42 | border-top: 2px solid $tab-active-border-color
43 | background: $card-bg
44 | cursor: default
45 |
46 | > .tab-contents
47 | .tab-item-content
48 | position: relative
49 | display: none
50 | padding: 1.8rem 1.2rem
51 |
52 | @media screen and (max-width: 768px)
53 | padding: 1.2rem .7rem
54 |
55 | &.active
56 | display: block
57 | animation: tabshow .5s
58 |
59 | .tab-to-top
60 | position: relative
61 | display: block
62 | margin: 0 0 0 auto
63 | color: $tab-to-top-color
64 |
65 | @keyframes tabshow
66 | 0%
67 | transform: translateY(15px)
68 |
69 | 100%
70 | transform: translateY(0)
71 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/_third-party/normalize.min.css:
--------------------------------------------------------------------------------
1 | /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details{display:block}summary{display:list-item}template{display:none}[hidden]{display:none}
--------------------------------------------------------------------------------
/themes/Butterfly/source/css/index.styl:
--------------------------------------------------------------------------------
1 | @import 'nib'
2 | @import '_third-party/normalize.min.css'
3 | // project
4 | @import 'var'
5 | @import '_global/*'
6 | @import '_highlight/highlight'
7 | @import '_layout/*'
8 | @import '_tags/*'
9 | @import '_mode/*'
10 |
11 | // search
12 | if hexo-config('algolia_search.enable')
13 | @import '_search/index'
14 | @import '_search/algolia'
15 |
16 | if hexo-config('local_search') && hexo-config('local_search.enable')
17 | @import '_search/index'
18 | @import '_search/local-search'
19 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/404.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chocolate1999/hexo-blog-lionkk/ab8eebdb977d3972e2a54546d65b97e29807934a/themes/Butterfly/source/img/404.jpg
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/algolia.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chocolate1999/hexo-blog-lionkk/ab8eebdb977d3972e2a54546d65b97e29807934a/themes/Butterfly/source/img/avatar.png
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/comment_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chocolate1999/hexo-blog-lionkk/ab8eebdb977d3972e2a54546d65b97e29807934a/themes/Butterfly/source/img/comment_bg.png
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chocolate1999/hexo-blog-lionkk/ab8eebdb977d3972e2a54546d65b97e29807934a/themes/Butterfly/source/img/favicon.ico
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chocolate1999/hexo-blog-lionkk/ab8eebdb977d3972e2a54546d65b97e29807934a/themes/Butterfly/source/img/favicon.png
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/friend_404.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chocolate1999/hexo-blog-lionkk/ab8eebdb977d3972e2a54546d65b97e29807934a/themes/Butterfly/source/img/friend_404.gif
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/icp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chocolate1999/hexo-blog-lionkk/ab8eebdb977d3972e2a54546d65b97e29807934a/themes/Butterfly/source/img/icp.png
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/index.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chocolate1999/hexo-blog-lionkk/ab8eebdb977d3972e2a54546d65b97e29807934a/themes/Butterfly/source/img/index.jpg
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chocolate1999/hexo-blog-lionkk/ab8eebdb977d3972e2a54546d65b97e29807934a/themes/Butterfly/source/img/loading.gif
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/post.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chocolate1999/hexo-blog-lionkk/ab8eebdb977d3972e2a54546d65b97e29807934a/themes/Butterfly/source/img/post.jpg
--------------------------------------------------------------------------------
/themes/Butterfly/source/img/post_loadding.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/js/search/algolia.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 | $('a.social-icon.search').on('click', function () {
3 | $('body').css({ width: '100%', overflow: 'hidden' })
4 | $('.search-dialog').css('display', 'block')
5 | $('.ais-search-box--input').focus()
6 | $('.search-mask').fadeIn()
7 | // shortcut: ESC
8 | document.addEventListener('keydown', function f (event) {
9 | if (event.code === 'Escape') {
10 | closeSearch()
11 | document.removeEventListener('keydown', f)
12 | }
13 | })
14 | })
15 |
16 | const closeSearch = function () {
17 | $('body').css('width', '')
18 | $('body').css('overflow', '')
19 | $('.search-dialog').css({
20 | animation: 'search_close .5s'
21 | })
22 |
23 | $('.search-dialog').animate({}, function () {
24 | setTimeout(function () {
25 | $('.search-dialog').css({
26 | animation: '',
27 | display: 'none'
28 | })
29 | }, 500)
30 | })
31 |
32 | $('.search-mask').fadeOut()
33 | }
34 | $('.search-mask, .search-close-button').on('click touchstart', closeSearch)
35 |
36 | const algolia = GLOBAL_CONFIG.algolia
37 | const isAlgoliaValid = algolia.appId && algolia.apiKey && algolia.indexName
38 | if (!isAlgoliaValid) {
39 | return console.error('Algolia setting is invalid!')
40 | }
41 |
42 | const search = instantsearch({
43 | appId: algolia.appId,
44 | apiKey: algolia.apiKey,
45 | indexName: algolia.indexName,
46 | searchParameters: {
47 | hitsPerPage: algolia.hits.per_page || 10
48 | },
49 | searchFunction: function (helper) {
50 | const searchInput = $('#algolia-search-input').find('input')
51 |
52 | if (searchInput.val()) {
53 | helper.search()
54 | }
55 | }
56 | })
57 |
58 | search.addWidget(
59 | instantsearch.widgets.searchBox({
60 | container: '#algolia-search-input',
61 | reset: false,
62 | magnifier: false,
63 | placeholder: GLOBAL_CONFIG.algolia.languages.input_placeholder
64 | })
65 | )
66 | search.addWidget(
67 | instantsearch.widgets.hits({
68 | container: '#algolia-hits',
69 | templates: {
70 | item: function (data) {
71 | const link = data.permalink ? data.permalink : (GLOBAL_CONFIG.root + data.path)
72 | return (
73 | '
' +
74 | data._highlightResult.title.value +
75 | ''
76 | )
77 | },
78 | empty: function (data) {
79 | return (
80 | '
' +
81 | GLOBAL_CONFIG.algolia.languages.hits_empty.replace(/\$\{query}/, data.query) +
82 | '
'
83 | )
84 | }
85 | },
86 | cssClasses: {
87 | item: 'algolia-hit-item'
88 | }
89 | })
90 | )
91 |
92 | search.addWidget(
93 | instantsearch.widgets.stats({
94 | container: '#algolia-stats',
95 | templates: {
96 | body: function (data) {
97 | const stats = GLOBAL_CONFIG.algolia.languages.hits_stats
98 | .replace(/\$\{hits}/, data.nbHits)
99 | .replace(/\$\{time}/, data.processingTimeMS)
100 | return (
101 | '
' +
102 | stats +
103 | '
' +
104 | '
' +
105 | ''
106 | )
107 | }
108 | }
109 | })
110 | )
111 |
112 | search.addWidget(
113 | instantsearch.widgets.pagination({
114 | container: '#algolia-pagination',
115 | scrollTo: false,
116 | showFirstLast: false,
117 | labels: {
118 | first: '
',
119 | last: '
',
120 | previous: '
',
121 | next: '
'
122 | },
123 | cssClasses: {
124 | root: 'pagination',
125 | item: 'pagination-item',
126 | link: 'page-number',
127 | active: 'current',
128 | disabled: 'disabled-item'
129 | }
130 | })
131 | )
132 | search.start()
133 | })
134 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/js/third-party/ClickShowText.js:
--------------------------------------------------------------------------------
1 | function co(){
2 | var colorElements = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f";
3 | var colorArray = colorElements.split(",");
4 | var color ="#";
5 | for(var i =0;i<6;i++){
6 | color+=colorArray[Math.floor(Math.random()*16)];
7 | }
8 | return color;
9 | };
10 | var a_idx = 0;
11 | jQuery(document).ready(function($) {
12 | $("body").click(function (e) {
13 |
14 | var config = GLOBAL_CONFIG.ClickShowText;
15 |
16 | /*这个数组中的每一个字符是你要浮动显示的词或句子,每次点击鼠标后按顺序出现*/
17 | var a = config.text.split(",");
18 | var $i = $("
").text(a[a_idx]);
19 | a_idx = (a_idx + 1) % a.length;
20 | var x = e.pageX,
21 | y = e.pageY;
22 | $i.css({
23 | "z-index": 150,
24 | "top": y - 20,
25 | "left": x -40,
26 | "position": "absolute",
27 | "font-weight": "bold",
28 | "color": co(),
29 | "cursor": "default",
30 | "font-size": config.fontSize || "inherit"
31 | });
32 | $("body").append($i);
33 | $i.animate({
34 | "top": y - 180,
35 | "opacity": 0
36 | },
37 | 1500,
38 | function() {
39 | $i.remove();
40 | });
41 | });
42 | });
--------------------------------------------------------------------------------
/themes/Butterfly/source/js/third-party/activate-power-mode.js:
--------------------------------------------------------------------------------
1 | !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.POWERMODE=e():t.POWERMODE=e()}(this,(function(){return function(t){var e={};function o(n){if(e[n])return e[n].exports;var r=e[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,o),r.loaded=!0,r.exports}return o.m=t,o.c=e,o.p="",o(0)}([function(t,e,o){"use strict";var n=document.createElement("canvas");n.width=window.innerWidth,n.height=window.innerHeight,n.style.cssText="position:fixed;top:0;left:0;pointer-events:none;z-index:999999",window.addEventListener("resize",(function(){n.width=window.innerWidth,n.height=window.innerHeight})),document.body.appendChild(n);var r=n.getContext("2d"),i=[],a=0,d=!1;function l(t,e){return Math.random()*(e-t)+t}function c(t){if(p.colorful){var e=l(0,360);return"hsla("+l(e-10,e+10)+", 100%, "+l(50,80)+"%, 1)"}return window.getComputedStyle(t).color}function u(t,e,o){return{x:t,y:e,alpha:1,color:o,velocity:{x:2*Math.random()-1,y:2*Math.random()-3.5}}}function p(){for(var t=function(){var t,e=document.activeElement;if("TEXTAREA"===e.tagName||"INPUT"===e.tagName&&"text"===e.getAttribute("type")){var n=o(1)(e,e.selectionEnd);return t=e.getBoundingClientRect(),{x:n.left+t.left,y:n.top+t.top,color:c(e)}}var r=window.getSelection();if(r.rangeCount){var i=r.getRangeAt(0),a=i.startContainer;return a.nodeType===document.TEXT_NODE&&(a=a.parentNode),{x:(t=i.getBoundingClientRect()).left,y:t.top,color:c(a)}}return{x:0,y:0,color:"transparent"}}(),e=5+Math.round(10*Math.random());e--;)i[a]=u(t.x,t.y,t.color),a=(a+1)%500;if(p.shake){var n=1+2*Math.random(),r=n*(Math.random()>.5?-1:1),l=n*(Math.random()>.5?-1:1);document.body.style.marginLeft=r+"px",document.body.style.marginTop=l+"px",setTimeout((function(){document.body.style.marginLeft="",document.body.style.marginTop=""}),75)}d||requestAnimationFrame(f)}function f(){d=!0,r.clearRect(0,0,n.width,n.height);for(var t=!1,e=n.getBoundingClientRect(),o=0;o
parseInt(c.height)&&(l.overflowY="scroll"):l.overflow="hidden",d.textContent=t.value.substring(0,n),"INPUT"===t.nodeName&&(d.textContent=d.textContent.replace(/\s/g," "));var u=document.createElement("span");u.textContent=t.value.substring(n)||".",d.appendChild(u);var p={top:u.offsetTop+parseInt(c.borderTopWidth),left:u.offsetLeft+parseInt(c.borderLeftWidth)};return i?u.style.backgroundColor="#aaa":document.body.removeChild(d),p}void 0!==t&&void 0!==t.exports?t.exports=n:window.getCaretCoordinates=n}()}])}));
--------------------------------------------------------------------------------
/themes/Butterfly/source/js/third-party/canvas-nest.js:
--------------------------------------------------------------------------------
1 | ! function () {
2 | var cn = document.getElementById('canvas_nest');
3 | var mb = cn.getAttribute("mobile");
4 |
5 | if (mb == 'false' && (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent))) {
6 | return;
7 | }
8 |
9 | function o(w, v, i) {
10 | return w.getAttribute(v) || i
11 | }
12 |
13 | function j(i) {
14 | return document.getElementsByTagName(i)
15 | }
16 |
17 | function l() {
18 | var i = j("script"),
19 | w = i.length,
20 | v = i[w - 1];
21 | return {
22 | l: w,
23 | z: o(v, "zIndex", -1),
24 | o: o(v, "opacity", 0.5),
25 | c: o(v, "color", "0,0,0"),
26 | n: o(v, "count", 99)
27 | }
28 | }
29 |
30 | function k() {
31 | r = u.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, n = u.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
32 | }
33 |
34 | function b() {
35 | e.clearRect(0, 0, r, n);
36 | var w = [f].concat(t);
37 | var x, v, A, B, z, y;
38 | t.forEach(function (i) {
39 | i.x += i.xa, i.y += i.ya, i.xa *= i.x > r || i.x < 0 ? -1 : 1, i.ya *= i.y > n || i.y < 0 ? -1 : 1, e.fillRect(i.x - 0.5, i.y - 0.5, 1, 1);
40 | for (v = 0; v < w.length; v++) {
41 | x = w[v];
42 | if (i !== x && null !== x.x && null !== x.y) {
43 | B = i.x - x.x, z = i.y - x.y, y = B * B + z * z;
44 | y < x.max && (x === f && y >= x.max / 2 && (i.x -= 0.03 * B, i.y -= 0.03 * z), A = (x.max - y) / x.max, e.beginPath(), e.lineWidth = A / 2, e.strokeStyle = "rgba(" + s.c + "," + (A + 0.2) + ")", e.moveTo(i.x, i.y), e.lineTo(x.x, x.y), e.stroke())
45 | }
46 | }
47 | w.splice(w.indexOf(i), 1)
48 | }), m(b)
49 | }
50 | var u = document.createElement("canvas"),
51 | s = l(),
52 | c = "c_n" + s.l,
53 | e = u.getContext("2d"),
54 | r, n, m = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (i) {
55 | window.setTimeout(i, 1000 / 45)
56 | },
57 | a = Math.random,
58 | f = {
59 | x: null,
60 | y: null,
61 | max: 20000
62 | };
63 | u.id = c;
64 | u.style.cssText = "position:fixed;top:0;left:0;z-index:" + s.z + ";opacity:" + s.o;
65 | j("body")[0].appendChild(u);
66 | k(), window.onresize = k;
67 | window.onmousemove = function (i) {
68 | i = i || window.event, f.x = i.clientX, f.y = i.clientY
69 | }, window.onmouseout = function () {
70 | f.x = null, f.y = null
71 | };
72 | for (var t = [], p = 0; s.n > p; p++) {
73 | var h = a() * r,
74 | g = a() * n,
75 | q = 2 * a() - 1,
76 | d = 2 * a() - 1;
77 | t.push({
78 | x: h,
79 | y: g,
80 | xa: q,
81 | ya: d,
82 | max: 6000
83 | })
84 | }
85 | setTimeout(function () {
86 | b()
87 | }, 100)
88 | }();
--------------------------------------------------------------------------------
/themes/Butterfly/source/js/third-party/canvas-ribbon.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2016 hustcc
3 | * License: MIT
4 | * Version: v1.0.1
5 | * GitHub: https://github.com/hustcc/ribbon.js
6 | **/
7 |
8 | !(function() {
9 | var script = document.getElementById("ribbon");
10 | var mb = script.getAttribute("mobile");
11 | if (
12 | mb == "false" &&
13 | /Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)
14 | ) {
15 | return;
16 | }
17 |
18 | var config = {
19 | z: attr(script, "zIndex", -1), // z-index
20 | a: attr(script, "alpha", 0.6), // alpha
21 | s: attr(script, "size", 90), // size
22 | c: attr(script, "data-click", true) // click-to-change
23 | };
24 |
25 | function attr(node, attr, default_value) {
26 | if (default_value === true) {
27 | return node.getAttribute(attr) || default_value;
28 | }
29 | return Number(node.getAttribute(attr)) || default_value;
30 | }
31 |
32 | var canvas = document.createElement("canvas"),
33 | g2d = canvas.getContext("2d"),
34 | pr = window.devicePixelRatio || 1,
35 | width = window.innerWidth,
36 | height = window.innerHeight,
37 | f = config.s,
38 | q,
39 | t,
40 | m = Math,
41 | r = 0,
42 | pi = m.PI * 2,
43 | cos = m.cos,
44 | random = m.random;
45 | canvas.id = "ribbon-canvas";
46 | canvas.width = width * pr;
47 | canvas.height = height * pr;
48 | g2d.scale(pr, pr);
49 | g2d.globalAlpha = config.a;
50 | canvas.style.cssText =
51 | "opacity: " +
52 | config.a +
53 | ";position:fixed;top:0;left:0;z-index: " +
54 | config.z +
55 | ";width:100%;height:100%;pointer-events:none;";
56 | // create canvas
57 | document.getElementsByTagName("body")[0].appendChild(canvas);
58 |
59 | function redraw() {
60 | g2d.clearRect(0, 0, width, height);
61 | q = [
62 | {
63 | x: 0,
64 | y: height * 0.7 + f
65 | },
66 | {
67 | x: 0,
68 | y: height * 0.7 - f
69 | }
70 | ];
71 | while (q[1].x < width + f) draw(q[0], q[1]);
72 | }
73 |
74 | function draw(i, j) {
75 | g2d.beginPath();
76 | g2d.moveTo(i.x, i.y);
77 | g2d.lineTo(j.x, j.y);
78 | var k = j.x + (random() * 2 - 0.25) * f,
79 | n = line(j.y);
80 | g2d.lineTo(k, n);
81 | g2d.closePath();
82 | r -= pi / -50;
83 | g2d.fillStyle =
84 | "#" +
85 | (
86 | ((cos(r) * 127 + 128) << 16) |
87 | ((cos(r + pi / 3) * 127 + 128) << 8) |
88 | (cos(r + (pi / 3) * 2) * 127 + 128)
89 | ).toString(16);
90 | g2d.fill();
91 | q[0] = q[1];
92 | q[1] = {
93 | x: k,
94 | y: n
95 | };
96 | }
97 |
98 | function line(p) {
99 | t = p + (random() * 2 - 1.1) * f;
100 | return t > height || t < 0 ? line(p) : t;
101 | }
102 | if (config.c !== "false") {
103 | document.onclick = redraw;
104 | document.ontouchstart = redraw;
105 | }
106 | redraw();
107 | })();
108 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/js/third-party/click_heart.js:
--------------------------------------------------------------------------------
1 | !(function(e, t, a) {
2 | function r(e) {
3 | var a = t.createElement("div");
4 | (a.className = "heart"),
5 | n.push({
6 | el: a,
7 | x: e.clientX - 5,
8 | y: e.clientY - 5,
9 | scale: 1,
10 | alpha: 1,
11 | color:
12 | "rgb(" +
13 | ~~(255 * Math.random()) +
14 | "," +
15 | ~~(255 * Math.random()) +
16 | "," +
17 | ~~(255 * Math.random()) +
18 | ")"
19 | }),
20 | t.body.appendChild(a);
21 | }
22 | var n = [];
23 | (e.requestAnimationFrame =
24 | e.requestAnimationFrame ||
25 | e.webkitRequestAnimationFrame ||
26 | e.mozRequestAnimationFrame ||
27 | e.oRequestAnimationFrame ||
28 | e.msRequestAnimationFrame ||
29 | function(e) {
30 | setTimeout(e, 1e3 / 60);
31 | }),
32 | (function(e) {
33 | var a = t.createElement("style");
34 | a.type = "text/css";
35 | try {
36 | a.appendChild(t.createTextNode(e));
37 | } catch (t) {
38 | a.styleSheet.cssText = e;
39 | }
40 | t.getElementsByTagName("head")[0].appendChild(a);
41 | })(
42 | ".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"
43 | ),
44 | (function() {
45 | var t = "function" == typeof e.onclick && e.onclick;
46 | e.onclick = function(e) {
47 | t && t(), r(e);
48 | };
49 | })(),
50 | (function e() {
51 | for (var a = 0; a < n.length; a++)
52 | n[a].alpha <= 0
53 | ? (t.body.removeChild(n[a].el), n.splice(a, 1))
54 | : (n[a].y--,
55 | (n[a].scale += 0.004),
56 | (n[a].alpha -= 0.013),
57 | (n[a].el.style.cssText =
58 | "left:" +
59 | n[a].x +
60 | "px;top:" +
61 | n[a].y +
62 | "px;opacity:" +
63 | n[a].alpha +
64 | ";transform:scale(" +
65 | n[a].scale +
66 | "," +
67 | n[a].scale +
68 | ") rotate(45deg);background:" +
69 | n[a].color +
70 | ";z-index:99999"));
71 | requestAnimationFrame(e);
72 | })();
73 | })(window, document);
74 |
--------------------------------------------------------------------------------
/themes/Butterfly/source/js/third-party/fireworks.js:
--------------------------------------------------------------------------------
1 | var canvasEl = document.querySelector('.fireworks')
2 | if (canvasEl) {
3 | var ctx = canvasEl.getContext('2d')
4 | var numberOfParticules = 30
5 | var pointerX = 0
6 | var pointerY = 0
7 | // var tap = ('ontouchstart' in window || navigator.msMaxTouchPoints) ? 'touchstart' : 'mousedown'
8 | // Fixed the mobile scroll
9 | var tap = 'mousedown'
10 | var colors = ['#FF1461', '#18FF92', '#5A87FF', '#FBF38C']
11 |
12 | var setCanvasSize = debounce(function () {
13 | canvasEl.width = window.innerWidth
14 | canvasEl.height = window.innerHeight
15 | canvasEl.style.width = window.innerWidth + 'px'
16 | canvasEl.style.height = window.innerHeight + 'px'
17 | canvasEl.getContext('2d').scale(1, 1)
18 | }, 500)
19 |
20 | var render = anime({
21 | duration: Infinity,
22 | update: function () {
23 | ctx.clearRect(0, 0, canvasEl.width, canvasEl.height)
24 | }
25 | })
26 |
27 | document.addEventListener(tap, function (e) {
28 | if (e.target.id !== 'sidebar' && e.target.id !== 'toggle-sidebar' && e.target.nodeName !== 'A' && e.target.nodeName !== 'IMG') {
29 | render.play()
30 | updateCoords(e)
31 | animateParticules(pointerX, pointerY)
32 | }
33 | }, false)
34 |
35 | setCanvasSize()
36 | window.addEventListener('resize', setCanvasSize, false)
37 | }
38 |
39 | function updateCoords (e) {
40 | pointerX = (e.clientX || e.touches[0].clientX) - canvasEl.getBoundingClientRect().left
41 | pointerY = e.clientY || e.touches[0].clientY - canvasEl.getBoundingClientRect().top
42 | }
43 |
44 | function setParticuleDirection (p) {
45 | var angle = anime.random(0, 360) * Math.PI / 180
46 | var value = anime.random(50, 180)
47 | var radius = [-1, 1][anime.random(0, 1)] * value
48 | return {
49 | x: p.x + radius * Math.cos(angle),
50 | y: p.y + radius * Math.sin(angle)
51 | }
52 | }
53 |
54 | function createParticule (x, y) {
55 | var p = {}
56 | p.x = x
57 | p.y = y
58 | p.color = colors[anime.random(0, colors.length - 1)]
59 | p.radius = anime.random(16, 32)
60 | p.endPos = setParticuleDirection(p)
61 | p.draw = function () {
62 | ctx.beginPath()
63 | ctx.arc(p.x, p.y, p.radius, 0, 2 * Math.PI, true)
64 | ctx.fillStyle = p.color
65 | ctx.fill()
66 | }
67 | return p
68 | }
69 |
70 | function createCircle (x, y) {
71 | var p = {}
72 | p.x = x
73 | p.y = y
74 | p.color = '#F00'
75 | p.radius = 0.1
76 | p.alpha = 0.5
77 | p.lineWidth = 6
78 | p.draw = function () {
79 | ctx.globalAlpha = p.alpha
80 | ctx.beginPath()
81 | ctx.arc(p.x, p.y, p.radius, 0, 2 * Math.PI, true)
82 | ctx.lineWidth = p.lineWidth
83 | ctx.strokeStyle = p.color
84 | ctx.stroke()
85 | ctx.globalAlpha = 1
86 | }
87 | return p
88 | }
89 |
90 | function renderParticule (anim) {
91 | for (var i = 0; i < anim.animatables.length; i++) {
92 | anim.animatables[i].target.draw()
93 | }
94 | }
95 |
96 | function animateParticules (x, y) {
97 | var circle = createCircle(x, y)
98 | var particules = []
99 | for (var i = 0; i < numberOfParticules; i++) {
100 | particules.push(createParticule(x, y))
101 | }
102 | anime.timeline().add({
103 | targets: particules,
104 | x: function (p) {
105 | return p.endPos.x
106 | },
107 | y: function (p) {
108 | return p.endPos.y
109 | },
110 | radius: 0.1,
111 | duration: anime.random(1200, 1800),
112 | easing: 'easeOutExpo',
113 | update: renderParticule
114 | })
115 | .add({
116 | targets: circle,
117 | radius: anime.random(80, 160),
118 | lineWidth: 0,
119 | alpha: {
120 | value: 0,
121 | easing: 'linear',
122 | duration: anime.random(600, 800)
123 | },
124 | duration: anime.random(1200, 1800),
125 | easing: 'easeOutExpo',
126 | update: renderParticule,
127 | offset: 0
128 | })
129 | }
--------------------------------------------------------------------------------