hexo-theme-shokax 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.cjs +5 -3
- package/README.md +11 -2
- package/_config.yml +12 -12
- package/layout/_mixin/comment.pug +1 -2
- package/layout/_mixin/widgets.pug +1 -1
- package/layout/_partials/layout.pug +23 -23
- package/package.json +27 -19
- package/scripts/generaters/script.js +17 -50
- package/scripts/helpers/asset.js +5 -2
- package/scripts/helpers/summary_ai.js +0 -1
- package/scripts/plugin/index.js +2 -2
- package/source/css/_common/scaffolding/normalize.styl +165 -180
- package/source/js/_app/components/sidebar.js +49 -35
- package/source/js/_app/fireworks.js +32 -19
- package/source/js/_app/globals/globalVars.js +91 -26
- package/source/js/_app/globals/handles.js +54 -42
- package/source/js/_app/globals/themeColor.js +22 -12
- package/source/js/_app/globals/thirdparty.js +17 -7
- package/source/js/_app/globals/tools.js +25 -14
- package/source/js/_app/library/anime.js +13 -3
- package/source/js/_app/library/dom.js +5 -0
- package/source/js/_app/library/loadFile.js +7 -1
- package/source/js/_app/library/proto.js +108 -102
- package/source/js/_app/library/scriptPjax.js +18 -10
- package/source/js/_app/library/storage.js +4 -1
- package/source/js/_app/library/vue.js +16 -9
- package/source/js/_app/page/comment.js +14 -7
- package/source/js/_app/page/common.js +13 -7
- package/source/js/_app/page/fancybox.js +12 -6
- package/source/js/_app/page/post.js +43 -29
- package/source/js/_app/page/search.js +21 -14
- package/source/js/_app/page/tab.js +9 -3
- package/source/js/_app/pjax/domInit.js +36 -23
- package/source/js/_app/pjax/refresh.js +48 -30
- package/source/js/_app/pjax/siteInit.js +30 -13
- package/source/js/_app/player.js +29 -16
- package/test/dom.test.js +86 -0
@@ -1,108 +1,116 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
/*! modern-normalize v2.0.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
2
|
+
|
3
|
+
/*
|
4
|
+
Document
|
5
|
+
========
|
6
|
+
*/
|
7
|
+
|
4
8
|
/**
|
5
|
-
|
6
|
-
|
7
|
-
|
9
|
+
Use a better box model (opinionated).
|
10
|
+
*/
|
11
|
+
|
12
|
+
*,
|
13
|
+
::before,
|
14
|
+
::after {
|
15
|
+
box-sizing: border-box;
|
16
|
+
}
|
17
|
+
|
8
18
|
html {
|
9
|
-
|
10
|
-
-
|
19
|
+
/* Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3) */
|
20
|
+
font-family:
|
21
|
+
system-ui,
|
22
|
+
'Segoe UI',
|
23
|
+
Roboto,
|
24
|
+
Helvetica,
|
25
|
+
Arial,
|
26
|
+
sans-serif,
|
27
|
+
'Apple Color Emoji',
|
28
|
+
'Segoe UI Emoji';
|
29
|
+
line-height: 1.15; /* 1. Correct the line height in all browsers. */
|
30
|
+
-webkit-text-size-adjust: 100%; /* 2. Prevent adjustments of font size after orientation changes in iOS. */
|
31
|
+
-moz-tab-size: 4; /* 3. Use a more readable tab size (opinionated). */
|
32
|
+
tab-size: 4; /* 3 */
|
11
33
|
}
|
12
34
|
|
13
|
-
/*
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
35
|
+
/*
|
36
|
+
Sections
|
37
|
+
========
|
38
|
+
*/
|
39
|
+
|
18
40
|
body {
|
19
|
-
margin: 0;
|
41
|
+
margin: 0; /* Remove the margin in all browsers. */
|
20
42
|
}
|
21
43
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
display: block;
|
27
|
-
}
|
44
|
+
/*
|
45
|
+
Grouping content
|
46
|
+
================
|
47
|
+
*/
|
28
48
|
|
29
49
|
/**
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
h1 {
|
34
|
-
font-size: 2em;
|
35
|
-
margin: .67em 0;
|
36
|
-
}
|
50
|
+
1. Add the correct height in Firefox.
|
51
|
+
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
|
52
|
+
*/
|
37
53
|
|
38
|
-
/* Grouping content
|
39
|
-
========================================================================== */
|
40
|
-
/**
|
41
|
-
* 1. Add the correct box sizing in Firefox.
|
42
|
-
* 2. Show the overflow in Edge and IE.
|
43
|
-
*/
|
44
54
|
hr {
|
45
|
-
box-sizing: content-box; /* 1 */
|
46
55
|
height: 0; /* 1 */
|
47
|
-
|
56
|
+
color: inherit; /* 2 */
|
48
57
|
}
|
49
58
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
pre {
|
55
|
-
font-family: monospace, monospace; /* 1 */
|
56
|
-
font-size: 1em; /* 2 */
|
57
|
-
}
|
59
|
+
/*
|
60
|
+
Text-level semantics
|
61
|
+
====================
|
62
|
+
*/
|
58
63
|
|
59
|
-
/* Text-level semantics
|
60
|
-
========================================================================== */
|
61
64
|
/**
|
62
|
-
|
63
|
-
|
64
|
-
a {
|
65
|
-
background: transparent;
|
66
|
-
}
|
65
|
+
Add the correct text decoration in Chrome, Edge, and Safari.
|
66
|
+
*/
|
67
67
|
|
68
|
-
/**
|
69
|
-
* 1. Remove the bottom border in Chrome 57-
|
70
|
-
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
71
|
-
*/
|
72
68
|
abbr[title] {
|
73
|
-
|
74
|
-
text-decoration: underline; /* 2 */
|
75
|
-
//text-decoration: underline dotted; /* 2 */
|
69
|
+
text-decoration: underline dotted;
|
76
70
|
}
|
77
71
|
|
78
72
|
/**
|
79
|
-
|
80
|
-
|
81
|
-
|
73
|
+
Add the correct font weight in Edge and Safari.
|
74
|
+
*/
|
75
|
+
|
76
|
+
b,
|
77
|
+
strong {
|
82
78
|
font-weight: bolder;
|
83
79
|
}
|
84
80
|
|
85
81
|
/**
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
82
|
+
1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
|
83
|
+
2. Correct the odd 'em' font sizing in all browsers.
|
84
|
+
*/
|
85
|
+
|
86
|
+
code,
|
87
|
+
kbd,
|
88
|
+
samp,
|
89
|
+
pre {
|
90
|
+
font-family:
|
91
|
+
ui-monospace,
|
92
|
+
SFMono-Regular,
|
93
|
+
Consolas,
|
94
|
+
'Liberation Mono',
|
95
|
+
Menlo,
|
96
|
+
monospace; /* 1 */
|
91
97
|
font-size: 1em; /* 2 */
|
92
98
|
}
|
93
99
|
|
94
100
|
/**
|
95
|
-
|
96
|
-
|
101
|
+
Add the correct font size in all browsers.
|
102
|
+
*/
|
103
|
+
|
97
104
|
small {
|
98
105
|
font-size: 80%;
|
99
106
|
}
|
100
107
|
|
101
108
|
/**
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
sub,
|
109
|
+
Prevent 'sub' and 'sup' elements from affecting the line height in all browsers.
|
110
|
+
*/
|
111
|
+
|
112
|
+
sub,
|
113
|
+
sup {
|
106
114
|
font-size: 75%;
|
107
115
|
line-height: 0;
|
108
116
|
position: relative;
|
@@ -110,29 +118,43 @@ sub, sup {
|
|
110
118
|
}
|
111
119
|
|
112
120
|
sub {
|
113
|
-
bottom:
|
121
|
+
bottom: -0.25em;
|
114
122
|
}
|
115
123
|
|
116
124
|
sup {
|
117
|
-
top:
|
125
|
+
top: -0.5em;
|
118
126
|
}
|
119
127
|
|
120
|
-
/*
|
121
|
-
|
128
|
+
/*
|
129
|
+
Tabular data
|
130
|
+
============
|
131
|
+
*/
|
132
|
+
|
122
133
|
/**
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
134
|
+
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
|
135
|
+
2. Correct table border color inheritance in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
136
|
+
*/
|
137
|
+
|
138
|
+
table {
|
139
|
+
text-indent: 0; /* 1 */
|
140
|
+
border-color: inherit; /* 2 */
|
127
141
|
}
|
128
142
|
|
129
|
-
/*
|
130
|
-
|
143
|
+
/*
|
144
|
+
Forms
|
145
|
+
=====
|
146
|
+
*/
|
147
|
+
|
131
148
|
/**
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
149
|
+
1. Change the font styles in all browsers.
|
150
|
+
2. Remove the margin in Firefox and Safari.
|
151
|
+
*/
|
152
|
+
|
153
|
+
button,
|
154
|
+
input,
|
155
|
+
optgroup,
|
156
|
+
select,
|
157
|
+
textarea {
|
136
158
|
font-family: inherit; /* 1 */
|
137
159
|
font-size: 100%; /* 1 */
|
138
160
|
line-height: 1.15; /* 1 */
|
@@ -140,150 +162,113 @@ button, input, optgroup, select, textarea {
|
|
140
162
|
}
|
141
163
|
|
142
164
|
/**
|
143
|
-
|
144
|
-
|
145
|
-
*/
|
146
|
-
button, input {
|
147
|
-
/* 1 */
|
148
|
-
overflow: visible;
|
149
|
-
}
|
165
|
+
Remove the inheritance of text transform in Edge and Firefox.
|
166
|
+
*/
|
150
167
|
|
151
|
-
|
152
|
-
|
153
|
-
* 1. Remove the inheritance of text transform in Firefox.
|
154
|
-
*/
|
155
|
-
button, select {
|
156
|
-
/* 1 */
|
168
|
+
button,
|
169
|
+
select {
|
157
170
|
text-transform: none;
|
158
171
|
}
|
159
172
|
|
160
173
|
/**
|
161
|
-
|
162
|
-
|
163
|
-
|
174
|
+
Correct the inability to style clickable types in iOS and Safari.
|
175
|
+
*/
|
176
|
+
|
177
|
+
button,
|
178
|
+
[type='button'],
|
179
|
+
[type='reset'],
|
180
|
+
[type='submit'] {
|
164
181
|
-webkit-appearance: button;
|
165
182
|
}
|
166
183
|
|
167
184
|
/**
|
168
|
-
|
169
|
-
|
170
|
-
|
185
|
+
Remove the inner border and padding in Firefox.
|
186
|
+
*/
|
187
|
+
|
188
|
+
::-moz-focus-inner {
|
171
189
|
border-style: none;
|
172
190
|
padding: 0;
|
173
191
|
}
|
174
192
|
|
175
193
|
/**
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
194
|
+
Restore the focus styles unset by the previous rule.
|
195
|
+
*/
|
196
|
+
|
197
|
+
:-moz-focusring {
|
198
|
+
outline: 1px dotted ButtonText;
|
180
199
|
}
|
181
200
|
|
182
201
|
/**
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
202
|
+
Remove the additional ':invalid' styles in Firefox.
|
203
|
+
See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737
|
204
|
+
*/
|
205
|
+
|
206
|
+
:-moz-ui-invalid {
|
207
|
+
box-shadow: none;
|
187
208
|
}
|
188
209
|
|
189
210
|
/**
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
* `fieldset` elements in all browsers.
|
194
|
-
*/
|
211
|
+
Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers.
|
212
|
+
*/
|
213
|
+
|
195
214
|
legend {
|
196
|
-
|
197
|
-
color: inherit; /* 2 */
|
198
|
-
display: table; /* 1 */
|
199
|
-
max-width: 100%; /* 1 */
|
200
|
-
padding: 0; /* 3 */
|
201
|
-
white-space: normal; /* 1 */
|
215
|
+
padding: 0;
|
202
216
|
}
|
203
217
|
|
204
218
|
/**
|
205
|
-
|
206
|
-
|
219
|
+
Add the correct vertical alignment in Chrome and Firefox.
|
220
|
+
*/
|
221
|
+
|
207
222
|
progress {
|
208
223
|
vertical-align: baseline;
|
209
224
|
}
|
210
225
|
|
211
226
|
/**
|
212
|
-
|
213
|
-
|
214
|
-
textarea {
|
215
|
-
overflow: auto;
|
216
|
-
}
|
227
|
+
Correct the cursor style of increment and decrement buttons in Safari.
|
228
|
+
*/
|
217
229
|
|
218
|
-
|
219
|
-
|
220
|
-
* 2. Remove the padding in IE 1.
|
221
|
-
*/
|
222
|
-
[type='checkbox'], [type='radio'] {
|
223
|
-
box-sizing: border-box; /* 1 */
|
224
|
-
padding: 0; /* 2 */
|
225
|
-
}
|
226
|
-
|
227
|
-
/**
|
228
|
-
* Correct the cursor style of increment and decrement buttons in Chrome.
|
229
|
-
*/
|
230
|
-
[type='number']::-webkit-inner-spin-button, [type='number']::-webkit-outer-spin-button {
|
230
|
+
::-webkit-inner-spin-button,
|
231
|
+
::-webkit-outer-spin-button {
|
231
232
|
height: auto;
|
232
233
|
}
|
233
234
|
|
234
235
|
/**
|
235
|
-
|
236
|
-
|
237
|
-
|
236
|
+
1. Correct the odd appearance in Chrome and Safari.
|
237
|
+
2. Correct the outline style in Safari.
|
238
|
+
*/
|
239
|
+
|
238
240
|
[type='search'] {
|
239
|
-
outline-offset: -.125rem; /* 2 */
|
240
241
|
-webkit-appearance: textfield; /* 1 */
|
242
|
+
outline-offset: -2px; /* 2 */
|
241
243
|
}
|
242
244
|
|
243
245
|
/**
|
244
|
-
|
245
|
-
|
246
|
-
|
246
|
+
Remove the inner padding in Chrome and Safari on macOS.
|
247
|
+
*/
|
248
|
+
|
249
|
+
::-webkit-search-decoration {
|
247
250
|
-webkit-appearance: none;
|
248
251
|
}
|
249
252
|
|
250
253
|
/**
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
+
1. Correct the inability to style clickable types in iOS and Safari.
|
255
|
+
2. Change font properties to 'inherit' in Safari.
|
256
|
+
*/
|
257
|
+
|
254
258
|
::-webkit-file-upload-button {
|
255
|
-
font: inherit; /* 2 */
|
256
259
|
-webkit-appearance: button; /* 1 */
|
260
|
+
font: inherit; /* 2 */
|
257
261
|
}
|
258
262
|
|
259
|
-
/* Interactive
|
260
|
-
========================================================================== */
|
261
263
|
/*
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
display: block;
|
266
|
-
}
|
264
|
+
Interactive
|
265
|
+
===========
|
266
|
+
*/
|
267
267
|
|
268
268
|
/*
|
269
|
-
|
270
|
-
|
269
|
+
Add the correct display in Chrome and Safari.
|
270
|
+
*/
|
271
|
+
|
271
272
|
summary {
|
272
273
|
display: list-item;
|
273
|
-
}
|
274
|
-
|
275
|
-
/* Misc
|
276
|
-
========================================================================== */
|
277
|
-
/**
|
278
|
-
* Add the correct display in IE 10+.
|
279
|
-
*/
|
280
|
-
template {
|
281
|
-
display: none;
|
282
|
-
}
|
283
|
-
|
284
|
-
/**
|
285
|
-
* Add the correct display in IE 1.
|
286
|
-
*/
|
287
|
-
[hidden] {
|
288
|
-
display: none;
|
289
|
-
}
|
274
|
+
}
|
@@ -1,44 +1,52 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.menuActive = exports.goToCommentHandle = exports.goToBottomHandle = exports.backToTopHandle = exports.sidebarTOC = exports.sideBarTab = exports.sideBarToggleHandle = void 0;
|
4
|
+
const globalVars_1 = require("../globals/globalVars");
|
5
|
+
const tools_1 = require("../globals/tools");
|
6
|
+
const anime_1 = require("../library/anime");
|
7
|
+
const dom_1 = require("../library/dom");
|
1
8
|
const sideBarToggleHandle = (event, force) => {
|
2
|
-
if (sideBar.hasClass('on')) {
|
3
|
-
sideBar.removeClass('on');
|
4
|
-
menuToggle.removeClass('close');
|
9
|
+
if (globalVars_1.sideBar.hasClass('on')) {
|
10
|
+
globalVars_1.sideBar.removeClass('on');
|
11
|
+
globalVars_1.menuToggle.removeClass('close');
|
5
12
|
if (force) {
|
6
|
-
sideBar.style = '';
|
13
|
+
globalVars_1.sideBar.style = '';
|
7
14
|
}
|
8
15
|
else {
|
9
|
-
transition(sideBar, 'slideRightOut');
|
16
|
+
(0, anime_1.transition)(globalVars_1.sideBar, 'slideRightOut');
|
10
17
|
}
|
11
18
|
}
|
12
19
|
else {
|
13
20
|
if (force) {
|
14
|
-
sideBar.style = '';
|
21
|
+
globalVars_1.sideBar.style = '';
|
15
22
|
}
|
16
23
|
else {
|
17
|
-
transition(sideBar, 'slideRightIn', () => {
|
18
|
-
sideBar.addClass('on');
|
19
|
-
menuToggle.addClass('close');
|
24
|
+
(0, anime_1.transition)(globalVars_1.sideBar, 'slideRightIn', () => {
|
25
|
+
globalVars_1.sideBar.addClass('on');
|
26
|
+
globalVars_1.menuToggle.addClass('close');
|
20
27
|
});
|
21
28
|
}
|
22
29
|
}
|
23
30
|
};
|
31
|
+
exports.sideBarToggleHandle = sideBarToggleHandle;
|
24
32
|
const sideBarTab = () => {
|
25
|
-
const sideBarInner = sideBar.child('.inner');
|
26
|
-
if (sideBar.child('.tab')) {
|
27
|
-
sideBarInner.removeChild(sideBar.child('.tab'));
|
33
|
+
const sideBarInner = globalVars_1.sideBar.child('.inner');
|
34
|
+
if (globalVars_1.sideBar.child('.tab')) {
|
35
|
+
sideBarInner.removeChild(globalVars_1.sideBar.child('.tab'));
|
28
36
|
}
|
29
37
|
const list = document.createElement('ul');
|
30
38
|
let active = 'active';
|
31
39
|
list.className = 'tab';
|
32
40
|
['contents', 'related', 'overview'].forEach((item) => {
|
33
|
-
const element = sideBar.child('.panel.' + item);
|
41
|
+
const element = globalVars_1.sideBar.child('.panel.' + item);
|
34
42
|
if (element.innerHTML.trim().length < 1) {
|
35
43
|
if (item === 'contents') {
|
36
|
-
showContents.display('none');
|
44
|
+
globalVars_1.showContents.display('none');
|
37
45
|
}
|
38
46
|
return;
|
39
47
|
}
|
40
48
|
if (item === 'contents') {
|
41
|
-
showContents.display('');
|
49
|
+
globalVars_1.showContents.display('');
|
42
50
|
}
|
43
51
|
const tab = document.createElement('li');
|
44
52
|
const span = document.createElement('span');
|
@@ -57,13 +65,13 @@ const sideBarTab = () => {
|
|
57
65
|
const target = event.currentTarget;
|
58
66
|
if (target.hasClass('active'))
|
59
67
|
return;
|
60
|
-
sideBar.find('.tab .item').forEach((element) => {
|
68
|
+
globalVars_1.sideBar.find('.tab .item').forEach((element) => {
|
61
69
|
element.removeClass('active');
|
62
70
|
});
|
63
|
-
sideBar.find('.panel').forEach((element) => {
|
71
|
+
globalVars_1.sideBar.find('.panel').forEach((element) => {
|
64
72
|
element.removeClass('active');
|
65
73
|
});
|
66
|
-
sideBar.child('.panel.' + target.className.replace(' item', '')).addClass('active');
|
74
|
+
globalVars_1.sideBar.child('.panel.' + target.className.replace(' item', '')).addClass('active');
|
67
75
|
target.addClass('active');
|
68
76
|
});
|
69
77
|
list.appendChild(tab);
|
@@ -71,12 +79,13 @@ const sideBarTab = () => {
|
|
71
79
|
});
|
72
80
|
if (list.childNodes.length > 1) {
|
73
81
|
sideBarInner.insertBefore(list, sideBarInner.childNodes[0]);
|
74
|
-
sideBar.child('.panels').style.paddingTop = '';
|
82
|
+
globalVars_1.sideBar.child('.panels').style.paddingTop = '';
|
75
83
|
}
|
76
84
|
else {
|
77
|
-
sideBar.child('.panels').style.paddingTop = '.625rem';
|
85
|
+
globalVars_1.sideBar.child('.panels').style.paddingTop = '.625rem';
|
78
86
|
}
|
79
87
|
};
|
88
|
+
exports.sideBarTab = sideBarTab;
|
80
89
|
const sidebarTOC = () => {
|
81
90
|
const activateNavByIndex = (index) => {
|
82
91
|
const target = navItems[index];
|
@@ -85,7 +94,7 @@ const sidebarTOC = () => {
|
|
85
94
|
if (target.hasClass('current')) {
|
86
95
|
return;
|
87
96
|
}
|
88
|
-
|
97
|
+
dom_1.$dom.each('.toc .active', (element) => {
|
89
98
|
element && element.removeClass('active current');
|
90
99
|
});
|
91
100
|
sections.forEach((element) => {
|
@@ -97,18 +106,18 @@ const sidebarTOC = () => {
|
|
97
106
|
while (!parent.matches('.contents')) {
|
98
107
|
if (parent.matches('li')) {
|
99
108
|
parent.addClass('active');
|
100
|
-
const t =
|
109
|
+
const t = (0, dom_1.$dom)(parent.child('a.toc-link').attr('href'));
|
101
110
|
if (t) {
|
102
111
|
t.addClass('active');
|
103
112
|
}
|
104
113
|
}
|
105
114
|
parent = parent.parentNode;
|
106
115
|
}
|
107
|
-
if (getComputedStyle(sideBar).display !== 'none' && tocElement.hasClass('active')) {
|
108
|
-
pageScroll(tocElement, target.offsetTop - (tocElement.offsetHeight / 4));
|
116
|
+
if (getComputedStyle(globalVars_1.sideBar).display !== 'none' && tocElement.hasClass('active')) {
|
117
|
+
(0, anime_1.pageScroll)(tocElement, target.offsetTop - (tocElement.offsetHeight / 4));
|
109
118
|
}
|
110
119
|
};
|
111
|
-
const navItems =
|
120
|
+
const navItems = dom_1.$dom.all('.contents li');
|
112
121
|
if (navItems.length < 1) {
|
113
122
|
return;
|
114
123
|
}
|
@@ -116,15 +125,15 @@ const sidebarTOC = () => {
|
|
116
125
|
let activeLock = null;
|
117
126
|
sections = sections.map((element, index) => {
|
118
127
|
const link = element.child('a.toc-link');
|
119
|
-
const anchor =
|
128
|
+
const anchor = (0, dom_1.$dom)(decodeURI(link.attr('href')));
|
120
129
|
if (!anchor)
|
121
130
|
return null;
|
122
131
|
const alink = anchor.child('a.anchor');
|
123
132
|
const anchorScroll = (event) => {
|
124
133
|
event.preventDefault();
|
125
|
-
const target =
|
134
|
+
const target = (0, dom_1.$dom)(decodeURI(event.currentTarget.attr('href')));
|
126
135
|
activeLock = index;
|
127
|
-
pageScroll(target, null, () => {
|
136
|
+
(0, anime_1.pageScroll)(target, null, () => {
|
128
137
|
activateNavByIndex(index);
|
129
138
|
activeLock = null;
|
130
139
|
});
|
@@ -132,11 +141,11 @@ const sidebarTOC = () => {
|
|
132
141
|
link.addEventListener('click', anchorScroll);
|
133
142
|
alink && alink.addEventListener('click', (event) => {
|
134
143
|
anchorScroll(event);
|
135
|
-
clipBoard(CONFIG.hostname + '/' + LOCAL.path + event.currentTarget.attr('href'));
|
144
|
+
(0, tools_1.clipBoard)(CONFIG.hostname + '/' + LOCAL.path + event.currentTarget.attr('href'));
|
136
145
|
});
|
137
146
|
return anchor;
|
138
147
|
});
|
139
|
-
const tocElement = sideBar.child('.contents.panel');
|
148
|
+
const tocElement = globalVars_1.sideBar.child('.contents.panel');
|
140
149
|
const findIndex = (entries) => {
|
141
150
|
let index = 0;
|
142
151
|
let entry = entries[index];
|
@@ -156,7 +165,7 @@ const sidebarTOC = () => {
|
|
156
165
|
};
|
157
166
|
const createIntersectionObserver = () => {
|
158
167
|
const observer = new IntersectionObserver((entries) => {
|
159
|
-
const index = findIndex(entries) + (diffY < 0 ? 1 : 0);
|
168
|
+
const index = findIndex(entries) + (globalVars_1.diffY < 0 ? 1 : 0);
|
160
169
|
if (activeLock === null) {
|
161
170
|
activateNavByIndex(index);
|
162
171
|
}
|
@@ -169,17 +178,21 @@ const sidebarTOC = () => {
|
|
169
178
|
};
|
170
179
|
createIntersectionObserver();
|
171
180
|
};
|
181
|
+
exports.sidebarTOC = sidebarTOC;
|
172
182
|
const backToTopHandle = () => {
|
173
|
-
pageScroll(0);
|
183
|
+
(0, anime_1.pageScroll)(0);
|
174
184
|
};
|
185
|
+
exports.backToTopHandle = backToTopHandle;
|
175
186
|
const goToBottomHandle = () => {
|
176
|
-
pageScroll(parseInt(String(Container.changeOrGetHeight())));
|
187
|
+
(0, anime_1.pageScroll)(parseInt(String(globalVars_1.Container.changeOrGetHeight())));
|
177
188
|
};
|
189
|
+
exports.goToBottomHandle = goToBottomHandle;
|
178
190
|
const goToCommentHandle = () => {
|
179
|
-
pageScroll(
|
191
|
+
(0, anime_1.pageScroll)((0, dom_1.$dom)('#comments'));
|
180
192
|
};
|
193
|
+
exports.goToCommentHandle = goToCommentHandle;
|
181
194
|
const menuActive = () => {
|
182
|
-
|
195
|
+
dom_1.$dom.each('.menu .item:not(.title)', (element) => {
|
183
196
|
const target = element.child('a[href]');
|
184
197
|
const parentItem = element.parentNode.parentNode;
|
185
198
|
if (!target)
|
@@ -196,3 +209,4 @@ const menuActive = () => {
|
|
196
209
|
}
|
197
210
|
});
|
198
211
|
};
|
212
|
+
exports.menuActive = menuActive;
|