hexo-theme-shokax 0.5.2-hotfix.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +5 -5
- package/CODE_OF_CONDUCT.md +128 -128
- package/LICENSE +660 -660
- package/LICENSE-shoka +21 -21
- package/README.md +74 -74
- package/UsageRestrictions.md +25 -25
- package/_config.yml +359 -352
- package/languages/README.md +19 -19
- package/languages/default.yml +1 -1
- package/languages/en.yml +155 -155
- package/languages/ja.yml +155 -155
- package/languages/zh-CN.yml +155 -155
- package/languages/zh-HK.yml +155 -155
- package/languages/zh-TW.yml +155 -155
- package/layout/_alternate/atom.ejs +30 -30
- package/layout/_alternate/json.ejs +16 -16
- package/layout/_alternate/rss.ejs +34 -34
- package/layout/_mixin/breadcrumb.pug +33 -33
- package/layout/_mixin/card.pug +37 -37
- package/layout/_mixin/comment.pug +6 -6
- package/layout/_mixin/postmeta.pug +29 -29
- package/layout/_mixin/segment.pug +35 -35
- package/layout/_mixin/sidebar.pug +40 -40
- package/layout/_mixin/widgets.pug +28 -28
- package/layout/_partials/footer.pug +43 -43
- package/layout/_partials/head/head.pug +50 -50
- package/layout/_partials/head/head_com.pug +24 -24
- package/layout/_partials/head/pwa.pug +18 -18
- package/layout/_partials/header.pug +18 -18
- package/layout/_partials/layout.pug +138 -137
- package/layout/_partials/loading.pug +13 -13
- package/layout/_partials/pagination.pug +4 -4
- package/layout/_partials/post/copyright.pug +20 -20
- package/layout/_partials/post/footer.pug +20 -20
- package/layout/_partials/post/nav.pug +17 -17
- package/layout/_partials/post/post.pug +42 -42
- package/layout/_partials/post/reward.pug +18 -18
- package/layout/_partials/sidebar/menu.pug +37 -37
- package/layout/_partials/sidebar/overview.pug +42 -42
- package/layout/_partials/third-party/baidu-analytics.pug +11 -11
- package/layout/_partials/third-party/clarity.pug +8 -8
- package/layout/_partials/third-party/google-analytics.pug +9 -9
- package/layout/archive.pug +121 -121
- package/layout/category.pug +62 -62
- package/layout/index.pug +36 -36
- package/layout/page.pug +60 -60
- package/layout/post.pug +42 -42
- package/layout/tag.pug +46 -46
- package/package.json +6 -5
- package/scripts/generaters/script.js +2 -1
- package/source/assets/algolia_logo.svg +9 -9
- package/source/assets/logo.svg +16 -16
- package/source/css/_colors.styl +207 -207
- package/source/css/_common/components/components.styl +5 -5
- package/source/css/_common/components/pages/collapse.styl +119 -119
- package/source/css/_common/components/pages/home.styl +391 -391
- package/source/css/_common/components/pages/pages.styl +56 -56
- package/source/css/_common/components/pages/tag-cloud.styl +12 -12
- package/source/css/_common/components/post/breadcrumb.styl +39 -39
- package/source/css/_common/components/post/copyright.styl +41 -41
- package/source/css/_common/components/post/expand.styl +263 -263
- package/source/css/_common/components/post/footer.styl +11 -11
- package/source/css/_common/components/post/header.styl +79 -79
- package/source/css/_common/components/post/nav.styl +64 -64
- package/source/css/_common/components/post/post.styl +29 -29
- package/source/css/_common/components/post/reward.styl +50 -50
- package/source/css/_common/components/post/rtl.styl +12 -12
- package/source/css/_common/components/post/tags.styl +39 -39
- package/source/css/_common/components/tags/collapse.styl +72 -72
- package/source/css/_common/components/tags/container.styl +49 -49
- package/source/css/_common/components/tags/label.styl +12 -12
- package/source/css/_common/components/tags/links.styl +77 -77
- package/source/css/_common/components/tags/list.styl +131 -131
- package/source/css/_common/components/tags/note.styl +70 -70
- package/source/css/_common/components/tags/player.styl +361 -361
- package/source/css/_common/components/tags/quiz.styl +200 -200
- package/source/css/_common/components/tags/tabs.styl +89 -89
- package/source/css/_common/components/tags/tags.styl +9 -9
- package/source/css/_common/components/third-party/loading.styl +222 -222
- package/source/css/_common/components/third-party/mermaid/class.styl +90 -90
- package/source/css/_common/components/third-party/mermaid/flowchart.styl +72 -72
- package/source/css/_common/components/third-party/mermaid/gantt.styl +251 -251
- package/source/css/_common/components/third-party/mermaid/git.styl +7 -7
- package/source/css/_common/components/third-party/mermaid/mermaid.styl +37 -37
- package/source/css/_common/components/third-party/mermaid/pie.styl +9 -9
- package/source/css/_common/components/third-party/mermaid/sequence.styl +95 -95
- package/source/css/_common/components/third-party/mermaid/state.styl +130 -130
- package/source/css/_common/components/third-party/pace.styl +18 -18
- package/source/css/_common/components/third-party/search.styl +167 -167
- package/source/css/_common/components/third-party/theme.styl +151 -151
- package/source/css/_common/components/third-party/third-party.styl +22 -22
- package/source/css/_common/components/third-party/widgets.styl +57 -57
- package/source/css/_common/outline/footer/footer.styl +67 -67
- package/source/css/_common/outline/header/brand.styl +77 -77
- package/source/css/_common/outline/header/header.styl +20 -20
- package/source/css/_common/outline/header/image.styl +85 -85
- package/source/css/_common/outline/header/menu.styl +117 -117
- package/source/css/_common/outline/header/nav.styl +81 -81
- package/source/css/_common/outline/header/right.styl +15 -15
- package/source/css/_common/outline/header/tool.styl +207 -207
- package/source/css/_common/outline/header/waves.styl +57 -57
- package/source/css/_common/outline/mobile.styl +46 -46
- package/source/css/_common/outline/outline.styl +78 -78
- package/source/css/_common/outline/sidebar/author.styl +59 -59
- package/source/css/_common/outline/sidebar/dimmer.styl +23 -23
- package/source/css/_common/outline/sidebar/menu.styl +63 -63
- package/source/css/_common/outline/sidebar/quick.styl +43 -43
- package/source/css/_common/outline/sidebar/related.styl +56 -56
- package/source/css/_common/outline/sidebar/sidebar.styl +82 -82
- package/source/css/_common/outline/sidebar/social.styl +69 -69
- package/source/css/_common/outline/sidebar/state.styl +37 -37
- package/source/css/_common/outline/sidebar/tab.styl +71 -71
- package/source/css/_common/outline/sidebar/toc.styl +47 -47
- package/source/css/_common/scaffolding/animate.styl +322 -322
- package/source/css/_common/scaffolding/base.styl +192 -192
- package/source/css/_common/scaffolding/buttons.styl +48 -48
- package/source/css/_common/scaffolding/divider.styl +36 -36
- package/source/css/_common/scaffolding/iconfont.styl +443 -443
- package/source/css/_common/scaffolding/normalize.styl +273 -273
- package/source/css/_common/scaffolding/pagination.styl +81 -81
- package/source/css/_common/scaffolding/ribbon.styl +38 -38
- package/source/css/_common/scaffolding/scaffolding.styl +14 -14
- package/source/css/_common/scaffolding/scrollbar.styl +37 -37
- package/source/css/_common/scaffolding/tables.styl +50 -50
- package/source/css/_common/scaffolding/tip.styl +19 -19
- package/source/css/_common/scaffolding/toggles.styl +59 -59
- package/source/css/_iconfont.styl +455 -455
- package/source/css/_mixins.styl +148 -148
- package/source/css/_variables.styl +89 -89
- package/source/css/app.styl +25 -25
- package/source/css/mermaid.styl +5 -5
- package/source/css/page.styl +2 -2
- package/source/css/post.styl +4 -4
- package/source/css/scaffolding.styl +4 -4
- package/source/js/_app/components/cloudflare.ts +18 -18
- package/source/js/_app/components/comments.ts +88 -88
- package/source/js/_app/components/sidebar.ts +243 -243
- package/source/js/_app/components/tcomments.ts +53 -53
- package/source/js/_app/globals/globalVars.ts +84 -84
- package/source/js/_app/globals/handles.ts +124 -124
- package/source/js/_app/globals/themeColor.ts +62 -62
- package/source/js/_app/globals/thirdparty.ts +63 -63
- package/source/js/_app/globals/tools.ts +73 -73
- package/source/js/_app/library/anime.ts +121 -121
- package/source/js/_app/library/declare.d.ts +129 -128
- package/source/js/_app/library/proto.ts +70 -70
- package/source/js/_app/library/vue.ts +49 -49
- package/source/js/_app/page/common.ts +41 -41
- package/source/js/_app/page/imageviewer.ts +15 -15
- package/source/js/_app/page/post.ts +251 -251
- package/source/js/_app/page/search.ts +109 -109
- package/source/js/_app/page/tab.ts +59 -59
- package/source/js/_app/pjax/domInit.ts +102 -102
- package/source/js/_app/pjax/refresh.ts +117 -117
- package/source/js/_app/pjax/siteInit.ts +93 -90
- package/source/js/_app/player.ts +13 -13
- package/toolbox/compiler.mjs +49 -49
- package/toolbox/dev-version.mjs +14 -14
- package/toolbox/hoistdep.mjs +5 -5
- package/toolbox/lib.mjs +63 -63
@@ -1,109 +1,109 @@
|
|
1
|
-
import { CONFIG, siteSearch } from '../globals/globalVars'
|
2
|
-
import { transition } from '../library/anime'
|
3
|
-
import { searchBox, configure, stats, hits, pagination } from 'instantsearch.js/es/widgets'
|
4
|
-
import type { HitHighlightResult } from 'instantsearch.js/es/types/results'
|
5
|
-
import instantsearch from 'instantsearch.js'
|
6
|
-
import { liteClient as algoliasearch } from 'algoliasearch/lite'
|
7
|
-
|
8
|
-
export function algoliaSearch () {
|
9
|
-
const search = instantsearch({
|
10
|
-
indexName: CONFIG.search.indexName,
|
11
|
-
searchClient: algoliasearch(CONFIG.search.appID, CONFIG.search.apiKey),
|
12
|
-
// TODO 移除弃用函数
|
13
|
-
searchFunction (helper) {
|
14
|
-
const searchInput = document.querySelector('.search-input') as HTMLInputElement
|
15
|
-
if (searchInput.value) {
|
16
|
-
helper.search()
|
17
|
-
}
|
18
|
-
}
|
19
|
-
})
|
20
|
-
|
21
|
-
// Registering Widgets
|
22
|
-
search.addWidgets([
|
23
|
-
configure({
|
24
|
-
hitsPerPage: CONFIG.search.hits.per_page || 10
|
25
|
-
}),
|
26
|
-
|
27
|
-
searchBox({
|
28
|
-
container: '.search-input-container',
|
29
|
-
placeholder: LOCAL.search.placeholder,
|
30
|
-
// Hide default icons of algolia search
|
31
|
-
showReset: false,
|
32
|
-
showSubmit: false,
|
33
|
-
showLoadingIndicator: false,
|
34
|
-
cssClasses: {
|
35
|
-
input: 'search-input'
|
36
|
-
}
|
37
|
-
}),
|
38
|
-
|
39
|
-
stats({
|
40
|
-
container: '#search-stats',
|
41
|
-
templates: {
|
42
|
-
text (data) {
|
43
|
-
const stats = LOCAL.search.stats
|
44
|
-
.replace(/\$\{hits}/, data.nbHits.toString())
|
45
|
-
.replace(/\$\{time}/, data.processingTimeMS.toString())
|
46
|
-
return stats + '<span class="algolia-powered"></span><hr>'
|
47
|
-
}
|
48
|
-
}
|
49
|
-
}),
|
50
|
-
|
51
|
-
hits({
|
52
|
-
container: '#search-hits',
|
53
|
-
templates: {
|
54
|
-
item (data) {
|
55
|
-
const cats = data.categories ? '<span>' + data.categories.join('<i class="ic i-angle-right"></i>') + '</span>' : ''
|
56
|
-
return '<a href="' + CONFIG.root + data.path + '">' + cats + (data._highlightResult.title as HitHighlightResult).value + '</a>'
|
57
|
-
},
|
58
|
-
empty (data) {
|
59
|
-
return '<div id="hits-empty">' +
|
60
|
-
LOCAL.search.empty.replace(/\$\{query}/, data.query) +
|
61
|
-
'</div>'
|
62
|
-
}
|
63
|
-
},
|
64
|
-
cssClasses: {
|
65
|
-
item: 'item'
|
66
|
-
}
|
67
|
-
}),
|
68
|
-
|
69
|
-
pagination({
|
70
|
-
container: '#search-pagination',
|
71
|
-
scrollTo: false,
|
72
|
-
showFirst: false,
|
73
|
-
showLast: false,
|
74
|
-
templates: {
|
75
|
-
first: '<i class="ic i-angle-double-left"></i>',
|
76
|
-
last: '<i class="ic i-angle-double-right"></i>',
|
77
|
-
previous: '<i class="ic i-angle-left"></i>',
|
78
|
-
next: '<i class="ic i-angle-right"></i>'
|
79
|
-
},
|
80
|
-
cssClasses: {
|
81
|
-
root: 'pagination',
|
82
|
-
item: 'pagination-item',
|
83
|
-
link: 'page-number',
|
84
|
-
selectedItem: 'current',
|
85
|
-
disabledItem: 'disabled-item'
|
86
|
-
}
|
87
|
-
})
|
88
|
-
])
|
89
|
-
|
90
|
-
search.start()
|
91
|
-
|
92
|
-
// Monitor main search box
|
93
|
-
const onPopupClose = () => {
|
94
|
-
document.body.style.overflow = ''
|
95
|
-
transition(siteSearch, 0) // "transition.shrinkOut"
|
96
|
-
}
|
97
|
-
|
98
|
-
siteSearch.addEventListener('click', (event) => {
|
99
|
-
if (event.target === siteSearch) {
|
100
|
-
onPopupClose()
|
101
|
-
}
|
102
|
-
})
|
103
|
-
document.querySelector('.close-btn').addEventListener('click', onPopupClose)
|
104
|
-
window.addEventListener('keyup', (event) => {
|
105
|
-
if (event.key === 'Escape') {
|
106
|
-
onPopupClose()
|
107
|
-
}
|
108
|
-
})
|
109
|
-
}
|
1
|
+
import { CONFIG, siteSearch } from '../globals/globalVars'
|
2
|
+
import { transition } from '../library/anime'
|
3
|
+
import { searchBox, configure, stats, hits, pagination } from 'instantsearch.js/es/widgets'
|
4
|
+
import type { HitHighlightResult } from 'instantsearch.js/es/types/results'
|
5
|
+
import instantsearch from 'instantsearch.js'
|
6
|
+
import { liteClient as algoliasearch } from 'algoliasearch/lite'
|
7
|
+
|
8
|
+
export function algoliaSearch () {
|
9
|
+
const search = instantsearch({
|
10
|
+
indexName: CONFIG.search.indexName,
|
11
|
+
searchClient: algoliasearch(CONFIG.search.appID, CONFIG.search.apiKey),
|
12
|
+
// TODO 移除弃用函数
|
13
|
+
searchFunction (helper) {
|
14
|
+
const searchInput = document.querySelector('.search-input') as HTMLInputElement
|
15
|
+
if (searchInput.value) {
|
16
|
+
helper.search()
|
17
|
+
}
|
18
|
+
}
|
19
|
+
})
|
20
|
+
|
21
|
+
// Registering Widgets
|
22
|
+
search.addWidgets([
|
23
|
+
configure({
|
24
|
+
hitsPerPage: CONFIG.search.hits.per_page || 10
|
25
|
+
}),
|
26
|
+
|
27
|
+
searchBox({
|
28
|
+
container: '.search-input-container',
|
29
|
+
placeholder: LOCAL.search.placeholder,
|
30
|
+
// Hide default icons of algolia search
|
31
|
+
showReset: false,
|
32
|
+
showSubmit: false,
|
33
|
+
showLoadingIndicator: false,
|
34
|
+
cssClasses: {
|
35
|
+
input: 'search-input'
|
36
|
+
}
|
37
|
+
}),
|
38
|
+
|
39
|
+
stats({
|
40
|
+
container: '#search-stats',
|
41
|
+
templates: {
|
42
|
+
text (data) {
|
43
|
+
const stats = LOCAL.search.stats
|
44
|
+
.replace(/\$\{hits}/, data.nbHits.toString())
|
45
|
+
.replace(/\$\{time}/, data.processingTimeMS.toString())
|
46
|
+
return stats + '<span class="algolia-powered"></span><hr>'
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}),
|
50
|
+
|
51
|
+
hits({
|
52
|
+
container: '#search-hits',
|
53
|
+
templates: {
|
54
|
+
item (data) {
|
55
|
+
const cats = data.categories ? '<span>' + data.categories.join('<i class="ic i-angle-right"></i>') + '</span>' : ''
|
56
|
+
return '<a href="' + CONFIG.root + data.path + '">' + cats + (data._highlightResult.title as HitHighlightResult).value + '</a>'
|
57
|
+
},
|
58
|
+
empty (data) {
|
59
|
+
return '<div id="hits-empty">' +
|
60
|
+
LOCAL.search.empty.replace(/\$\{query}/, data.query) +
|
61
|
+
'</div>'
|
62
|
+
}
|
63
|
+
},
|
64
|
+
cssClasses: {
|
65
|
+
item: 'item'
|
66
|
+
}
|
67
|
+
}),
|
68
|
+
|
69
|
+
pagination({
|
70
|
+
container: '#search-pagination',
|
71
|
+
scrollTo: false,
|
72
|
+
showFirst: false,
|
73
|
+
showLast: false,
|
74
|
+
templates: {
|
75
|
+
first: '<i class="ic i-angle-double-left"></i>',
|
76
|
+
last: '<i class="ic i-angle-double-right"></i>',
|
77
|
+
previous: '<i class="ic i-angle-left"></i>',
|
78
|
+
next: '<i class="ic i-angle-right"></i>'
|
79
|
+
},
|
80
|
+
cssClasses: {
|
81
|
+
root: 'pagination',
|
82
|
+
item: 'pagination-item',
|
83
|
+
link: 'page-number',
|
84
|
+
selectedItem: 'current',
|
85
|
+
disabledItem: 'disabled-item'
|
86
|
+
}
|
87
|
+
})
|
88
|
+
])
|
89
|
+
|
90
|
+
search.start()
|
91
|
+
|
92
|
+
// Monitor main search box
|
93
|
+
const onPopupClose = () => {
|
94
|
+
document.body.style.overflow = ''
|
95
|
+
transition(siteSearch, 0) // "transition.shrinkOut"
|
96
|
+
}
|
97
|
+
|
98
|
+
siteSearch.addEventListener('click', (event) => {
|
99
|
+
if (event.target === siteSearch) {
|
100
|
+
onPopupClose()
|
101
|
+
}
|
102
|
+
})
|
103
|
+
document.querySelector('.close-btn').addEventListener('click', onPopupClose)
|
104
|
+
window.addEventListener('keyup', (event) => {
|
105
|
+
if (event.key === 'Escape') {
|
106
|
+
onPopupClose()
|
107
|
+
}
|
108
|
+
})
|
109
|
+
}
|
@@ -1,59 +1,59 @@
|
|
1
|
-
import { pageScroll } from '../library/anime'
|
2
|
-
import { createChild } from '../library/proto'
|
3
|
-
|
4
|
-
export const tabFormat = () => {
|
5
|
-
// tab
|
6
|
-
let first_tab:boolean
|
7
|
-
document.querySelectorAll('div.tab').forEach((element) => {
|
8
|
-
if (element.getAttribute('data-ready')) { return }
|
9
|
-
|
10
|
-
const id = element.getAttribute('data-id')
|
11
|
-
const title = element.getAttribute('data-title')
|
12
|
-
let box = document.getElementById(id)
|
13
|
-
if (!box) {
|
14
|
-
box = document.createElement('div')
|
15
|
-
box.className = 'tabs'
|
16
|
-
box.id = id
|
17
|
-
box.innerHTML = '<div class="show-btn"></div>'
|
18
|
-
|
19
|
-
const showBtn = box.querySelector('.show-btn')
|
20
|
-
showBtn.addEventListener('click', () => {
|
21
|
-
pageScroll(box)
|
22
|
-
})
|
23
|
-
|
24
|
-
element.parentNode.insertBefore(box, element)
|
25
|
-
first_tab = true
|
26
|
-
} else {
|
27
|
-
first_tab = false
|
28
|
-
}
|
29
|
-
|
30
|
-
let ul = box.querySelector('.nav ul')
|
31
|
-
if (!ul) {
|
32
|
-
ul = createChild(box, 'div', {
|
33
|
-
className: 'nav',
|
34
|
-
innerHTML: '<ul></ul>'
|
35
|
-
}).querySelector('ul')
|
36
|
-
}
|
37
|
-
|
38
|
-
const li = createChild(ul, 'li', {
|
39
|
-
innerHTML: title
|
40
|
-
})
|
41
|
-
|
42
|
-
if (first_tab) {
|
43
|
-
li.classList.add('active')
|
44
|
-
element.classList.add('active')
|
45
|
-
}
|
46
|
-
|
47
|
-
li.addEventListener('click', (event) => {
|
48
|
-
const target = event.currentTarget as HTMLElement
|
49
|
-
box.querySelectorAll('.active').forEach((el) => {
|
50
|
-
el.classList.remove('active')
|
51
|
-
})
|
52
|
-
element.classList.add('active')
|
53
|
-
target.classList.add('active')
|
54
|
-
})
|
55
|
-
|
56
|
-
box.appendChild(element)
|
57
|
-
element.setAttribute('data-ready', String(true))
|
58
|
-
})
|
59
|
-
}
|
1
|
+
import { pageScroll } from '../library/anime'
|
2
|
+
import { createChild } from '../library/proto'
|
3
|
+
|
4
|
+
export const tabFormat = () => {
|
5
|
+
// tab
|
6
|
+
let first_tab:boolean
|
7
|
+
document.querySelectorAll('div.tab').forEach((element) => {
|
8
|
+
if (element.getAttribute('data-ready')) { return }
|
9
|
+
|
10
|
+
const id = element.getAttribute('data-id')
|
11
|
+
const title = element.getAttribute('data-title')
|
12
|
+
let box = document.getElementById(id)
|
13
|
+
if (!box) {
|
14
|
+
box = document.createElement('div')
|
15
|
+
box.className = 'tabs'
|
16
|
+
box.id = id
|
17
|
+
box.innerHTML = '<div class="show-btn"></div>'
|
18
|
+
|
19
|
+
const showBtn = box.querySelector('.show-btn')
|
20
|
+
showBtn.addEventListener('click', () => {
|
21
|
+
pageScroll(box)
|
22
|
+
})
|
23
|
+
|
24
|
+
element.parentNode.insertBefore(box, element)
|
25
|
+
first_tab = true
|
26
|
+
} else {
|
27
|
+
first_tab = false
|
28
|
+
}
|
29
|
+
|
30
|
+
let ul = box.querySelector('.nav ul')
|
31
|
+
if (!ul) {
|
32
|
+
ul = createChild(box, 'div', {
|
33
|
+
className: 'nav',
|
34
|
+
innerHTML: '<ul></ul>'
|
35
|
+
}).querySelector('ul')
|
36
|
+
}
|
37
|
+
|
38
|
+
const li = createChild(ul, 'li', {
|
39
|
+
innerHTML: title
|
40
|
+
})
|
41
|
+
|
42
|
+
if (first_tab) {
|
43
|
+
li.classList.add('active')
|
44
|
+
element.classList.add('active')
|
45
|
+
}
|
46
|
+
|
47
|
+
li.addEventListener('click', (event) => {
|
48
|
+
const target = event.currentTarget as HTMLElement
|
49
|
+
box.querySelectorAll('.active').forEach((el) => {
|
50
|
+
el.classList.remove('active')
|
51
|
+
})
|
52
|
+
element.classList.add('active')
|
53
|
+
target.classList.add('active')
|
54
|
+
})
|
55
|
+
|
56
|
+
box.appendChild(element)
|
57
|
+
element.setAttribute('data-ready', String(true))
|
58
|
+
})
|
59
|
+
}
|
@@ -1,102 +1,102 @@
|
|
1
|
-
import { backToTopHandle, goToBottomHandle, goToCommentHandle, sideBarToggleHandle } from '../components/sidebar'
|
2
|
-
import {
|
3
|
-
backToTop,
|
4
|
-
goToComment,
|
5
|
-
loadCat,
|
6
|
-
menuToggle,
|
7
|
-
quickBtn, setBackToTop, setGoToComment, setShowContents, setToolBtn,
|
8
|
-
showContents,
|
9
|
-
siteHeader,
|
10
|
-
siteNav,
|
11
|
-
toolBtn
|
12
|
-
} from '../globals/globalVars'
|
13
|
-
import { Loader } from '../globals/thirdparty'
|
14
|
-
import { createChild } from '../library/proto'
|
15
|
-
import { initAudioPlayer } from '../player'
|
16
|
-
|
17
|
-
export default async function domInit () {
|
18
|
-
document.querySelectorAll('.overview .menu > .item').forEach((el) => {
|
19
|
-
siteNav.querySelector('.menu').appendChild(el.cloneNode(true))
|
20
|
-
})
|
21
|
-
|
22
|
-
loadCat.addEventListener('click', Loader.vanish)
|
23
|
-
menuToggle.addEventListener('click', sideBarToggleHandle)
|
24
|
-
document.querySelector('.dimmer').addEventListener('click', sideBarToggleHandle)
|
25
|
-
|
26
|
-
quickBtn.querySelector('.down').addEventListener('click', goToBottomHandle)
|
27
|
-
quickBtn.querySelector('.up').addEventListener('click', backToTopHandle)
|
28
|
-
|
29
|
-
if (!toolBtn) {
|
30
|
-
setToolBtn(createChild(siteHeader, 'div', {
|
31
|
-
id: 'tool',
|
32
|
-
innerHTML: `<div class="item player">
|
33
|
-
${__shokax_player__ ? '<div class="play-pause btn" id="playBtn"></div><div class="music btn btn" id="showBtn"></div>' : ''}
|
34
|
-
</div>
|
35
|
-
<div class="item contents">
|
36
|
-
<i class="ic i-list-ol"></i>
|
37
|
-
</div>
|
38
|
-
<div class="item chat">
|
39
|
-
<i class="ic i-comments"></i>
|
40
|
-
</div>
|
41
|
-
<div class="item back-to-top">
|
42
|
-
<i class="ic i-arrow-up"></i>
|
43
|
-
<span>0%</span>
|
44
|
-
</div>`
|
45
|
-
}))
|
46
|
-
}
|
47
|
-
|
48
|
-
setBackToTop(toolBtn.querySelector('.back-to-top'))
|
49
|
-
setGoToComment(toolBtn.querySelector('.chat'))
|
50
|
-
setShowContents(toolBtn.querySelector('.contents'))
|
51
|
-
|
52
|
-
backToTop.addEventListener('click', backToTopHandle)
|
53
|
-
goToComment.addEventListener('click', goToCommentHandle)
|
54
|
-
showContents.addEventListener('click', sideBarToggleHandle)
|
55
|
-
|
56
|
-
if (__shokax_player__) {
|
57
|
-
await initAudioPlayer()
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
const createIntersectionObserver = () => {
|
62
|
-
// waves在视口外时停止动画
|
63
|
-
new IntersectionObserver(([entry]) => {
|
64
|
-
if (entry.isIntersecting) {
|
65
|
-
document.querySelectorAll('.parallax>use').forEach(i => {
|
66
|
-
i.classList.remove('stop-animation')
|
67
|
-
})
|
68
|
-
document.querySelectorAll('#imgs .item').forEach(i => {
|
69
|
-
i.classList.remove('stop-animation')
|
70
|
-
})
|
71
|
-
} else {
|
72
|
-
document.querySelectorAll('.parallax>use').forEach(i => {
|
73
|
-
i.classList.add('stop-animation')
|
74
|
-
})
|
75
|
-
// waves不可见时imgs也应该不可见了
|
76
|
-
document.querySelectorAll('#imgs .item').forEach(i => {
|
77
|
-
i.classList.add('stop-animation')
|
78
|
-
})
|
79
|
-
}
|
80
|
-
}, {
|
81
|
-
root: null,
|
82
|
-
threshold: 0.2
|
83
|
-
}).observe(document.getElementById('waves'))
|
84
|
-
|
85
|
-
// sakura在视口外时停止动画
|
86
|
-
new IntersectionObserver(([entry]) => {
|
87
|
-
if (entry.isIntersecting) {
|
88
|
-
document.querySelectorAll('.with-love>i').forEach(i => {
|
89
|
-
i.classList.remove('stop-animation')
|
90
|
-
})
|
91
|
-
} else {
|
92
|
-
document.querySelectorAll('.with-love>i').forEach(i => {
|
93
|
-
i.classList.add('stop-animation')
|
94
|
-
})
|
95
|
-
}
|
96
|
-
}, {
|
97
|
-
root: null,
|
98
|
-
threshold: 0.2
|
99
|
-
}).observe(document.querySelector('.with-love'))
|
100
|
-
}
|
101
|
-
createIntersectionObserver()
|
102
|
-
}
|
1
|
+
import { backToTopHandle, goToBottomHandle, goToCommentHandle, sideBarToggleHandle } from '../components/sidebar'
|
2
|
+
import {
|
3
|
+
backToTop,
|
4
|
+
goToComment,
|
5
|
+
loadCat,
|
6
|
+
menuToggle,
|
7
|
+
quickBtn, setBackToTop, setGoToComment, setShowContents, setToolBtn,
|
8
|
+
showContents,
|
9
|
+
siteHeader,
|
10
|
+
siteNav,
|
11
|
+
toolBtn
|
12
|
+
} from '../globals/globalVars'
|
13
|
+
import { Loader } from '../globals/thirdparty'
|
14
|
+
import { createChild } from '../library/proto'
|
15
|
+
import { initAudioPlayer } from '../player'
|
16
|
+
|
17
|
+
export default async function domInit () {
|
18
|
+
document.querySelectorAll('.overview .menu > .item').forEach((el) => {
|
19
|
+
siteNav.querySelector('.menu').appendChild(el.cloneNode(true))
|
20
|
+
})
|
21
|
+
|
22
|
+
loadCat.addEventListener('click', Loader.vanish)
|
23
|
+
menuToggle.addEventListener('click', sideBarToggleHandle)
|
24
|
+
document.querySelector('.dimmer').addEventListener('click', sideBarToggleHandle)
|
25
|
+
|
26
|
+
quickBtn.querySelector('.down').addEventListener('click', goToBottomHandle)
|
27
|
+
quickBtn.querySelector('.up').addEventListener('click', backToTopHandle)
|
28
|
+
|
29
|
+
if (!toolBtn) {
|
30
|
+
setToolBtn(createChild(siteHeader, 'div', {
|
31
|
+
id: 'tool',
|
32
|
+
innerHTML: `<div class="item player">
|
33
|
+
${__shokax_player__ ? '<div class="play-pause btn" id="playBtn"></div><div class="music btn btn" id="showBtn"></div>' : ''}
|
34
|
+
</div>
|
35
|
+
<div class="item contents">
|
36
|
+
<i class="ic i-list-ol"></i>
|
37
|
+
</div>
|
38
|
+
<div class="item chat">
|
39
|
+
<i class="ic i-comments"></i>
|
40
|
+
</div>
|
41
|
+
<div class="item back-to-top">
|
42
|
+
<i class="ic i-arrow-up"></i>
|
43
|
+
<span>0%</span>
|
44
|
+
</div>`
|
45
|
+
}))
|
46
|
+
}
|
47
|
+
|
48
|
+
setBackToTop(toolBtn.querySelector('.back-to-top'))
|
49
|
+
setGoToComment(toolBtn.querySelector('.chat'))
|
50
|
+
setShowContents(toolBtn.querySelector('.contents'))
|
51
|
+
|
52
|
+
backToTop.addEventListener('click', backToTopHandle)
|
53
|
+
goToComment.addEventListener('click', goToCommentHandle)
|
54
|
+
showContents.addEventListener('click', sideBarToggleHandle)
|
55
|
+
|
56
|
+
if (__shokax_player__) {
|
57
|
+
await initAudioPlayer()
|
58
|
+
}
|
59
|
+
|
60
|
+
|
61
|
+
const createIntersectionObserver = () => {
|
62
|
+
// waves在视口外时停止动画
|
63
|
+
new IntersectionObserver(([entry]) => {
|
64
|
+
if (entry.isIntersecting) {
|
65
|
+
document.querySelectorAll('.parallax>use').forEach(i => {
|
66
|
+
i.classList.remove('stop-animation')
|
67
|
+
})
|
68
|
+
document.querySelectorAll('#imgs .item').forEach(i => {
|
69
|
+
i.classList.remove('stop-animation')
|
70
|
+
})
|
71
|
+
} else {
|
72
|
+
document.querySelectorAll('.parallax>use').forEach(i => {
|
73
|
+
i.classList.add('stop-animation')
|
74
|
+
})
|
75
|
+
// waves不可见时imgs也应该不可见了
|
76
|
+
document.querySelectorAll('#imgs .item').forEach(i => {
|
77
|
+
i.classList.add('stop-animation')
|
78
|
+
})
|
79
|
+
}
|
80
|
+
}, {
|
81
|
+
root: null,
|
82
|
+
threshold: 0.2
|
83
|
+
}).observe(document.getElementById('waves'))
|
84
|
+
|
85
|
+
// sakura在视口外时停止动画
|
86
|
+
new IntersectionObserver(([entry]) => {
|
87
|
+
if (entry.isIntersecting) {
|
88
|
+
document.querySelectorAll('.with-love>i').forEach(i => {
|
89
|
+
i.classList.remove('stop-animation')
|
90
|
+
})
|
91
|
+
} else {
|
92
|
+
document.querySelectorAll('.with-love>i').forEach(i => {
|
93
|
+
i.classList.add('stop-animation')
|
94
|
+
})
|
95
|
+
}
|
96
|
+
}, {
|
97
|
+
root: null,
|
98
|
+
threshold: 0.2
|
99
|
+
}).observe(document.querySelector('.with-love'))
|
100
|
+
}
|
101
|
+
createIntersectionObserver()
|
102
|
+
}
|