hexo-theme-solitude 1.12.3 → 1.13.2

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.
Files changed (52) hide show
  1. package/.github/persona.avif +0 -0
  2. package/.github/screenshot.avif +0 -0
  3. package/README.md +3 -3
  4. package/README_en-US.md +3 -3
  5. package/README_zh-Hant.md +3 -3
  6. package/_config.yml +52 -8
  7. package/languages/default.yml +1 -0
  8. package/languages/en.yml +1 -0
  9. package/languages/zh-CN.yml +1 -0
  10. package/languages/zh-TW.yml +1 -0
  11. package/layout/includes/console.pug +44 -26
  12. package/layout/includes/head/config.pug +20 -0
  13. package/layout/includes/header.pug +4 -2
  14. package/layout/includes/layout.pug +6 -1
  15. package/layout/includes/page/recentcomment.pug +6 -1
  16. package/layout/includes/widgets/home/banner.pug +15 -12
  17. package/layout/includes/widgets/home/hot/index.pug +7 -0
  18. package/layout/includes/widgets/home/hot/twikoo.pug +46 -0
  19. package/layout/includes/widgets/nav/right.pug +1 -1
  20. package/layout/includes/widgets/page/links/banner.pug +2 -1
  21. package/layout/includes/widgets/page/recentcomment/artalk.pug +5 -5
  22. package/layout/includes/widgets/page/recentcomment/twikoo.pug +5 -5
  23. package/layout/includes/widgets/page/recentcomment/valine.pug +5 -5
  24. package/layout/includes/widgets/page/recentcomment/waline.pug +5 -5
  25. package/layout/includes/widgets/post/postInfo.pug +80 -0
  26. package/layout/includes/widgets/post/postMeta.pug +1 -81
  27. package/layout/index.pug +2 -0
  28. package/layout/post.pug +6 -3
  29. package/package.json +1 -1
  30. package/scripts/event/merge_config.js +34 -1
  31. package/scripts/filter/checkThemeConfig.js +0 -5
  32. package/source/css/_comments/comment.styl +3 -4
  33. package/source/css/_global/index.styl +18 -2
  34. package/source/css/_layout/article-container.styl +4 -0
  35. package/source/css/_layout/console.styl +1 -1
  36. package/source/css/_layout/expire.styl +13 -0
  37. package/source/css/_layout/header.styl +14 -13
  38. package/source/css/_page/_home/home-top.styl +6 -0
  39. package/source/css/_page/_home/home.styl +4 -1
  40. package/source/css/_page/_home/hot-tip.styl +11 -0
  41. package/source/css/_page/index.styl +1 -1
  42. package/source/css/_page/links.styl +22 -1
  43. package/source/css/_page/other.styl +2 -0
  44. package/source/css/_page/recentcomment.styl +5 -2
  45. package/source/css/_post/copyright.styl +1 -1
  46. package/source/css/_post/meta.styl +196 -187
  47. package/source/css/_post/pagination.styl +2 -5
  48. package/source/css/_post/relatedPost.styl +1 -1
  49. package/source/css/_post/tools.styl +1 -1
  50. package/source/js/main.js +63 -15
  51. package/.github/logo.svg +0 -23
  52. package/.github/screenshot.webp +0 -0
package/source/js/main.js CHANGED
@@ -3,7 +3,7 @@ const sidebarFn = () => {
3
3
  const $mobileSidebarMenus = document.getElementById('sidebar-menus');
4
4
  const $menuMask = document.getElementById('menu-mask');
5
5
  const $body = document.body;
6
-
6
+
7
7
  const toggleMobileSidebar = (isOpen) => {
8
8
  utils.sidebarPaddingR();
9
9
  $body.style.overflow = isOpen ? 'hidden' : '';
@@ -18,7 +18,7 @@ const sidebarFn = () => {
18
18
  }
19
19
  $toggleMenu.addEventListener('click', () => toggleMobileSidebar(true));
20
20
  $menuMask.addEventListener('click', closeMobileSidebar);
21
-
21
+
22
22
  window.addEventListener('resize', () => {
23
23
  if (utils.isHidden($toggleMenu) && $mobileSidebarMenus.classList.contains('open')) {
24
24
  closeMobileSidebar();
@@ -107,11 +107,13 @@ const asideStatus = () => {
107
107
  const status = utils.saveToLocal.get('aside-status');
108
108
  document.documentElement.classList.toggle('hide-aside', status === 'hide');
109
109
  }
110
+
110
111
  function initThemeColor() {
111
112
  const currentTop = window.scrollY || document.documentElement.scrollTop;
112
113
  const themeColor = currentTop > 0 ? '--efu-card-bg' : PAGE_CONFIG.is_post ? '--efu-main' : '--efu-background';
113
114
  applyThemeColor(getComputedStyle(document.documentElement).getPropertyValue(themeColor));
114
115
  }
116
+
115
117
  function applyThemeColor(color) {
116
118
  const themeColorMeta = document.querySelector('meta[name="theme-color"]');
117
119
  const appleMobileWebAppMeta = document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');
@@ -121,6 +123,7 @@ function applyThemeColor(color) {
121
123
  document.body.style.backgroundColor = color;
122
124
  }
123
125
  }
126
+
124
127
  const handleThemeChange = mode => {
125
128
  const themeChange = window.globalFn?.themeChange || {}
126
129
  for (let key in themeChange) {
@@ -213,7 +216,7 @@ const sco = {
213
216
  document.documentElement.setAttribute('data-theme', newMode);
214
217
  utils.saveToLocal.set('theme', newMode, 0.02);
215
218
  utils.snackbarShow(GLOBAL_CONFIG.lang.theme[newMode], false, 2000);
216
- if(typeof rm === 'object') rm.mode(!isDarkMode) && rm.hideRightMenu();
219
+ if (typeof rm === 'object') rm.mode(!isDarkMode) && rm.hideRightMenu();
217
220
  handleThemeChange(newMode);
218
221
  },
219
222
  hideTodayCard: () => document.getElementById('todayCard').classList.add('hide'),
@@ -241,7 +244,7 @@ const sco = {
241
244
  inputs.forEach(selector => {
242
245
  const el = document.querySelector(selector);
243
246
  if (el) {
244
- el.dispatchEvent(new Event('input', { bubble: true, cancelable: true }));
247
+ el.dispatchEvent(new Event('input', {bubble: true, cancelable: true}));
245
248
  el.value = '> ' + txt.replace(/\n/g, '\n> ') + '\n\n';
246
249
  utils.scrollToDest(utils.getEleTop(document.getElementById('post-comment')), 300);
247
250
  el.focus();
@@ -298,11 +301,11 @@ const sco = {
298
301
  }
299
302
 
300
303
  const greetings = [
301
- { start: 0, end: 5, text: nick ? prefix : lang.goodnight },
302
- { start: 6, end: 10, text: nick ? prefix : lang.morning },
303
- { start: 11, end: 14, text: nick ? prefix : lang.noon },
304
- { start: 15, end: 18, text: nick ? prefix : lang.afternoon },
305
- { start: 19, end: 24, text: nick ? prefix : lang.night },
304
+ {start: 0, end: 5, text: nick ? prefix : lang.goodnight},
305
+ {start: 6, end: 10, text: nick ? prefix : lang.morning},
306
+ {start: 11, end: 14, text: nick ? prefix : lang.noon},
307
+ {start: 15, end: 18, text: nick ? prefix : lang.afternoon},
308
+ {start: 19, end: 24, text: nick ? prefix : lang.night},
306
309
  ];
307
310
  const greeting = greetings.find(g => hours >= g.start && hours <= g.end);
308
311
  el.innerText = greeting.text;
@@ -325,7 +328,7 @@ const sco = {
325
328
  categoriesBarActive() {
326
329
  const categoryBar = document.querySelector("#category-bar");
327
330
  const currentPath = decodeURIComponent(window.location.pathname);
328
- const isHomePage = currentPath === "/";
331
+ const isHomePage = currentPath === GLOBAL_CONFIG.root;
329
332
  if (categoryBar) {
330
333
  const categoryItems = categoryBar.querySelectorAll(".category-bar-item");
331
334
  categoryItems.forEach(item => item.classList.remove("select"));
@@ -343,9 +346,9 @@ const sco = {
343
346
  const isScrollBarAtEnd = () => scrollBar.scrollLeft + scrollBar.clientWidth >= scrollBar.scrollWidth - 8;
344
347
  const scroll = () => {
345
348
  if (isScrollBarAtEnd()) {
346
- scrollBar.scroll({ left: 0, behavior: "smooth" });
349
+ scrollBar.scroll({left: 0, behavior: "smooth"});
347
350
  } else {
348
- scrollBar.scrollBy({ left: scrollBar.clientWidth, behavior: "smooth" });
351
+ scrollBar.scrollBy({left: scrollBar.clientWidth, behavior: "smooth"});
349
352
  }
350
353
  };
351
354
  scrollBar.addEventListener("scroll", () => {
@@ -528,6 +531,7 @@ const addHighlight = () => {
528
531
  })
529
532
  }
530
533
  }
534
+
531
535
  class toc {
532
536
  static init() {
533
537
  const tocContainer = document.getElementById('card-toc')
@@ -544,11 +548,13 @@ class toc {
544
548
  })
545
549
  this.active(el)
546
550
  }
551
+
547
552
  static active(toc) {
548
553
  const $article = document.getElementById('article-container')
549
554
  const $tocContent = document.getElementById('toc-content')
550
555
  const list = $article.querySelectorAll('h1,h2,h3,h4,h5,h6')
551
556
  let detectItem = ''
557
+
552
558
  function autoScroll(el) {
553
559
  const activePosition = el.getBoundingClientRect().top
554
560
  const sidebarScrollTop = $tocContent.scrollTop
@@ -559,6 +565,7 @@ class toc {
559
565
  $tocContent.scrollTop = sidebarScrollTop - 150
560
566
  }
561
567
  }
568
+
562
569
  function findHeadPosition(top) {
563
570
  if (top === 0) return false
564
571
  let currentIndex = ''
@@ -582,6 +589,7 @@ class toc {
582
589
  }
583
590
  }
584
591
  }
592
+
585
593
  window.tocScrollFn = utils.throttle(function () {
586
594
  const currentTop = window.scrollY || document.documentElement.scrollTop
587
595
  findHeadPosition(currentTop)
@@ -589,11 +597,13 @@ class toc {
589
597
  window.addEventListener('scroll', tocScrollFn)
590
598
  }
591
599
  }
600
+
592
601
  class tabs {
593
602
  static init() {
594
603
  this.clickFnOfTabs();
595
604
  this.backToTop();
596
605
  }
606
+
597
607
  static clickFnOfTabs() {
598
608
  document.querySelectorAll('#article-container .tab > button').forEach((item) => {
599
609
  item.addEventListener('click', function (e) {
@@ -614,6 +624,7 @@ class tabs {
614
624
  });
615
625
  });
616
626
  }
627
+
617
628
  static backToTop() {
618
629
  document.querySelectorAll('#article-container .tabs .tab-to-top').forEach((item) => {
619
630
  item.addEventListener('click', function () {
@@ -621,11 +632,41 @@ class tabs {
621
632
  });
622
633
  });
623
634
  }
635
+
636
+ static lureAddListener() {
637
+ if (!GLOBAL_CONFIG.lure) return;
638
+ let title = document.title;
639
+ document.addEventListener('visibilitychange', () => {
640
+ const {lure} = GLOBAL_CONFIG;
641
+ if (document.visibilityState === 'hidden') {
642
+ document.title = lure.jump;
643
+ } else if (document.visibilityState === 'visible') {
644
+ document.title = lure.back;
645
+ setTimeout(() => {
646
+ document.title = title;
647
+ }, 2000);
648
+ }
649
+ });
650
+ }
651
+
652
+ static expireAddListener() {
653
+ const {expire} = GLOBAL_CONFIG;
654
+ if (!expire) return;
655
+ const post_date = document.querySelector('.post-meta-date time');
656
+ if (!post_date) return;
657
+ const ex = Math.ceil((new Date().getTime() - new Date(post_date.getAttribute('datetime')).getTime()) / 1000 / 60 / 60 / 24);
658
+ if (expire.time > ex) return;
659
+ const ele = document.createElement('div');
660
+ ele.className = 'expire';
661
+ ele.innerHTML = `<i class="solitude st-circle-exclamation-solid"></i>${expire.text_prev}${-(expire.time - ex)}${expire.text_next}`;
662
+ const articleContainer = document.getElementById('article-container');
663
+ articleContainer.insertAdjacentElement(expire.position === 'top' ? 'afterbegin' : 'beforeend', ele);
664
+ }
624
665
  }
625
666
 
626
667
  window.refreshFn = () => {
627
668
  const {is_home, is_page, page, is_post} = PAGE_CONFIG;
628
- const {runtime, lazyload, lightbox, randomlink, covercolor, post_ai} = GLOBAL_CONFIG;
669
+ const {runtime, lazyload, lightbox, randomlink, covercolor, post_ai, lure, expire} = GLOBAL_CONFIG;
629
670
  const timeSelector = (is_home ? '.post-meta-date time' : is_post ? '.post-meta-date time' : '.datatime') + ', .webinfo-item time';
630
671
  document.body.setAttribute('data-type', page);
631
672
  sco.changeTimeFormat(document.querySelectorAll(timeSelector));
@@ -637,13 +678,20 @@ window.refreshFn = () => {
637
678
  post_ai && is_post && efu_ai.init();
638
679
  sco.switchComments();
639
680
  initObserver();
640
- if (is_home) showTodayCard();
681
+ if (is_home){
682
+ showTodayCard();
683
+ typeof updatePostsBasedOnComments === 'function' && updatePostsBasedOnComments()
684
+ }
641
685
  if (is_post || is_page) {
642
686
  addHighlight();
643
687
  tabs.init();
644
688
  }
689
+ if (is_post) {
690
+ if (expire) tabs.expireAddListener();
691
+ }
645
692
  if (covercolor.enable) coverColor();
646
693
  if (PAGE_CONFIG.toc) toc.init();
694
+ if (lure) tabs.lureAddListener();
647
695
  }
648
696
  document.addEventListener('DOMContentLoaded', () => {
649
697
  [addCopyright, sco.initConsoleState, window.refreshFn, asideStatus, () => window.onscroll = percent].forEach(fn => fn());
@@ -654,7 +702,7 @@ document.addEventListener('visibilitychange', () => {
654
702
  }
655
703
  });
656
704
  window.onkeydown = e => {
657
- const { keyCode, ctrlKey, shiftKey } = e;
705
+ const {keyCode, ctrlKey, shiftKey} = e;
658
706
  if (keyCode === 123 || (ctrlKey && shiftKey && keyCode === 67)) {
659
707
  utils.snackbarShow(GLOBAL_CONFIG.lang.f12, false, 3000);
660
708
  }
package/.github/logo.svg DELETED
@@ -1,23 +0,0 @@
1
- <svg width="500px" height="500px" viewBox="0 0 500 500" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
2
- <defs>
3
- <radialGradient cx="50.2980052%" cy="50%" fx="50.2980052%" fy="50%" r="49.7019948%" id="radialGradient-1">
4
- <stop stop-color="#59A2EF" offset="0%"></stop>
5
- <stop stop-color="#1588FF" stop-opacity="0.265264551" offset="74.3273328%"></stop>
6
- <stop stop-color="#153C92" stop-opacity="0" offset="100%"></stop>
7
- </radialGradient>
8
- </defs>
9
- <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
10
- <g>
11
- <rect id="rectangle" fill="url(#radialGradient-1)" x="0" y="0" width="500" height="500" rx="250"></rect>
12
- <g id="group" transform="translate(167, 59)" fill="#000000" fill-rule="nonzero">
13
- <path d="M41.451978,366.819156 C63.2265115,314.167618 167.050853,309.635807 118.99746,228.707504 C153.639423,313.979396 6.78825531,314.963943 26.3287594,382 C12.5619158,361.643046 18.1905094,334.473897 37.7672802,320.255882 C54.8416479,307.145482 77.6751693,304.944731 94.4956701,291.066964 C124.038533,271.079215 120.593196,234.976751 96.7006861,211.861618 C96.0188719,211.181122 95.003404,210.544062 94.0822296,210.449951 C86.4807269,209.660866 78.8719708,208.915216 71.2487081,208.328832 C57.1699707,207.250174 43.5046739,208.806627 30.7315382,215.314771 C27.2426805,217.088403 23.7393162,218.348044 19.8007514,216.943617 C24.2397968,216.06042 28.6425756,215.162745 32.3272735,212.411806 C32.2692467,212.180148 32.2184733,211.948489 32.1604466,211.716831 C29.7523369,212.107754 27.6996411,213.041626 25.1537179,212.940276 C38.187974,204.006961 24.0149432,203.340944 16,204.796046 C43.9108611,184.243631 36.1280248,151.550884 84.6746446,161.273284 C101.270292,126.502854 113.695267,142.798552 133.649212,122 C130.261901,131.816511 125.583495,141.205903 121.347543,150.718363 C116.879484,161.895865 106.790085,163.495754 96.4178058,166.029514 C100.102504,164.921899 101.545919,167.404984 103.352001,169.641932 C129.057846,200.039816 157.962415,234.0284 155.895212,276.356675 C147.234722,323.376027 66.3744621,327.364889 41.451978,366.819156 L41.451978,366.819156 Z M71.3937749,171.88612 C61.1157889,177.641375 44.7957688,175.672282 47.1893718,192.474732 C52.5858584,180.23305 59.8754674,195.001253 71.3937749,171.88612 L71.3937749,171.88612 Z"></path>
14
- <path d="M75.3032249,211.025533 C106.026327,209.673873 112.009852,262.374155 89.125744,277.126764 C55.0225258,300.451933 -10.1418056,326.335859 20.1569835,378.551856 C19.9915736,378.703647 19.8333554,378.848209 19.6679454,379 C-9.82536916,354.648437 3.54407043,308.728139 30.8798638,288.53275 C55.238278,268.041007 100.157869,249.385209 75.3032249,211.025533 Z"></path>
15
- <path d="M131.122758,44.5611246 C140.518488,52.0520972 149.271959,60.2108697 155.377019,71.2803786 C171.087083,44.8006616 152.086349,16.9853448 131.534092,0 C163.329472,16.2086645 181.738463,59.2744981 151.913155,88.0552212 C133.150561,109.533698 83.0400028,127.861901 83.0688683,158 L70,158 C71.5587386,126.468232 104.321114,124.885836 92.9625284,113.344512 C85.81831,103.066201 82.6791837,91.7426379 83.3503072,78.4810034 C93.2511837,128.333716 119.56933,105.577709 144.877183,81.9216245 C153.58014,70.1480222 137.732964,54.0337208 131.122758,44.5683833 L131.122758,44.5611246 Z"></path>
16
- <path d="M62.2292659,56 C43.1451334,63.2999022 18.3176548,75.3501886 23.7278434,99.6686688 C30.7965771,99.1456907 37.8363406,98.6299763 44.876104,98.1069982 C44.9195594,98.4120687 44.9702573,98.7098757 45.0137126,99.0149462 C19.0853656,102.879173 29.4711895,111.580947 43.5145037,123.362481 C55.1822598,131.44685 65.3290794,100.736416 71,93.4946222 C67.581514,101.470038 64.1123302,109.423663 60.7735123,117.428132 C58.0503116,124.916888 53.6395956,131.149043 60.9400911,137.555525 C65.7491476,143.279229 67.4946034,149.874563 66.5313436,157.399637 C62.9680065,158.25674 59.3322439,159.12837 55.6747536,160 C60.3462016,135.11496 44.3763678,137.097919 29.5001597,123.34069 C-1.69352472,93.7706384 26.1903121,58.760162 62.2292659,56 Z"></path>
17
- <path d="M0.00732087227,143 C17.3943925,162.502948 36.3115265,145.13458 47,164.110998 C41.5898754,167.604594 37.7903427,172.386054 35.1401869,178 C21.3476636,175.47408 8.91682243,161.400081 0,143.007115 L0.00732087227,143 Z"></path>
18
- <path d="M29,207.557191 C25.5771332,208.185531 23.8692728,211.545785 20.9966372,212.980039 C16.6591005,213.184933 12.6502732,211.853125 12,207.092765 C17.6309374,206.703468 22.740227,206.355149 27.8495166,206 L29,207.550361 L29,207.557191 Z"></path>
19
- <path d="M66,177 C60.2942272,179.492077 52.7486034,178.10342 50,186 C56.264432,184.566305 62.8193669,184.123436 66,177 Z"></path>
20
- </g>
21
- </g>
22
- </g>
23
- </svg>
Binary file