hexo-theme-shokax 0.3.10 → 0.3.11
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/_config.yml +26 -5
- package/package.json +8 -7
- package/scripts/filters/locals.js +6 -0
- package/scripts/filters/post.js +2 -0
- package/scripts/generaters/archive.js +13 -1
- package/scripts/generaters/config.js +4 -1
- package/scripts/generaters/images.js +2 -0
- package/scripts/generaters/index.js +2 -0
- package/scripts/generaters/pages.js +0 -2
- package/scripts/generaters/script.js +34 -9
- package/scripts/helpers/asset.js +16 -7
- package/scripts/helpers/engine.js +24 -1
- package/scripts/helpers/list_categories.js +4 -0
- package/scripts/helpers/summary_ai.js +4 -0
- package/scripts/helpers/symbols_count_time.js +14 -8
- package/scripts/plugin/check.js +5 -3
- package/scripts/plugin/index.js +36 -9
- package/scripts/plugin/lib/injects.js +15 -0
- package/scripts/tags/media.js +1 -0
- package/source/js/_app/components/sidebar.js +54 -56
- package/source/js/_app/fireworks.js +6 -137
- package/source/js/_app/globals/globalVars.js +80 -96
- package/source/js/_app/globals/handles.js +81 -60
- package/source/js/_app/globals/themeColor.js +30 -26
- package/source/js/_app/globals/thirdparty.js +25 -24
- package/source/js/_app/globals/tools.js +36 -30
- package/source/js/_app/library/anime.js +30 -15
- package/source/js/_app/library/dom.js +12 -5
- package/source/js/_app/library/loadFile.js +7 -9
- package/source/js/_app/library/proto.js +59 -7
- package/source/js/_app/library/scriptPjax.js +14 -9
- package/source/js/_app/library/storage.js +2 -4
- package/source/js/_app/library/vue.js +16 -19
- package/source/js/_app/page/comment.js +10 -11
- package/source/js/_app/page/common.js +8 -12
- package/source/js/_app/page/fancybox.js +13 -14
- package/source/js/_app/page/post.js +43 -45
- package/source/js/_app/page/search.js +20 -20
- package/source/js/_app/page/tab.js +7 -10
- package/source/js/_app/pjax/domInit.js +29 -29
- package/source/js/_app/pjax/refresh.js +45 -50
- package/source/js/_app/pjax/siteInit.js +27 -31
- package/source/js/_app/player.js +44 -27
- package/test/dom.test.js +0 -86
@@ -1,14 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
if ((0, dom_1.$dom)(p + ' .md img')) {
|
8
|
-
(0, loadFile_1.vendorCss)('fancybox');
|
9
|
-
(0, loadFile_1.vendorJs)('fancybox', () => {
|
1
|
+
import { $dom } from '../library/dom';
|
2
|
+
import { vendorCss, vendorJs } from '../library/loadFile';
|
3
|
+
export const postFancybox = (p) => {
|
4
|
+
if ($dom(p + ' .md img')) {
|
5
|
+
vendorCss('fancybox');
|
6
|
+
vendorJs('fancybox', () => {
|
10
7
|
const q = jQuery.noConflict();
|
11
|
-
|
8
|
+
$dom.each(p + ' p.gallery', (element) => {
|
12
9
|
const box = document.createElement('div');
|
13
10
|
box.className = 'gallery';
|
14
11
|
box.attr('data-height', String(element.attr('data-height') || 220));
|
@@ -16,9 +13,9 @@ const postFancybox = (p) => {
|
|
16
13
|
element.parentNode.insertBefore(box, element);
|
17
14
|
element.remove();
|
18
15
|
});
|
19
|
-
|
16
|
+
$dom.each(p + ' .md img:not(.emoji):not(.vemoji)', (element) => {
|
20
17
|
const $image = q(element);
|
21
|
-
const imageLink = $image.attr('data-src') || $image.attr('src');
|
18
|
+
const imageLink = $image.attr('data-src') || $image.attr('src'); // 替换
|
22
19
|
const $imageWrapLink = $image.wrap('<a class="fancybox" href="' + imageLink + '" itemscope itemtype="https://schema.org/ImageObject" itemprop="url"></a>').parent('a');
|
23
20
|
let info;
|
24
21
|
let captionClass = 'image-info';
|
@@ -40,7 +37,8 @@ const postFancybox = (p) => {
|
|
40
37
|
element.insertAfter(para);
|
41
38
|
}
|
42
39
|
});
|
43
|
-
|
40
|
+
$dom.each(p + ' div.gallery', (el, i) => {
|
41
|
+
// @ts-ignore
|
44
42
|
q(el).justifiedGallery({
|
45
43
|
rowHeight: q(el).data('height') || 120,
|
46
44
|
rel: 'gallery-' + i
|
@@ -53,13 +51,14 @@ const postFancybox = (p) => {
|
|
53
51
|
q.fancybox.defaults.hash = false;
|
54
52
|
q(p + ' .fancybox').fancybox({
|
55
53
|
loop: true,
|
54
|
+
// @ts-ignore
|
56
55
|
helpers: {
|
57
56
|
overlay: {
|
58
57
|
locked: false
|
59
58
|
}
|
60
59
|
}
|
61
60
|
});
|
61
|
+
// @ts-ignore
|
62
62
|
}, window.jQuery);
|
63
63
|
}
|
64
64
|
};
|
65
|
-
exports.postFancybox = postFancybox;
|
@@ -1,29 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
};
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
const
|
9
|
-
|
10
|
-
|
11
|
-
const globalVars_1 = require("../globals/globalVars");
|
12
|
-
const anime_1 = require("../library/anime");
|
13
|
-
const player_1 = require("../player");
|
14
|
-
const postBeauty = () => {
|
15
|
-
(0, comment_1.default)();
|
16
|
-
if (!(0, dom_1.$dom)('.md')) {
|
1
|
+
import loadComments from './comment';
|
2
|
+
import { $dom } from '../library/dom';
|
3
|
+
import { postFancybox } from './fancybox';
|
4
|
+
import { clipBoard, showtip } from '../globals/tools';
|
5
|
+
import { BODY } from '../globals/globalVars';
|
6
|
+
import { pageScroll, transition } from '../library/anime';
|
7
|
+
import { mediaPlayer } from '../player';
|
8
|
+
export const postBeauty = () => {
|
9
|
+
loadComments();
|
10
|
+
if (!$dom('.md')) {
|
17
11
|
return;
|
18
12
|
}
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
postFancybox('.post.block');
|
14
|
+
$dom('.post.block').oncopy = async (event) => {
|
15
|
+
showtip(LOCAL.copyright);
|
22
16
|
if (LOCAL.nocopy) {
|
23
17
|
event.preventDefault();
|
24
18
|
return;
|
25
19
|
}
|
26
|
-
const copyright = await
|
20
|
+
const copyright = await $dom.asyncify('#copyright');
|
27
21
|
if (window.getSelection().toString().length > 30 && copyright) {
|
28
22
|
event.preventDefault();
|
29
23
|
const author = '# ' + copyright.child('.author').innerText;
|
@@ -36,31 +30,35 @@ const postBeauty = () => {
|
|
36
30
|
event.clipboardData.setData('text/plain', textData);
|
37
31
|
}
|
38
32
|
else {
|
33
|
+
// @ts-ignore
|
39
34
|
if (window.clipboardData) {
|
35
|
+
// @ts-ignore
|
40
36
|
return window.clipboardData.setData('text', textData);
|
41
37
|
}
|
42
38
|
}
|
43
39
|
}
|
44
40
|
};
|
45
|
-
|
41
|
+
$dom.each('li ruby', (element) => {
|
46
42
|
let parent = element.parentNode;
|
43
|
+
// @ts-ignore
|
47
44
|
if (element.parentNode.tagName !== 'LI') {
|
48
45
|
parent = element.parentNode.parentNode;
|
49
46
|
}
|
50
47
|
parent.addClass('ruby');
|
51
48
|
});
|
52
|
-
|
49
|
+
$dom.each('ol[start]', (element) => {
|
50
|
+
// @ts-ignore
|
53
51
|
element.style.counterReset = 'counter ' + parseInt(element.attr('start') - 1);
|
54
52
|
});
|
55
|
-
|
53
|
+
$dom.each('.md table', (element) => {
|
56
54
|
element.wrapObject({
|
57
55
|
className: 'table-container'
|
58
56
|
});
|
59
57
|
});
|
60
|
-
|
58
|
+
$dom.each('.highlight > .table-container', (element) => {
|
61
59
|
element.className = 'code-container';
|
62
60
|
});
|
63
|
-
|
61
|
+
$dom.each('figure.highlight', (element) => {
|
64
62
|
const code_container = element.child('.code-container');
|
65
63
|
const caption = element.child('figcaption');
|
66
64
|
element.insertAdjacentHTML('beforeend', '<div class="operation"><span class="breakline-btn"><i class="ic i-align-left"></i></span><span class="copy-btn"><i class="ic i-clipboard"></i></span><span class="fullscreen-btn"><i class="ic i-expand"></i></span></div>');
|
@@ -77,10 +75,10 @@ const postBeauty = () => {
|
|
77
75
|
code += comma + line.innerText;
|
78
76
|
comma = '\n';
|
79
77
|
});
|
80
|
-
|
78
|
+
clipBoard(code, (result) => {
|
81
79
|
target.child('.ic').className = result ? 'ic i-check' : 'ic i-times';
|
82
80
|
target.blur();
|
83
|
-
|
81
|
+
showtip(LOCAL.copyright);
|
84
82
|
});
|
85
83
|
}, { passive: true });
|
86
84
|
copyBtn.addEventListener('mouseleave', (event) => {
|
@@ -105,7 +103,7 @@ const postBeauty = () => {
|
|
105
103
|
const removeFullscreen = () => {
|
106
104
|
element.removeClass('fullscreen');
|
107
105
|
element.scrollTop = 0;
|
108
|
-
|
106
|
+
BODY.removeClass('fullscreen');
|
109
107
|
fullscreenBtn.child('.ic').className = 'ic i-expand';
|
110
108
|
};
|
111
109
|
const fullscreenHandle = () => {
|
@@ -116,11 +114,11 @@ const postBeauty = () => {
|
|
116
114
|
code_container.style.maxHeight = '300px';
|
117
115
|
showBtn.removeClass('open');
|
118
116
|
}
|
119
|
-
|
117
|
+
pageScroll(element);
|
120
118
|
}
|
121
119
|
else {
|
122
120
|
element.addClass('fullscreen');
|
123
|
-
|
121
|
+
BODY.addClass('fullscreen');
|
124
122
|
fullscreenBtn.child('.ic').className = 'ic i-compress';
|
125
123
|
if (code_container && code_container.find('tr').length > 15) {
|
126
124
|
const showBtn = code_container.child('.show-btn');
|
@@ -147,7 +145,7 @@ const postBeauty = () => {
|
|
147
145
|
if (showBtn.hasClass('open')) {
|
148
146
|
removeFullscreen();
|
149
147
|
hideCode();
|
150
|
-
|
148
|
+
pageScroll(code_container);
|
151
149
|
}
|
152
150
|
else {
|
153
151
|
showCode();
|
@@ -155,25 +153,26 @@ const postBeauty = () => {
|
|
155
153
|
});
|
156
154
|
}
|
157
155
|
});
|
158
|
-
|
156
|
+
$dom.asyncifyEach('pre.mermaid > svg', (element) => {
|
159
157
|
const temp = element;
|
160
158
|
temp.style.maxWidth = '';
|
161
159
|
});
|
162
|
-
|
160
|
+
$dom.each('.reward button', (element) => {
|
163
161
|
element.addEventListener('click', (event) => {
|
164
162
|
event.preventDefault();
|
165
|
-
const qr =
|
163
|
+
const qr = $dom('#qr');
|
166
164
|
if (qr.display() === 'inline-flex') {
|
167
|
-
|
165
|
+
transition(qr, 0);
|
168
166
|
}
|
169
167
|
else {
|
170
|
-
|
168
|
+
transition(qr, 1, () => {
|
171
169
|
qr.display('inline-flex');
|
172
|
-
});
|
170
|
+
}); // slideUpBigIn
|
173
171
|
}
|
174
172
|
});
|
175
173
|
});
|
176
|
-
|
174
|
+
// quiz
|
175
|
+
$dom.asyncifyEach('.quiz > ul.options li', (element) => {
|
177
176
|
element.addEventListener('click', () => {
|
178
177
|
if (element.hasClass('correct')) {
|
179
178
|
element.toggleClass('right');
|
@@ -184,12 +183,12 @@ const postBeauty = () => {
|
|
184
183
|
}
|
185
184
|
});
|
186
185
|
});
|
187
|
-
|
186
|
+
$dom.asyncifyEach('.quiz > p', (element) => {
|
188
187
|
element.addEventListener('click', () => {
|
189
188
|
element.parentNode.toggleClass('show');
|
190
189
|
});
|
191
190
|
});
|
192
|
-
|
191
|
+
$dom.asyncifyEach('.quiz > p:first-child', (element) => {
|
193
192
|
const quiz = element.parentNode;
|
194
193
|
let type = 'choice';
|
195
194
|
if (quiz.hasClass('true') || quiz.hasClass('false')) {
|
@@ -206,14 +205,14 @@ const postBeauty = () => {
|
|
206
205
|
}
|
207
206
|
element.attr('data-type', LOCAL.quiz[type]);
|
208
207
|
});
|
209
|
-
|
208
|
+
$dom.asyncifyEach('.quiz .mistake', (element) => {
|
210
209
|
element.attr('data-type', LOCAL.quiz.mistake);
|
211
210
|
});
|
212
|
-
|
211
|
+
$dom.each('div.tags a', (element) => {
|
213
212
|
element.className = ['primary', 'success', 'info', 'warning', 'danger'][Math.floor(Math.random() * 5)];
|
214
213
|
});
|
215
|
-
|
216
|
-
|
214
|
+
$dom.asyncifyEach('.md div.player', (element) => {
|
215
|
+
mediaPlayer(element, {
|
217
216
|
type: element.attr('data-type'),
|
218
217
|
mode: 'order',
|
219
218
|
btns: []
|
@@ -243,4 +242,3 @@ const postBeauty = () => {
|
|
243
242
|
});
|
244
243
|
}
|
245
244
|
};
|
246
|
-
exports.postBeauty = postBeauty;
|
@@ -1,15 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const anime_1 = require("../library/anime");
|
6
|
-
const dom_1 = require("../library/dom");
|
7
|
-
function algoliaSearch(pjax) {
|
1
|
+
import { BODY, setSiteSearch, siteSearch } from '../globals/globalVars';
|
2
|
+
import { transition } from '../library/anime';
|
3
|
+
import { $dom } from '../library/dom';
|
4
|
+
export function algoliaSearch(pjax) {
|
8
5
|
if (CONFIG.search === null) {
|
9
6
|
return;
|
10
7
|
}
|
11
|
-
if (!
|
12
|
-
|
8
|
+
if (!siteSearch) {
|
9
|
+
setSiteSearch(BODY.createChild('div', {
|
13
10
|
id: 'search',
|
14
11
|
innerHTML: '<div class="inner"><div class="header"><span class="icon"><i class="ic i-search"></i></span><div class="search-input-container"></div><span class="close-btn"><i class="ic i-times-circle"></i></span></div><div class="results"><div class="inner"><div id="search-stats"></div><div id="search-hits"></div><div id="search-pagination"></div></div></div></div>'
|
15
12
|
}));
|
@@ -18,15 +15,16 @@ function algoliaSearch(pjax) {
|
|
18
15
|
indexName: CONFIG.search.indexName,
|
19
16
|
searchClient: algoliasearch(CONFIG.search.appID, CONFIG.search.apiKey),
|
20
17
|
searchFunction(helper) {
|
21
|
-
const searchInput =
|
18
|
+
const searchInput = $dom('.search-input');
|
22
19
|
if (searchInput.value) {
|
23
20
|
helper.search();
|
24
21
|
}
|
25
22
|
}
|
26
23
|
});
|
27
24
|
search.on('render', () => {
|
28
|
-
pjax.refresh(
|
25
|
+
pjax.refresh($dom('#search-hits'));
|
29
26
|
});
|
27
|
+
// Registering Widgets
|
30
28
|
search.addWidgets([
|
31
29
|
instantsearch.widgets.configure({
|
32
30
|
hitsPerPage: CONFIG.search.hits.per_page || 10
|
@@ -34,6 +32,7 @@ function algoliaSearch(pjax) {
|
|
34
32
|
instantsearch.widgets.searchBox({
|
35
33
|
container: '.search-input-container',
|
36
34
|
placeholder: LOCAL.search.placeholder,
|
35
|
+
// Hide default icons of algolia search
|
37
36
|
showReset: false,
|
38
37
|
showSubmit: false,
|
39
38
|
showLoadingIndicator: false,
|
@@ -90,24 +89,26 @@ function algoliaSearch(pjax) {
|
|
90
89
|
})
|
91
90
|
]);
|
92
91
|
search.start();
|
93
|
-
|
92
|
+
// Handle and trigger popup window
|
93
|
+
$dom.each('.search', (element) => {
|
94
94
|
element.addEventListener('click', () => {
|
95
95
|
document.body.style.overflow = 'hidden';
|
96
|
-
|
97
|
-
|
98
|
-
});
|
96
|
+
transition(siteSearch, 'shrinkIn', () => {
|
97
|
+
$dom('.search-input').focus();
|
98
|
+
}); // transition.shrinkIn
|
99
99
|
});
|
100
100
|
});
|
101
|
+
// Monitor main search box
|
101
102
|
const onPopupClose = () => {
|
102
103
|
document.body.style.overflow = '';
|
103
|
-
|
104
|
+
transition(siteSearch, 0); // "transition.shrinkOut"
|
104
105
|
};
|
105
|
-
|
106
|
-
if (event.target ===
|
106
|
+
siteSearch.addEventListener('click', (event) => {
|
107
|
+
if (event.target === siteSearch) {
|
107
108
|
onPopupClose();
|
108
109
|
}
|
109
110
|
});
|
110
|
-
|
111
|
+
$dom('.close-btn').addEventListener('click', onPopupClose);
|
111
112
|
window.addEventListener('pjax:success', onPopupClose);
|
112
113
|
window.addEventListener('keyup', (event) => {
|
113
114
|
if (event.key === 'Escape') {
|
@@ -115,4 +116,3 @@ function algoliaSearch(pjax) {
|
|
115
116
|
}
|
116
117
|
});
|
117
118
|
}
|
118
|
-
exports.algoliaSearch = algoliaSearch;
|
@@ -1,17 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
const dom_1 = require("../library/dom");
|
6
|
-
const tabFormat = () => {
|
1
|
+
import { pageScroll } from '../library/anime';
|
2
|
+
import { $dom } from '../library/dom';
|
3
|
+
export const tabFormat = () => {
|
4
|
+
// tab
|
7
5
|
let first_tab;
|
8
|
-
|
6
|
+
$dom.each('div.tab', (element) => {
|
9
7
|
if (element.attr('data-ready')) {
|
10
8
|
return;
|
11
9
|
}
|
12
10
|
const id = element.attr('data-id');
|
13
11
|
const title = element.attr('data-title');
|
14
|
-
let box =
|
12
|
+
let box = $dom('#' + id);
|
15
13
|
if (!box) {
|
16
14
|
box = document.createElement('div');
|
17
15
|
box.className = 'tabs';
|
@@ -19,7 +17,7 @@ const tabFormat = () => {
|
|
19
17
|
box.innerHTML = '<div class="show-btn"></div>';
|
20
18
|
const showBtn = box.child('.show-btn');
|
21
19
|
showBtn.addEventListener('click', () => {
|
22
|
-
|
20
|
+
pageScroll(box);
|
23
21
|
});
|
24
22
|
element.parentNode.insertBefore(box, element);
|
25
23
|
first_tab = true;
|
@@ -53,4 +51,3 @@ const tabFormat = () => {
|
|
53
51
|
element.attr('data-ready', String(true));
|
54
52
|
});
|
55
53
|
};
|
56
|
-
exports.tabFormat = tabFormat;
|
@@ -1,39 +1,38 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
dom_1.$dom.each('.overview .menu > .item', (el) => {
|
10
|
-
globalVars_1.siteNav.child('.menu').appendChild(el.cloneNode(true));
|
1
|
+
import { backToTopHandle, goToBottomHandle, goToCommentHandle, sideBarToggleHandle } from '../components/sidebar';
|
2
|
+
import { backToTop, goToComment, loadCat, menuToggle, quickBtn, setBackToTop, setGoToComment, setShowContents, setToolBtn, setToolPlayer, showContents, siteHeader, siteNav, toolBtn, toolPlayer } from '../globals/globalVars';
|
3
|
+
import { Loader } from '../globals/thirdparty';
|
4
|
+
import { $dom } from '../library/dom';
|
5
|
+
import { mediaPlayer } from '../player';
|
6
|
+
export default function domInit() {
|
7
|
+
$dom.each('.overview .menu > .item', (el) => {
|
8
|
+
siteNav.child('.menu').appendChild(el.cloneNode(true));
|
11
9
|
});
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
if (!
|
18
|
-
|
10
|
+
loadCat.addEventListener('click', Loader.vanish);
|
11
|
+
menuToggle.addEventListener('click', sideBarToggleHandle);
|
12
|
+
$dom('.dimmer').addEventListener('click', sideBarToggleHandle);
|
13
|
+
quickBtn.child('.down').addEventListener('click', goToBottomHandle);
|
14
|
+
quickBtn.child('.up').addEventListener('click', backToTopHandle);
|
15
|
+
if (!toolBtn) {
|
16
|
+
setToolBtn(siteHeader.createChild('div', {
|
19
17
|
id: 'tool',
|
20
18
|
innerHTML: '<div class="item player"></div><div class="item contents"><i class="ic i-list-ol"></i></div><div class="item chat"><i class="ic i-comments"></i></div><div class="item back-to-top"><i class="ic i-arrow-up"></i><span>0%</span></div>'
|
21
19
|
}));
|
22
20
|
}
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
if (typeof
|
31
|
-
|
32
|
-
|
33
|
-
|
21
|
+
setToolPlayer(toolBtn.child('.player'));
|
22
|
+
setBackToTop(toolBtn.child('.back-to-top'));
|
23
|
+
setGoToComment(toolBtn.child('.chat'));
|
24
|
+
setShowContents(toolBtn.child('.contents'));
|
25
|
+
backToTop.addEventListener('click', backToTopHandle);
|
26
|
+
goToComment.addEventListener('click', goToCommentHandle);
|
27
|
+
showContents.addEventListener('click', sideBarToggleHandle);
|
28
|
+
if (typeof mediaPlayer !== 'undefined') {
|
29
|
+
mediaPlayer(toolPlayer);
|
30
|
+
$dom('main').addEventListener('click', () => {
|
31
|
+
toolPlayer.player.mini();
|
34
32
|
});
|
35
33
|
}
|
36
34
|
const createIntersectionObserver = () => {
|
35
|
+
// waves在视口外时停止动画
|
37
36
|
new IntersectionObserver(([entry]) => {
|
38
37
|
if (entry.isIntersecting) {
|
39
38
|
document.querySelectorAll('.parallax>use').forEach(i => {
|
@@ -47,6 +46,7 @@ function domInit() {
|
|
47
46
|
document.querySelectorAll('.parallax>use').forEach(i => {
|
48
47
|
i.classList.add('stop-animation');
|
49
48
|
});
|
49
|
+
// waves不可见时imgs也应该不可见了
|
50
50
|
document.querySelectorAll('#imgs .item').forEach(i => {
|
51
51
|
i.classList.add('stop-animation');
|
52
52
|
});
|
@@ -55,6 +55,7 @@ function domInit() {
|
|
55
55
|
root: null,
|
56
56
|
threshold: 0.2
|
57
57
|
}).observe(document.getElementById('waves'));
|
58
|
+
// sakura在视口外时停止动画
|
58
59
|
new IntersectionObserver(([entry]) => {
|
59
60
|
if (entry.isIntersecting) {
|
60
61
|
document.querySelectorAll('.with-love>i').forEach(i => {
|
@@ -73,4 +74,3 @@ function domInit() {
|
|
73
74
|
};
|
74
75
|
createIntersectionObserver();
|
75
76
|
}
|
76
|
-
exports.default = domInit;
|
@@ -1,59 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
const
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
globalVars_1.sideBar.removeClass('on');
|
22
|
-
globalVars_1.menuToggle.removeClass('close');
|
23
|
-
});
|
1
|
+
import { $dom } from '../library/dom';
|
2
|
+
import { cardActive } from '../page/common';
|
3
|
+
import { postBeauty } from '../page/post';
|
4
|
+
import { pageScroll, transition } from '../library/anime';
|
5
|
+
import { vendorCss, vendorJs } from '../library/loadFile';
|
6
|
+
import { pjaxScript } from '../library/scriptPjax';
|
7
|
+
import { resizeHandle } from '../globals/handles';
|
8
|
+
import { loadCat, menuToggle, setLocalHash, setLocalUrl, setOriginTitle, sideBar, toolPlayer } from '../globals/globalVars';
|
9
|
+
import { mediaPlayer } from '../player';
|
10
|
+
import { pagePosition, positionInit } from '../globals/tools';
|
11
|
+
import { menuActive, sideBarTab, sidebarTOC } from '../components/sidebar';
|
12
|
+
import { Loader, isOutime, lazyload } from '../globals/thirdparty';
|
13
|
+
import { tabFormat } from '../page/tab';
|
14
|
+
export const pjaxReload = () => {
|
15
|
+
pagePosition();
|
16
|
+
if (sideBar.hasClass('on')) {
|
17
|
+
transition(sideBar, 0, () => {
|
18
|
+
sideBar.removeClass('on');
|
19
|
+
menuToggle.removeClass('close');
|
20
|
+
}); // 'transition.slideRightOut'
|
24
21
|
}
|
25
|
-
const mainNode =
|
22
|
+
const mainNode = $dom('#main');
|
26
23
|
mainNode.innerHTML = '';
|
27
|
-
mainNode.appendChild(
|
28
|
-
|
24
|
+
mainNode.appendChild(loadCat.lastChild.cloneNode(true));
|
25
|
+
pageScroll(0);
|
29
26
|
};
|
30
|
-
|
31
|
-
|
32
|
-
(
|
33
|
-
(
|
34
|
-
(
|
35
|
-
(
|
36
|
-
(
|
37
|
-
(0, loadFile_1.vendorJs)('chart');
|
27
|
+
export const siteRefresh = (reload) => {
|
28
|
+
setLocalHash(0);
|
29
|
+
setLocalUrl(window.location.href);
|
30
|
+
vendorCss('katex');
|
31
|
+
vendorJs('copy_tex');
|
32
|
+
vendorCss('mermaid');
|
33
|
+
vendorJs('chart');
|
38
34
|
if (reload !== 1) {
|
39
|
-
|
35
|
+
$dom.each('script[data-pjax]', pjaxScript);
|
40
36
|
}
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
if (typeof
|
49
|
-
|
37
|
+
setOriginTitle(document.title);
|
38
|
+
resizeHandle();
|
39
|
+
menuActive();
|
40
|
+
sideBarTab();
|
41
|
+
sidebarTOC();
|
42
|
+
postBeauty();
|
43
|
+
tabFormat();
|
44
|
+
if (typeof mediaPlayer !== 'undefined') {
|
45
|
+
toolPlayer.player.load(LOCAL.audio || CONFIG.audio || {});
|
50
46
|
}
|
51
|
-
|
47
|
+
Loader.hide();
|
52
48
|
setTimeout(() => {
|
53
|
-
|
49
|
+
positionInit();
|
54
50
|
}, 500);
|
55
|
-
|
56
|
-
|
57
|
-
|
51
|
+
cardActive();
|
52
|
+
lazyload.observe();
|
53
|
+
isOutime();
|
58
54
|
};
|
59
|
-
exports.siteRefresh = siteRefresh;
|