hexo-theme-shokax 0.5.0-dev-f787465 → 0.5.0-dev-36bb58f
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/README.md +2 -2
- package/UsageRestrictions.md +1 -1
- package/_config.yml +14 -15
- package/languages/en.yml +2 -0
- package/languages/ja.yml +2 -0
- package/languages/zh-CN.yml +2 -0
- package/languages/zh-HK.yml +2 -0
- package/languages/zh-TW.yml +2 -0
- package/layout/_partials/layout.pug +10 -5
- package/layout/_partials/post/footer.pug +8 -5
- package/package.json +31 -21
- package/scripts/generaters/config.js +12 -7
- package/scripts/generaters/images.js +9 -8
- package/scripts/generaters/script.js +21 -33
- package/scripts/generaters/summary_ai.js +130 -0
- package/scripts/helpers/summary_ai.js +1 -108
- package/scripts/plugin/index.js +32 -69
- package/source/css/_common/outline/sidebar/quick.styl +1 -1
- package/source/css/_common/outline/sidebar/sidebar.styl +2 -0
- package/source/js/_app/components/comments.ts +0 -2
- package/source/js/_app/components/sidebar.ts +37 -36
- package/source/js/_app/globals/globalVars.ts +0 -3
- package/source/js/_app/globals/handles.ts +9 -9
- package/source/js/_app/globals/themeColor.ts +5 -6
- package/source/js/_app/globals/thirdparty.ts +2 -2
- package/source/js/_app/globals/tools.ts +4 -6
- package/source/js/_app/library/anime.ts +30 -19
- package/source/js/_app/library/declare.d.ts +1 -0
- package/source/js/_app/library/proto.ts +0 -67
- package/source/js/_app/library/vue.ts +6 -7
- package/source/js/_app/page/common.ts +8 -10
- package/source/js/_app/page/fancybox.ts +13 -13
- package/source/js/_app/page/post.ts +42 -44
- package/source/js/_app/page/search.ts +0 -1
- package/source/js/_app/page/tab.ts +8 -9
- package/source/js/_app/pjax/domInit.ts +2 -5
- package/source/js/_app/pjax/refresh.ts +9 -0
- package/source/js/_app/pjax/siteInit.ts +18 -14
- package/source/js/_app/player.ts +26 -27
- package/toolbox/compiler.mjs +20 -48
- package/scripts/plugin/lib/injects-point.js +0 -41
- package/scripts/plugin/lib/injects.js +0 -105
- package/source/js/_app/library/dom.ts +0 -28
- package/source/js/_app/library/storage.ts +0 -12
@@ -1,5 +1,3 @@
|
|
1
|
-
import { $dom } from './dom'
|
2
|
-
|
3
1
|
export const insertAfter = function (el: Element, element: HTMLElement): void {
|
4
2
|
const parent = el.parentNode
|
5
3
|
if (parent.lastChild === el) {
|
@@ -70,68 +68,3 @@ export const setDisplay = function (el: HTMLElement, d: string): HTMLElement {
|
|
70
68
|
el.style.display = d
|
71
69
|
return el
|
72
70
|
}
|
73
|
-
|
74
|
-
export default function initProto () {
|
75
|
-
Object.assign(HTMLElement.prototype, {
|
76
|
-
/**
|
77
|
-
* 找到此节点所有符合selector选择器的子节点
|
78
|
-
* @deprecated Will be removed in the v0.5
|
79
|
-
*/
|
80
|
-
find (selector: string): NodeListOf<HTMLElement> {
|
81
|
-
return $dom.all(selector, this)
|
82
|
-
},
|
83
|
-
/**
|
84
|
-
* 这个方法接受三个参数:
|
85
|
-
* type 表示操作类型('add'、'remove'、'toggle'),
|
86
|
-
* className 是一个或多个要操作的类名,
|
87
|
-
* display 是一个可选的布尔值,用于在执行切换操作时指定类名是否应显示或隐藏。
|
88
|
-
* 该方法会根据操作类型执行相应的类名操作。
|
89
|
-
* @deprecated Will be removed in the v0.5
|
90
|
-
*/
|
91
|
-
_class (type: string, className: string, display?: boolean): void {
|
92
|
-
const classNames = className.indexOf(' ') ? className.split(' ') : [className]
|
93
|
-
classNames.forEach((name) => {
|
94
|
-
if (type === 'toggle') {
|
95
|
-
this.classList.toggle(name, display)
|
96
|
-
} else {
|
97
|
-
this.classList[type](name)
|
98
|
-
}
|
99
|
-
})
|
100
|
-
},
|
101
|
-
/**
|
102
|
-
* 这个方法是对 _class 方法的封装,调用时会将操作类型设为 'add',然后执行添加类名的操作。
|
103
|
-
* 最后,它返回当前的 EventTarget,通常是 DOM 元素本身,以支持链式调用。
|
104
|
-
* @deprecated Will be removed in the v0.5
|
105
|
-
*/
|
106
|
-
addClass (className: string): EventTarget {
|
107
|
-
this._class('add', className)
|
108
|
-
return this
|
109
|
-
},
|
110
|
-
/**
|
111
|
-
* 这个方法是对 _class 方法的封装,调用时会将操作类型设为 'remove',然后执行移除类名的操作。
|
112
|
-
* 最后,它返回当前的 EventTarget,通常是 DOM 元素本身,以支持链式调用。
|
113
|
-
* @deprecated Will be removed in the v0.5
|
114
|
-
*/
|
115
|
-
removeClass (className: string): EventTarget {
|
116
|
-
this._class('remove', className)
|
117
|
-
return this
|
118
|
-
},
|
119
|
-
/**
|
120
|
-
* 这个方法是对 _class 方法的封装,调用时会将操作类型设为 'toggle',然后执行切换类名的操作。
|
121
|
-
* 如果提供了 display 参数,它将根据布尔值决定是否显示或隐藏类名。
|
122
|
-
* 最后,它返回当前的 EventTarget,通常是 DOM 元素本身,以支持链式调用。
|
123
|
-
* @deprecated Will be removed in the v0.5
|
124
|
-
*/
|
125
|
-
toggleClass (className: string, display?: boolean): EventTarget {
|
126
|
-
this._class('toggle', className, display)
|
127
|
-
return this
|
128
|
-
},
|
129
|
-
/**
|
130
|
-
* 这个方法返回一个布尔值,表示元素是否包含指定的类名。
|
131
|
-
* @deprecated Will be removed in the v0.5
|
132
|
-
*/
|
133
|
-
hasClass (className: string): boolean {
|
134
|
-
return this.classList.contains(className)
|
135
|
-
}
|
136
|
-
})
|
137
|
-
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import { $storage } from './storage'
|
2
1
|
import { transition } from './anime'
|
3
2
|
import { BODY } from '../globals/globalVars'
|
4
3
|
import { changeTheme } from '../globals/themeColor'
|
@@ -23,19 +22,19 @@ export function initVue () {
|
|
23
22
|
})
|
24
23
|
}
|
25
24
|
|
26
|
-
if (btn.
|
25
|
+
if (btn.classList.contains('i-sun')) {
|
27
26
|
c = () => {
|
28
|
-
neko.
|
27
|
+
neko.classList.add('dark')
|
29
28
|
changeTheme('dark')
|
30
|
-
|
29
|
+
localStorage.setItem('theme', 'dark')
|
31
30
|
hideNeko()
|
32
31
|
}
|
33
32
|
} else {
|
34
|
-
neko.
|
33
|
+
neko.classList.add('dark')
|
35
34
|
c = () => {
|
36
|
-
neko.
|
35
|
+
neko.classList.remove('dark')
|
37
36
|
changeTheme()
|
38
|
-
|
37
|
+
localStorage.setItem('theme', 'light')
|
39
38
|
hideNeko()
|
40
39
|
}
|
41
40
|
}
|
@@ -1,14 +1,12 @@
|
|
1
|
-
import { $dom } from '../library/dom'
|
2
|
-
|
3
1
|
export const cardActive = () => {
|
4
2
|
if (!document.querySelector('.index.wrap')) { return }
|
5
3
|
const io = new IntersectionObserver((entries) => {
|
6
4
|
entries.forEach((article) => {
|
7
|
-
if (article.target.
|
5
|
+
if (article.target.classList.contains('show')) {
|
8
6
|
io.unobserve(article.target)
|
9
7
|
} else {
|
10
8
|
if (article.isIntersecting || article.intersectionRatio > 0) {
|
11
|
-
article.target.
|
9
|
+
article.target.classList.add('show')
|
12
10
|
io.unobserve(article.target)
|
13
11
|
}
|
14
12
|
}
|
@@ -18,25 +16,25 @@ export const cardActive = () => {
|
|
18
16
|
threshold: [0.3]
|
19
17
|
})
|
20
18
|
|
21
|
-
|
19
|
+
document.querySelectorAll('.index.wrap article.item, .index.wrap section.item').forEach((article) => {
|
22
20
|
io.observe(article)
|
23
21
|
})
|
24
22
|
|
25
|
-
document.querySelector('.index.wrap .item:first-child').
|
23
|
+
document.querySelector('.index.wrap .item:first-child').classList.add('show')
|
26
24
|
|
27
|
-
|
25
|
+
document.querySelectorAll('.cards .item').forEach((element) => {
|
28
26
|
['mouseenter', 'touchstart'].forEach((item) => {
|
29
27
|
element.addEventListener(item, () => {
|
30
28
|
const cardEle = document.querySelector('.cards .item.active')
|
31
29
|
if (cardEle) {
|
32
|
-
cardEle.
|
30
|
+
cardEle.classList.remove('active')
|
33
31
|
}
|
34
|
-
element.
|
32
|
+
element.classList.add('active')
|
35
33
|
}, { passive: true })
|
36
34
|
});
|
37
35
|
['mouseleave'].forEach((item) => {
|
38
36
|
element.addEventListener(item, () => {
|
39
|
-
element.
|
37
|
+
element.classList.remove('active')
|
40
38
|
}, { passive: true })
|
41
39
|
})
|
42
40
|
})
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import { $dom } from '../library/dom'
|
2
1
|
import { insertAfter } from '../library/proto'
|
2
|
+
import DOMPurify from 'dompurify';
|
3
3
|
|
4
4
|
// TODO 使用PhotoSwipe替换Fancybox
|
5
5
|
export const postFancybox = (p:string) => {
|
6
6
|
if (document.querySelector(p + ' .md img')) {
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
// vendorCss('fancybox')
|
8
|
+
// vendorCss('justifiedGallery')
|
9
|
+
document.querySelectorAll(p + ' p.gallery').forEach((element) => {
|
10
10
|
const box = document.createElement('div')
|
11
11
|
box.className = 'gallery'
|
12
12
|
box.setAttribute('data-height', String(element.getAttribute('data-height') || 220))
|
@@ -17,9 +17,9 @@ export const postFancybox = (p:string) => {
|
|
17
17
|
element.remove()
|
18
18
|
})
|
19
19
|
|
20
|
-
|
21
|
-
const $image =
|
22
|
-
const imageLink = $image.attr('data-src') || $image.attr('src') // 替换
|
20
|
+
document.querySelectorAll(p + ' .md img:not(.emoji):not(.vemoji)').forEach((element) => {
|
21
|
+
const $image = $(element)
|
22
|
+
const imageLink = DOMPurify.sanitize($image.attr('data-src') || $image.attr('src')) // 替换
|
23
23
|
const $imageWrapLink = $image.wrap('<a class="fancybox" href="' + imageLink + '" itemscope itemtype="https://schema.org/ImageObject" itemprop="url"></a>').parent('a')
|
24
24
|
let info; let captionClass = 'image-info'
|
25
25
|
if (!$image.is('a img')) {
|
@@ -40,20 +40,20 @@ export const postFancybox = (p:string) => {
|
|
40
40
|
}
|
41
41
|
})
|
42
42
|
|
43
|
-
|
43
|
+
document.querySelectorAll(p + ' div.gallery').forEach((el, i) => {
|
44
44
|
// @ts-ignore
|
45
|
-
|
46
|
-
rowHeight:
|
45
|
+
$(el).justifiedGallery({
|
46
|
+
rowHeight: $(el).data('height') || 120,
|
47
47
|
rel: 'gallery-' + i
|
48
48
|
}).on('jg.complete', function () {
|
49
|
-
|
49
|
+
$(this).find('a').each((k, ele) => {
|
50
50
|
ele.setAttribute('data-fancybox', 'gallery-' + i)
|
51
51
|
})
|
52
52
|
})
|
53
53
|
})
|
54
54
|
|
55
|
-
|
56
|
-
|
55
|
+
$.fancybox.defaults.hash = false
|
56
|
+
$(p + ' .fancybox').fancybox({
|
57
57
|
loop: true,
|
58
58
|
// @ts-ignore
|
59
59
|
helpers: {
|
@@ -1,9 +1,7 @@
|
|
1
|
-
import { $dom } from '../library/dom'
|
2
1
|
import { postFancybox } from './fancybox'
|
3
2
|
import { clipBoard, showtip } from '../globals/tools'
|
4
3
|
import { CONFIG, BODY } from '../globals/globalVars'
|
5
4
|
import { pageScroll, transition } from '../library/anime'
|
6
|
-
import { mediaPlayer } from '../player'
|
7
5
|
import { getDisplay, setDisplay, wrapObject } from '../library/proto'
|
8
6
|
|
9
7
|
export const postBeauty = () => {
|
@@ -43,31 +41,31 @@ export const postBeauty = () => {
|
|
43
41
|
}
|
44
42
|
}
|
45
43
|
|
46
|
-
|
47
|
-
let parent = element.parentNode
|
44
|
+
document.querySelectorAll('li ruby').forEach((element) => {
|
45
|
+
let parent = element.parentNode as HTMLElement
|
48
46
|
// @ts-ignore
|
49
47
|
if (element.parentNode.tagName !== 'LI') {
|
50
|
-
parent = element.parentNode.parentNode
|
48
|
+
parent = element.parentNode.parentNode as HTMLElement
|
51
49
|
}
|
52
|
-
parent.
|
50
|
+
parent.classList.add('ruby')
|
53
51
|
})
|
54
52
|
|
55
|
-
|
53
|
+
document.querySelectorAll('ol[start]').forEach((element) => {
|
56
54
|
// @ts-ignore
|
57
55
|
element.style.counterReset = 'counter ' + parseInt(element.getAttribute('start') - 1)
|
58
56
|
})
|
59
57
|
|
60
|
-
|
58
|
+
document.querySelectorAll<HTMLElement>('.md table').forEach((element) => {
|
61
59
|
wrapObject(element, {
|
62
60
|
className: 'table-container'
|
63
61
|
})
|
64
62
|
})
|
65
63
|
|
66
|
-
|
64
|
+
document.querySelectorAll('.highlight > .table-container').forEach((element) => {
|
67
65
|
element.className = 'code-container'
|
68
66
|
})
|
69
67
|
|
70
|
-
|
68
|
+
document.querySelectorAll<HTMLElement>('figure.highlight').forEach((element) => {
|
71
69
|
const code_container = element.querySelector('.code-container') as HTMLElement
|
72
70
|
const caption = element.querySelector('figcaption')
|
73
71
|
|
@@ -80,7 +78,7 @@ export const postBeauty = () => {
|
|
80
78
|
copyBtn.addEventListener('click', (event) => {
|
81
79
|
const target = <HTMLElement>event.currentTarget
|
82
80
|
let comma = ''; let code = ''
|
83
|
-
code_container.
|
81
|
+
code_container.querySelectorAll('pre').forEach((line) => {
|
84
82
|
code += comma + line.innerText
|
85
83
|
comma = '\n'
|
86
84
|
})
|
@@ -101,61 +99,61 @@ export const postBeauty = () => {
|
|
101
99
|
const breakBtn = element.querySelector('.breakline-btn')
|
102
100
|
breakBtn.addEventListener('click', (event) => {
|
103
101
|
const target = event.currentTarget as HTMLElement
|
104
|
-
if (element.
|
105
|
-
element.
|
102
|
+
if (element.classList.contains('breakline')) {
|
103
|
+
element.classList.remove('breakline')
|
106
104
|
target.querySelector('.ic').className = 'ic i-align-left'
|
107
105
|
} else {
|
108
|
-
element.
|
106
|
+
element.classList.add('breakline')
|
109
107
|
target.querySelector('.ic').className = 'ic i-align-justify'
|
110
108
|
}
|
111
109
|
})
|
112
110
|
|
113
111
|
const fullscreenBtn = element.querySelector('.fullscreen-btn')
|
114
112
|
const removeFullscreen = () => {
|
115
|
-
element.
|
113
|
+
element.classList.remove('fullscreen')
|
116
114
|
element.scrollTop = 0
|
117
|
-
BODY.
|
115
|
+
BODY.classList.remove('fullscreen')
|
118
116
|
fullscreenBtn.querySelector('.ic').className = 'ic i-expand'
|
119
117
|
}
|
120
118
|
const fullscreenHandle = () => {
|
121
|
-
if (element.
|
119
|
+
if (element.classList.contains('fullscreen')) {
|
122
120
|
removeFullscreen()
|
123
|
-
if (code_container && code_container.
|
121
|
+
if (code_container && code_container.querySelectorAll('tr').length > 15) {
|
124
122
|
const showBtn = code_container.querySelector('.show-btn')
|
125
123
|
code_container.style.maxHeight = '300px'
|
126
|
-
showBtn.
|
124
|
+
showBtn.classList.remove('open')
|
127
125
|
}
|
128
126
|
pageScroll(element)
|
129
127
|
} else {
|
130
|
-
element.
|
131
|
-
BODY.
|
128
|
+
element.classList.add('fullscreen')
|
129
|
+
BODY.classList.add('fullscreen')
|
132
130
|
fullscreenBtn.querySelector('.ic').className = 'ic i-compress'
|
133
|
-
if (code_container && code_container.
|
131
|
+
if (code_container && code_container.querySelectorAll('tr').length > 15) {
|
134
132
|
const showBtn = code_container.querySelector('.show-btn')
|
135
133
|
code_container.style.maxHeight = ''
|
136
|
-
showBtn.
|
134
|
+
showBtn.classList.add('open')
|
137
135
|
}
|
138
136
|
}
|
139
137
|
}
|
140
138
|
fullscreenBtn.addEventListener('click', fullscreenHandle)
|
141
139
|
caption && caption.addEventListener('click', fullscreenHandle)
|
142
140
|
|
143
|
-
if (code_container && code_container.
|
141
|
+
if (code_container && code_container.querySelectorAll('tr').length > 15) {
|
144
142
|
code_container.style.maxHeight = '300px'
|
145
143
|
code_container.insertAdjacentHTML('beforeend', '<div class="show-btn"><i class="ic i-angle-down"></i></div>')
|
146
144
|
const showBtn = code_container.querySelector('.show-btn')
|
147
145
|
|
148
146
|
const hideCode = () => {
|
149
147
|
code_container.style.maxHeight = '300px'
|
150
|
-
showBtn.
|
148
|
+
showBtn.classList.remove('open')
|
151
149
|
}
|
152
150
|
const showCode = () => {
|
153
151
|
code_container.style.maxHeight = ''
|
154
|
-
showBtn.
|
152
|
+
showBtn.classList.add('open')
|
155
153
|
}
|
156
154
|
|
157
155
|
showBtn.addEventListener('click', () => {
|
158
|
-
if (showBtn.
|
156
|
+
if (showBtn.classList.contains('open')) {
|
159
157
|
removeFullscreen()
|
160
158
|
hideCode()
|
161
159
|
pageScroll(code_container)
|
@@ -166,12 +164,12 @@ export const postBeauty = () => {
|
|
166
164
|
}
|
167
165
|
})
|
168
166
|
|
169
|
-
|
167
|
+
document.querySelectorAll('pre.mermaid > svg').forEach((element) => {
|
170
168
|
const temp = <SVGAElement><unknown>element
|
171
169
|
temp.style.maxWidth = ''
|
172
170
|
})
|
173
171
|
|
174
|
-
|
172
|
+
document.querySelectorAll('.reward button').forEach((element) => {
|
175
173
|
element.addEventListener('click', (event) => {
|
176
174
|
event.preventDefault()
|
177
175
|
const qr = document.getElementById('qr')
|
@@ -187,47 +185,47 @@ export const postBeauty = () => {
|
|
187
185
|
|
188
186
|
// quiz
|
189
187
|
if (__shokax_quiz__) {
|
190
|
-
|
188
|
+
document.querySelectorAll('.quiz > ul.options li').forEach((element) => {
|
191
189
|
element.addEventListener('click', () => {
|
192
|
-
if (element.
|
193
|
-
element.
|
194
|
-
element.parentNode.parentNode.
|
190
|
+
if (element.classList.contains('correct')) {
|
191
|
+
element.classList.toggle('right');
|
192
|
+
(element.parentNode.parentNode as HTMLElement).classList.add('show')
|
195
193
|
} else {
|
196
|
-
element.
|
194
|
+
element.classList.toggle('wrong')
|
197
195
|
}
|
198
196
|
})
|
199
197
|
})
|
200
198
|
|
201
|
-
|
199
|
+
document.querySelectorAll('.quiz > p').forEach((element) => {
|
202
200
|
element.addEventListener('click', () => {
|
203
|
-
element.parentNode.
|
201
|
+
(element.parentNode as HTMLElement).classList.toggle('show')
|
204
202
|
})
|
205
203
|
})
|
206
204
|
|
207
|
-
|
208
|
-
const quiz = element.parentNode
|
205
|
+
document.querySelectorAll('.quiz > p:first-child').forEach((element) => {
|
206
|
+
const quiz = element.parentNode as HTMLElement
|
209
207
|
let type = 'choice'
|
210
|
-
if (quiz.
|
208
|
+
if (quiz.classList.contains('true') || quiz.classList.contains('false')) {
|
211
209
|
type = 'true_false'
|
212
210
|
}
|
213
|
-
if (quiz.
|
211
|
+
if (quiz.classList.contains('multi')) {
|
214
212
|
type = 'multiple'
|
215
213
|
}
|
216
|
-
if (quiz.
|
214
|
+
if (quiz.classList.contains('fill')) {
|
217
215
|
type = 'gap_fill'
|
218
216
|
}
|
219
|
-
if (quiz.
|
217
|
+
if (quiz.classList.contains('essay')) {
|
220
218
|
type = 'essay'
|
221
219
|
}
|
222
220
|
element.setAttribute('data-type', LOCAL.quiz[type])
|
223
221
|
})
|
224
222
|
|
225
|
-
|
223
|
+
document.querySelectorAll('.quiz .mistake').forEach((element) => {
|
226
224
|
element.setAttribute('data-type', LOCAL.quiz.mistake)
|
227
225
|
})
|
228
226
|
}
|
229
227
|
|
230
|
-
|
228
|
+
document.querySelectorAll('div.tags a').forEach((element) => {
|
231
229
|
element.className = ['primary', 'success', 'info', 'warning', 'danger'][Math.floor(Math.random() * 5)]
|
232
230
|
})
|
233
231
|
|
@@ -101,7 +101,6 @@ export function algoliaSearch () {
|
|
101
101
|
}
|
102
102
|
})
|
103
103
|
document.querySelector('.close-btn').addEventListener('click', onPopupClose)
|
104
|
-
// window.addEventListener('pjax:success', onPopupClose)
|
105
104
|
window.addEventListener('keyup', (event) => {
|
106
105
|
if (event.key === 'Escape') {
|
107
106
|
onPopupClose()
|
@@ -1,11 +1,10 @@
|
|
1
1
|
import { pageScroll } from '../library/anime'
|
2
|
-
import { $dom } from '../library/dom'
|
3
2
|
import { createChild } from '../library/proto'
|
4
3
|
|
5
4
|
export const tabFormat = () => {
|
6
5
|
// tab
|
7
6
|
let first_tab:boolean
|
8
|
-
|
7
|
+
document.querySelectorAll('div.tab').forEach((element) => {
|
9
8
|
if (element.getAttribute('data-ready')) { return }
|
10
9
|
|
11
10
|
const id = element.getAttribute('data-id')
|
@@ -41,17 +40,17 @@ export const tabFormat = () => {
|
|
41
40
|
})
|
42
41
|
|
43
42
|
if (first_tab) {
|
44
|
-
li.
|
45
|
-
element.
|
43
|
+
li.classList.add('active')
|
44
|
+
element.classList.add('active')
|
46
45
|
}
|
47
46
|
|
48
47
|
li.addEventListener('click', (event) => {
|
49
|
-
const target = event.currentTarget
|
50
|
-
box.
|
51
|
-
el.
|
48
|
+
const target = event.currentTarget as HTMLElement
|
49
|
+
box.querySelectorAll('.active').forEach((el) => {
|
50
|
+
el.classList.remove('active')
|
52
51
|
})
|
53
|
-
element.
|
54
|
-
target.
|
52
|
+
element.classList.add('active')
|
53
|
+
target.classList.add('active')
|
55
54
|
})
|
56
55
|
|
57
56
|
box.appendChild(element)
|
@@ -9,16 +9,13 @@ import {
|
|
9
9
|
showContents,
|
10
10
|
siteHeader,
|
11
11
|
siteNav,
|
12
|
-
toolBtn
|
13
|
-
toolPlayer
|
12
|
+
toolBtn
|
14
13
|
} from '../globals/globalVars'
|
15
14
|
import { Loader } from '../globals/thirdparty'
|
16
|
-
import { $dom } from '../library/dom'
|
17
|
-
import { mediaPlayer } from '../player'
|
18
15
|
import { createChild } from '../library/proto'
|
19
16
|
|
20
17
|
export default function domInit () {
|
21
|
-
|
18
|
+
document.querySelectorAll('.overview .menu > .item').forEach((el) => {
|
22
19
|
siteNav.querySelector('.menu').appendChild(el.cloneNode(true))
|
23
20
|
})
|
24
21
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { cardActive } from '../page/common'
|
2
2
|
import { resizeHandle } from '../globals/handles'
|
3
3
|
import {
|
4
|
+
CONFIG,
|
4
5
|
setLocalHash, setLocalUrl, setOriginTitle,
|
5
6
|
} from '../globals/globalVars'
|
6
7
|
import { positionInit } from '../globals/tools'
|
@@ -10,6 +11,14 @@ import { tabFormat } from '../page/tab'
|
|
10
11
|
import { lazyLoad } from 'unlazy'
|
11
12
|
|
12
13
|
export const siteRefresh = async (reload) => {
|
14
|
+
if (__shokax_antiFakeWebsite__) {
|
15
|
+
if (window.location.origin !== CONFIG.hostname && window.location.origin !== "http://localhost:4000") {
|
16
|
+
window.location.href = CONFIG.hostname
|
17
|
+
/*! 我知道你正在试图去除这段代码,虽然我无法阻止你,但我劝你好自为之 */
|
18
|
+
alert('检测到非法仿冒网站,已自动跳转回正确首页;\nWe have detected a fake website, and you have been redirected to the correct homepage.')
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
13
22
|
setLocalHash(0)
|
14
23
|
setLocalUrl(window.location.href)
|
15
24
|
|
@@ -1,14 +1,13 @@
|
|
1
1
|
import domInit from './domInit'
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import { transition } from '../library/anime'
|
2
|
+
import {siteRefresh} from './refresh'
|
3
|
+
import {cloudflareInit} from '../components/cloudflare'
|
4
|
+
import {BODY, CONFIG, setSiteSearch, siteSearch} from '../globals/globalVars'
|
5
|
+
import {autoDarkmode, themeColorListener} from '../globals/themeColor'
|
6
|
+
import {resizeHandle, scrollHandle, visibilityListener} from '../globals/handles'
|
7
|
+
import {pagePosition} from '../globals/tools'
|
8
|
+
import {initVue} from '../library/vue'
|
9
|
+
import {createChild} from '../library/proto'
|
10
|
+
import {transition} from '../library/anime'
|
12
11
|
|
13
12
|
const siteInit = async () => {
|
14
13
|
initVue()
|
@@ -39,15 +38,12 @@ const siteInit = async () => {
|
|
39
38
|
})
|
40
39
|
|
41
40
|
// Handle and trigger popup window
|
42
|
-
|
43
|
-
$dom.each('.search', (element) => {
|
44
|
-
element.addEventListener('click', () => {
|
41
|
+
document.querySelector('.search').addEventListener('click', () => {
|
45
42
|
document.body.style.overflow = 'hidden'
|
46
43
|
transition(siteSearch, 'shrinkIn', () => {
|
47
44
|
(document.querySelector('.search-input') as HTMLInputElement).focus()
|
48
45
|
}) // transition.shrinkIn
|
49
46
|
})
|
50
|
-
})
|
51
47
|
}, {once: true, capture: true})
|
52
48
|
}
|
53
49
|
|
@@ -74,6 +70,14 @@ const siteInit = async () => {
|
|
74
70
|
|
75
71
|
cloudflareInit()
|
76
72
|
|
73
|
+
if (__shokax_antiFakeWebsite__) {
|
74
|
+
if (window.location.origin !== CONFIG.hostname && window.location.origin !== "http://localhost:4000") {
|
75
|
+
window.location.href = CONFIG.hostname
|
76
|
+
/*! 我知道你正在试图去除这段代码,虽然我无法阻止你,但我劝你好自为之 */
|
77
|
+
alert('检测到非法仿冒网站,已自动跳转回正确首页;\nWe have detected a fake website, and you have been redirected to the correct homepage.')
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
77
81
|
window.addEventListener('DOMContentLoaded', siteInit, {
|
78
82
|
passive: true
|
79
83
|
})
|