hexo-theme-shokax 0.2.10 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/LICENSE +68 -81
  2. package/README.md +17 -6
  3. package/UsageRestrictions.md +21 -0
  4. package/_config.yml +5 -12
  5. package/layout/_mixin/comment.pug +1 -2
  6. package/layout/_mixin/widgets.pug +2 -1
  7. package/layout/_partials/layout.pug +23 -23
  8. package/package.json +16 -12
  9. package/scripts/generaters/script.js +29 -8
  10. package/scripts/helpers/summary_ai.js +0 -1
  11. package/scripts/plugin/check.js +30 -0
  12. package/scripts/plugin/index.js +5 -0
  13. package/source/css/_common/components/tags/tabs.styl +0 -2
  14. package/source/css/_common/scaffolding/normalize.styl +165 -180
  15. package/source/js/_app/globals/globalVars.js +26 -0
  16. package/source/js/_app/globals/handles.js +105 -0
  17. package/source/js/_app/globals/themeColor.js +48 -0
  18. package/source/js/_app/globals/thirdparty.js +60 -0
  19. package/source/js/_app/globals/tools.js +75 -0
  20. package/source/js/_app/library/anime.js +85 -0
  21. package/source/js/_app/library/dom.js +22 -0
  22. package/source/js/_app/library/loadFile.js +32 -0
  23. package/source/js/_app/library/proto.js +105 -0
  24. package/source/js/_app/library/scriptPjax.js +57 -0
  25. package/source/js/_app/library/storage.js +11 -0
  26. package/source/js/_app/page/comment.js +19 -0
  27. package/source/js/_app/page/common.js +57 -0
  28. package/source/js/_app/page/fancybox.js +59 -0
  29. package/source/js/_app/page/post.js +232 -0
  30. package/source/js/_app/page/search.js +111 -0
  31. package/source/js/_app/page/tab.js +50 -0
  32. package/source/js/_app/pjax/domInit.js +68 -0
  33. package/source/js/_app/pjax/refresh.js +42 -0
  34. package/source/js/_app/pjax/siteInit.js +34 -0
  35. package/source/js/_app/player.js +1 -1
  36. package/source/js/_app/global.js +0 -314
  37. package/source/js/_app/library.js +0 -312
  38. package/source/js/_app/page.js +0 -673
  39. /package/source/js/_app/{components.js → components/sidebar.js} +0 -0
  40. /package/source/js/_app/{vue.js → library/vue.js} +0 -0
@@ -1,673 +0,0 @@
1
- const cardActive = () => {
2
- if (!$dom('.index.wrap')) {
3
- return;
4
- }
5
- const io = new IntersectionObserver((entries) => {
6
- entries.forEach((article) => {
7
- if (article.target.hasClass('show')) {
8
- io.unobserve(article.target);
9
- }
10
- else {
11
- if (article.isIntersecting || article.intersectionRatio > 0) {
12
- article.target.addClass('show');
13
- io.unobserve(article.target);
14
- }
15
- }
16
- });
17
- }, {
18
- root: null,
19
- threshold: [0.3]
20
- });
21
- $dom.each('.index.wrap article.item, .index.wrap section.item', (article) => {
22
- io.observe(article);
23
- });
24
- $dom('.index.wrap .item:first-child').addClass('show');
25
- $dom.each('.cards .item', (element) => {
26
- ['mouseenter', 'touchstart'].forEach((item) => {
27
- element.addEventListener(item, () => {
28
- if ($dom('.cards .item.active')) {
29
- $dom('.cards .item.active').removeClass('active');
30
- }
31
- element.addClass('active');
32
- }, { passive: true });
33
- });
34
- ['mouseleave'].forEach((item) => {
35
- element.addEventListener(item, () => {
36
- element.removeClass('active');
37
- }, { passive: true });
38
- });
39
- });
40
- };
41
- const registerExtURL = () => {
42
- $dom.each('span.exturl', (element) => {
43
- const link = document.createElement('a');
44
- link.href = decodeURIComponent(window.atob(element.dataset.url).split('').map((c) => {
45
- return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
46
- }).join(''));
47
- link.rel = 'noopener external nofollow noreferrer';
48
- link.target = '_blank';
49
- link.className = element.className;
50
- link.title = element.title || element.innerText;
51
- link.innerHTML = element.innerHTML;
52
- if (element.dataset.backgroundImage) {
53
- link.dataset.backgroundImage = element.dataset.backgroundImage;
54
- }
55
- element.parentNode.replaceChild(link, element);
56
- });
57
- };
58
- const postFancybox = (p) => {
59
- if ($dom(p + ' .md img')) {
60
- vendorCss('fancybox');
61
- vendorJs('fancybox', () => {
62
- const q = jQuery.noConflict();
63
- $dom.each(p + ' p.gallery', (element) => {
64
- const box = document.createElement('div');
65
- box.className = 'gallery';
66
- box.attr('data-height', String(element.attr('data-height') || 220));
67
- box.innerHTML = element.innerHTML.replace(/<br>/g, '');
68
- element.parentNode.insertBefore(box, element);
69
- element.remove();
70
- });
71
- $dom.each(p + ' .md img:not(.emoji):not(.vemoji)', (element) => {
72
- const $image = q(element);
73
- const imageLink = $image.attr('data-src') || $image.attr('src');
74
- const $imageWrapLink = $image.wrap('<a class="fancybox" href="' + imageLink + '" itemscope itemtype="https://schema.org/ImageObject" itemprop="url"></a>').parent('a');
75
- let info;
76
- let captionClass = 'image-info';
77
- if (!$image.is('a img')) {
78
- $image.data('safe-src', imageLink);
79
- if (!$image.is('.gallery img')) {
80
- $imageWrapLink.attr('data-fancybox', 'default').attr('rel', 'default');
81
- }
82
- else {
83
- captionClass = 'jg-caption';
84
- }
85
- }
86
- if ((info = element.attr('title'))) {
87
- $imageWrapLink.attr('data-caption', info);
88
- const para = document.createElement('span');
89
- const txt = document.createTextNode(info);
90
- para.appendChild(txt);
91
- para.addClass(captionClass);
92
- element.insertAfter(para);
93
- }
94
- });
95
- $dom.each(p + ' div.gallery', (el, i) => {
96
- q(el).justifiedGallery({
97
- rowHeight: q(el).data('height') || 120,
98
- rel: 'gallery-' + i
99
- }).on('jg.complete', function () {
100
- q(this).find('a').each((k, ele) => {
101
- ele.attr('data-fancybox', 'gallery-' + i);
102
- });
103
- });
104
- });
105
- q.fancybox.defaults.hash = false;
106
- q(p + ' .fancybox').fancybox({
107
- loop: true,
108
- helpers: {
109
- overlay: {
110
- locked: false
111
- }
112
- }
113
- });
114
- }, window.jQuery);
115
- }
116
- };
117
- const postBeauty = () => {
118
- loadComments();
119
- if (!$dom('.md')) {
120
- return;
121
- }
122
- postFancybox('.post.block');
123
- $dom('.post.block').oncopy = async (event) => {
124
- showtip(LOCAL.copyright);
125
- if (LOCAL.nocopy) {
126
- event.preventDefault();
127
- return;
128
- }
129
- const copyright = await $dom.asyncify('#copyright');
130
- if (window.getSelection().toString().length > 30 && copyright) {
131
- event.preventDefault();
132
- const author = '# ' + copyright.child('.author').innerText;
133
- const link = '# ' + copyright.child('.link').innerText;
134
- const license = '# ' + copyright.child('.license').innerText;
135
- const htmlData = author + '<br>' + link + '<br>' + license + '<br><br>' + window.getSelection().toString().replace(/\r\n/g, '<br>');
136
- const textData = author + '\n' + link + '\n' + license + '\n\n' + window.getSelection().toString().replace(/\r\n/g, '\n');
137
- if (event.clipboardData) {
138
- event.clipboardData.setData('text/html', htmlData);
139
- event.clipboardData.setData('text/plain', textData);
140
- }
141
- else {
142
- if (window.clipboardData) {
143
- return window.clipboardData.setData('text', textData);
144
- }
145
- }
146
- }
147
- };
148
- $dom.each('li ruby', (element) => {
149
- let parent = element.parentNode;
150
- if (element.parentNode.tagName !== 'LI') {
151
- parent = element.parentNode.parentNode;
152
- }
153
- parent.addClass('ruby');
154
- });
155
- $dom.each('ol[start]', (element) => {
156
- element.style.counterReset = 'counter ' + parseInt(element.attr('start') - 1);
157
- });
158
- $dom.each('.md table', (element) => {
159
- element.wrapObject({
160
- className: 'table-container'
161
- });
162
- });
163
- $dom.each('.highlight > .table-container', (element) => {
164
- element.className = 'code-container';
165
- });
166
- $dom.each('figure.highlight', (element) => {
167
- const code_container = element.child('.code-container');
168
- const caption = element.child('figcaption');
169
- 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>');
170
- const copyBtn = element.child('.copy-btn');
171
- if (LOCAL.nocopy) {
172
- copyBtn.remove();
173
- }
174
- else {
175
- copyBtn.addEventListener('click', (event) => {
176
- const target = event.currentTarget;
177
- let comma = '';
178
- let code = '';
179
- code_container.find('pre').forEach((line) => {
180
- code += comma + line.innerText;
181
- comma = '\n';
182
- });
183
- clipBoard(code, (result) => {
184
- target.child('.ic').className = result ? 'ic i-check' : 'ic i-times';
185
- target.blur();
186
- showtip(LOCAL.copyright);
187
- });
188
- }, { passive: true });
189
- copyBtn.addEventListener('mouseleave', (event) => {
190
- setTimeout(() => {
191
- event.target.child('.ic').className = 'ic i-clipboard';
192
- }, 1000);
193
- });
194
- }
195
- const breakBtn = element.child('.breakline-btn');
196
- breakBtn.addEventListener('click', (event) => {
197
- const target = event.currentTarget;
198
- if (element.hasClass('breakline')) {
199
- element.removeClass('breakline');
200
- target.child('.ic').className = 'ic i-align-left';
201
- }
202
- else {
203
- element.addClass('breakline');
204
- target.child('.ic').className = 'ic i-align-justify';
205
- }
206
- });
207
- const fullscreenBtn = element.child('.fullscreen-btn');
208
- const removeFullscreen = () => {
209
- element.removeClass('fullscreen');
210
- element.scrollTop = 0;
211
- BODY.removeClass('fullscreen');
212
- fullscreenBtn.child('.ic').className = 'ic i-expand';
213
- };
214
- const fullscreenHandle = () => {
215
- if (element.hasClass('fullscreen')) {
216
- removeFullscreen();
217
- if (code_container && code_container.find('tr').length > 15) {
218
- const showBtn = code_container.child('.show-btn');
219
- code_container.style.maxHeight = '300px';
220
- showBtn.removeClass('open');
221
- }
222
- pageScroll(element);
223
- }
224
- else {
225
- element.addClass('fullscreen');
226
- BODY.addClass('fullscreen');
227
- fullscreenBtn.child('.ic').className = 'ic i-compress';
228
- if (code_container && code_container.find('tr').length > 15) {
229
- const showBtn = code_container.child('.show-btn');
230
- code_container.style.maxHeight = '';
231
- showBtn.addClass('open');
232
- }
233
- }
234
- };
235
- fullscreenBtn.addEventListener('click', fullscreenHandle);
236
- caption && caption.addEventListener('click', fullscreenHandle);
237
- if (code_container && code_container.find('tr').length > 15) {
238
- code_container.style.maxHeight = '300px';
239
- code_container.insertAdjacentHTML('beforeend', '<div class="show-btn"><i class="ic i-angle-down"></i></div>');
240
- const showBtn = code_container.child('.show-btn');
241
- const hideCode = () => {
242
- code_container.style.maxHeight = '300px';
243
- showBtn.removeClass('open');
244
- };
245
- const showCode = () => {
246
- code_container.style.maxHeight = '';
247
- showBtn.addClass('open');
248
- };
249
- showBtn.addEventListener('click', () => {
250
- if (showBtn.hasClass('open')) {
251
- removeFullscreen();
252
- hideCode();
253
- pageScroll(code_container);
254
- }
255
- else {
256
- showCode();
257
- }
258
- });
259
- }
260
- });
261
- $dom.asyncifyEach('pre.mermaid > svg', (element) => {
262
- const temp = element;
263
- temp.style.maxWidth = '';
264
- });
265
- $dom.each('.reward button', (element) => {
266
- element.addEventListener('click', (event) => {
267
- event.preventDefault();
268
- const qr = $dom('#qr');
269
- if (qr.display() === 'inline-flex') {
270
- transition(qr, 0);
271
- }
272
- else {
273
- transition(qr, 1, () => {
274
- qr.display('inline-flex');
275
- });
276
- }
277
- });
278
- });
279
- $dom.asyncifyEach('.quiz > ul.options li', (element) => {
280
- element.addEventListener('click', () => {
281
- if (element.hasClass('correct')) {
282
- element.toggleClass('right');
283
- element.parentNode.parentNode.addClass('show');
284
- }
285
- else {
286
- element.toggleClass('wrong');
287
- }
288
- });
289
- });
290
- $dom.asyncifyEach('.quiz > p', (element) => {
291
- element.addEventListener('click', () => {
292
- element.parentNode.toggleClass('show');
293
- });
294
- });
295
- $dom.asyncifyEach('.quiz > p:first-child', (element) => {
296
- const quiz = element.parentNode;
297
- let type = 'choice';
298
- if (quiz.hasClass('true') || quiz.hasClass('false')) {
299
- type = 'true_false';
300
- }
301
- if (quiz.hasClass('multi')) {
302
- type = 'multiple';
303
- }
304
- if (quiz.hasClass('fill')) {
305
- type = 'gap_fill';
306
- }
307
- if (quiz.hasClass('essay')) {
308
- type = 'essay';
309
- }
310
- element.attr('data-type', LOCAL.quiz[type]);
311
- });
312
- $dom.asyncifyEach('.quiz .mistake', (element) => {
313
- element.attr('data-type', LOCAL.quiz.mistake);
314
- });
315
- $dom.each('div.tags a', (element) => {
316
- element.className = ['primary', 'success', 'info', 'warning', 'danger'][Math.floor(Math.random() * 5)];
317
- });
318
- $dom.asyncifyEach('.md div.player', (element) => {
319
- mediaPlayer(element, {
320
- type: element.attr('data-type'),
321
- mode: 'order',
322
- btns: []
323
- }).player.load(JSON.parse(element.attr('data-src'))).fetch();
324
- });
325
- const angleDown = document.querySelectorAll('.show-btn .i-angle-down');
326
- if (angleDown.length) {
327
- const io = new IntersectionObserver((entries) => {
328
- entries.forEach(entry => {
329
- if (entry.isIntersecting) {
330
- angleDown.forEach(i => {
331
- i.classList.remove('stop-animation');
332
- });
333
- }
334
- else {
335
- angleDown.forEach(i => {
336
- i.classList.add('stop-animation');
337
- });
338
- }
339
- });
340
- }, {
341
- root: null,
342
- threshold: 0.5
343
- });
344
- angleDown.forEach(i => {
345
- io.observe(i);
346
- });
347
- }
348
- };
349
- const tabFormat = () => {
350
- let first_tab;
351
- $dom.each('div.tab', (element) => {
352
- if (element.attr('data-ready')) {
353
- return;
354
- }
355
- const id = element.attr('data-id');
356
- const title = element.attr('data-title');
357
- let box = $dom('#' + id);
358
- if (!box) {
359
- box = document.createElement('div');
360
- box.className = 'tabs';
361
- box.id = id;
362
- box.innerHTML = '<div class="show-btn"></div>';
363
- const showBtn = box.child('.show-btn');
364
- showBtn.addEventListener('click', () => {
365
- pageScroll(box);
366
- });
367
- element.parentNode.insertBefore(box, element);
368
- first_tab = true;
369
- }
370
- else {
371
- first_tab = false;
372
- }
373
- let ul = box.child('.nav ul');
374
- if (!ul) {
375
- ul = box.createChild('div', {
376
- className: 'nav',
377
- innerHTML: '<ul></ul>'
378
- }).child('ul');
379
- }
380
- const li = ul.createChild('li', {
381
- innerHTML: title
382
- });
383
- if (first_tab) {
384
- li.addClass('active');
385
- element.addClass('active');
386
- }
387
- li.addEventListener('click', (event) => {
388
- const target = event.currentTarget;
389
- box.find('.active').forEach((el) => {
390
- el.removeClass('active');
391
- });
392
- element.addClass('active');
393
- target.addClass('active');
394
- });
395
- box.appendChild(element);
396
- element.attr('data-ready', String(true));
397
- });
398
- };
399
- const loadComments = () => {
400
- const element = $dom('#comments');
401
- if (!element) {
402
- goToComment.display('none');
403
- return;
404
- }
405
- else {
406
- goToComment.display('');
407
- }
408
- const io = new IntersectionObserver((entries, observer) => {
409
- const entry = entries[0];
410
- vendorCss('valine');
411
- if (entry.isIntersecting || entry.intersectionRatio > 0) {
412
- transition($dom('#comments'), 'bounceUpIn');
413
- observer.disconnect();
414
- }
415
- });
416
- io.observe(element);
417
- };
418
- const algoliaSearch = (pjax) => {
419
- if (CONFIG.search === null) {
420
- return;
421
- }
422
- if (!siteSearch) {
423
- siteSearch = BODY.createChild('div', {
424
- id: 'search',
425
- 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>'
426
- });
427
- }
428
- const search = instantsearch({
429
- indexName: CONFIG.search.indexName,
430
- searchClient: algoliasearch(CONFIG.search.appID, CONFIG.search.apiKey),
431
- searchFunction(helper) {
432
- const searchInput = $dom('.search-input');
433
- if (searchInput.value) {
434
- helper.search();
435
- }
436
- }
437
- });
438
- search.on('render', () => {
439
- pjax.refresh($dom('#search-hits'));
440
- });
441
- search.addWidgets([
442
- instantsearch.widgets.configure({
443
- hitsPerPage: CONFIG.search.hits.per_page || 10
444
- }),
445
- instantsearch.widgets.searchBox({
446
- container: '.search-input-container',
447
- placeholder: LOCAL.search.placeholder,
448
- showReset: false,
449
- showSubmit: false,
450
- showLoadingIndicator: false,
451
- cssClasses: {
452
- input: 'search-input'
453
- }
454
- }),
455
- instantsearch.widgets.stats({
456
- container: '#search-stats',
457
- templates: {
458
- text(data) {
459
- const stats = LOCAL.search.stats
460
- .replace(/\$\{hits}/, data.nbHits)
461
- .replace(/\$\{time}/, data.processingTimeMS);
462
- return stats + '<span class="algolia-powered"></span><hr>';
463
- }
464
- }
465
- }),
466
- instantsearch.widgets.hits({
467
- container: '#search-hits',
468
- templates: {
469
- item(data) {
470
- const cats = data.categories ? '<span>' + data.categories.join('<i class="ic i-angle-right"></i>') + '</span>' : '';
471
- return '<a href="' + CONFIG.root + data.path + '">' + cats + data._highlightResult.title.value + '</a>';
472
- },
473
- empty(data) {
474
- return '<div id="hits-empty">' +
475
- LOCAL.search.empty.replace(/\$\{query}/, data.query) +
476
- '</div>';
477
- }
478
- },
479
- cssClasses: {
480
- item: 'item'
481
- }
482
- }),
483
- instantsearch.widgets.pagination({
484
- container: '#search-pagination',
485
- scrollTo: false,
486
- showFirst: false,
487
- showLast: false,
488
- templates: {
489
- first: '<i class="ic i-angle-double-left"></i>',
490
- last: '<i class="ic i-angle-double-right"></i>',
491
- previous: '<i class="ic i-angle-left"></i>',
492
- next: '<i class="ic i-angle-right"></i>'
493
- },
494
- cssClasses: {
495
- root: 'pagination',
496
- item: 'pagination-item',
497
- link: 'page-number',
498
- selectedItem: 'current',
499
- disabledItem: 'disabled-item'
500
- }
501
- })
502
- ]);
503
- search.start();
504
- $dom.each('.search', (element) => {
505
- element.addEventListener('click', () => {
506
- document.body.style.overflow = 'hidden';
507
- transition(siteSearch, 'shrinkIn', () => {
508
- $dom('.search-input').focus();
509
- });
510
- });
511
- });
512
- const onPopupClose = () => {
513
- document.body.style.overflow = '';
514
- transition(siteSearch, 0);
515
- };
516
- siteSearch.addEventListener('click', (event) => {
517
- if (event.target === siteSearch) {
518
- onPopupClose();
519
- }
520
- });
521
- $dom('.close-btn').addEventListener('click', onPopupClose);
522
- window.addEventListener('pjax:success', onPopupClose);
523
- window.addEventListener('keyup', (event) => {
524
- if (event.key === 'Escape') {
525
- onPopupClose();
526
- }
527
- });
528
- };
529
- const domInit = () => {
530
- $dom.each('.overview .menu > .item', (el) => {
531
- siteNav.child('.menu').appendChild(el.cloneNode(true));
532
- });
533
- loadCat.addEventListener('click', Loader.vanish);
534
- menuToggle.addEventListener('click', sideBarToggleHandle);
535
- $dom('.dimmer').addEventListener('click', sideBarToggleHandle);
536
- quickBtn.child('.down').addEventListener('click', goToBottomHandle);
537
- quickBtn.child('.up').addEventListener('click', backToTopHandle);
538
- if (!toolBtn) {
539
- toolBtn = siteHeader.createChild('div', {
540
- id: 'tool',
541
- 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>'
542
- });
543
- }
544
- toolPlayer = toolBtn.child('.player');
545
- backToTop = toolBtn.child('.back-to-top');
546
- goToComment = toolBtn.child('.chat');
547
- showContents = toolBtn.child('.contents');
548
- backToTop.addEventListener('click', backToTopHandle);
549
- goToComment.addEventListener('click', goToCommentHandle);
550
- showContents.addEventListener('click', sideBarToggleHandle);
551
- if (typeof mediaPlayer !== 'undefined') {
552
- mediaPlayer(toolPlayer);
553
- $dom('main').addEventListener('click', () => {
554
- toolPlayer.player.mini();
555
- });
556
- }
557
- const createIntersectionObserver = () => {
558
- new IntersectionObserver(([entry]) => {
559
- if (entry.isIntersecting) {
560
- document.querySelectorAll('.parallax>use').forEach(i => {
561
- i.classList.remove('stop-animation');
562
- });
563
- document.querySelectorAll('#imgs .item').forEach(i => {
564
- i.classList.remove('stop-animation');
565
- });
566
- }
567
- else {
568
- document.querySelectorAll('.parallax>use').forEach(i => {
569
- i.classList.add('stop-animation');
570
- });
571
- document.querySelectorAll('#imgs .item').forEach(i => {
572
- i.classList.add('stop-animation');
573
- });
574
- }
575
- }, {
576
- root: null,
577
- threshold: 0.2
578
- }).observe(document.getElementById('waves'));
579
- new IntersectionObserver(([entry]) => {
580
- if (entry.isIntersecting) {
581
- document.querySelectorAll('.with-love>i').forEach(i => {
582
- i.classList.remove('stop-animation');
583
- });
584
- }
585
- else {
586
- document.querySelectorAll('.with-love>i').forEach(i => {
587
- i.classList.add('stop-animation');
588
- });
589
- }
590
- }, {
591
- root: null,
592
- threshold: 0.2
593
- }).observe(document.querySelector('.with-love'));
594
- };
595
- createIntersectionObserver();
596
- };
597
- const pjaxReload = () => {
598
- pagePosition();
599
- if (sideBar.hasClass('on')) {
600
- transition(sideBar, 0, () => {
601
- sideBar.removeClass('on');
602
- menuToggle.removeClass('close');
603
- });
604
- }
605
- const mainNode = $dom('#main');
606
- mainNode.innerHTML = '';
607
- mainNode.appendChild(loadCat.lastChild.cloneNode(true));
608
- pageScroll(0);
609
- };
610
- const siteRefresh = (reload) => {
611
- LOCAL_HASH = 0;
612
- LOCAL_URL = window.location.href;
613
- vendorCss('katex');
614
- vendorJs('copy_tex');
615
- vendorCss('mermaid');
616
- vendorJs('chart');
617
- if (reload !== 1) {
618
- $dom.each('script[data-pjax]', pjaxScript);
619
- }
620
- originTitle = document.title;
621
- resizeHandle();
622
- menuActive();
623
- sideBarTab();
624
- sidebarTOC();
625
- registerExtURL();
626
- postBeauty();
627
- tabFormat();
628
- if (typeof mediaPlayer !== 'undefined') {
629
- toolPlayer.player.load(LOCAL.audio || CONFIG.audio || {});
630
- }
631
- Loader.hide();
632
- setTimeout(() => {
633
- positionInit();
634
- }, 500);
635
- cardActive();
636
- lazyload.observe();
637
- isOutime();
638
- };
639
- const siteInit = () => {
640
- domInit();
641
- pjax = new Pjax({
642
- selectors: [
643
- 'head title',
644
- '.languages',
645
- '.twikoo',
646
- '.pjax',
647
- '.leancloud-recent-comment',
648
- 'script[data-config]'
649
- ],
650
- cacheBust: false
651
- });
652
- CONFIG.quicklink.ignores = LOCAL.ignores;
653
- quicklink.listen(CONFIG.quicklink);
654
- autoDarkmode();
655
- if (!CONFIG.disableVL) {
656
- visibilityListener();
657
- }
658
- themeColorListener();
659
- algoliaSearch(pjax);
660
- window.addEventListener('scroll', scrollHandle);
661
- window.addEventListener('resize', resizeHandle);
662
- window.addEventListener('pjax:send', pjaxReload);
663
- window.addEventListener('pjax:success', siteRefresh);
664
- window.addEventListener('beforeunload', () => {
665
- pagePosition();
666
- });
667
- siteRefresh(1);
668
- };
669
- window.addEventListener('DOMContentLoaded', siteInit, {
670
- passive: true
671
- });
672
- console.log('%c Theme.ShokaX v' + CONFIG.version + ' %c https://github.com/theme-shoka-x/hexo-theme-shokaX ', 'color: white; background: #e9546b; padding:5px 0;', 'padding:4px;border:1px solid #e9546b;');
673
- console.log('%c by kaitaku ' + '%c https://www.kaitaku.xyz', 'color: white; background: #00bfff; padding: 5px 3px;', 'padding: 4px;border:1px solid #00bfff');
File without changes