hexo-theme-solitude 1.11.2 → 1.12.0

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 (51) hide show
  1. package/CONTRIBUTING.md +1 -1
  2. package/README.md +5 -3
  3. package/README_en-US.md +11 -11
  4. package/README_zh-Hant.md +10 -10
  5. package/SECURITY.md +1 -1
  6. package/_config.yml +48 -36
  7. package/languages/default.yml +3 -1
  8. package/languages/en.yml +3 -1
  9. package/languages/zh-CN.yml +2 -0
  10. package/languages/zh-TW.yml +2 -0
  11. package/layout/includes/console.pug +4 -3
  12. package/layout/includes/head/config.pug +1 -0
  13. package/layout/includes/inject/body.pug +0 -3
  14. package/layout/includes/inject/head.pug +2 -2
  15. package/layout/includes/widgets/aside/asideNewstComments.pug +9 -0
  16. package/layout/includes/widgets/aside/asideSwitch.pug +2 -0
  17. package/layout/includes/widgets/third-party/comments/artalk.pug +1 -1
  18. package/layout/includes/widgets/third-party/comments/comment.pug +3 -1
  19. package/layout/includes/widgets/third-party/comments/giscus.pug +60 -0
  20. package/layout/includes/widgets/third-party/comments/js.pug +3 -1
  21. package/layout/includes/widgets/third-party/news-comment/artalk.pug +10 -12
  22. package/layout/includes/widgets/third-party/news-comment/newest-comment.pug +6 -5
  23. package/layout/includes/widgets/third-party/news-comment/twikoo.pug +9 -9
  24. package/layout/includes/widgets/third-party/news-comment/valine.pug +8 -7
  25. package/layout/includes/widgets/third-party/news-comment/waline.pug +8 -7
  26. package/package.json +3 -3
  27. package/scripts/event/merge_config.js +17 -16
  28. package/scripts/event/welcome.js +1 -1
  29. package/scripts/filter/default.js +2 -2
  30. package/source/css/_highlight/index.styl +1 -1
  31. package/source/css/_layout/aside.styl +53 -6
  32. package/source/css/_layout/console.styl +3 -79
  33. package/source/css/_page/message.styl +2 -1
  34. package/source/css/_post/meta.styl +4 -14
  35. package/source/css/_post/tools.styl +7 -2
  36. package/source/css/_search/local-search.styl +4 -0
  37. package/source/img/404.avif +0 -0
  38. package/source/img/avatar.avif +0 -0
  39. package/source/img/default.avif +0 -0
  40. package/source/img/error_load.avif +0 -0
  41. package/source/img/happy-sticker.avif +0 -0
  42. package/source/img/loading.avif +0 -0
  43. package/source/img/recent_c.avif +0 -0
  44. package/source/js/main.js +15 -12
  45. package/source/js/utils.js +8 -0
  46. package/source/img/404.webp +0 -0
  47. package/source/img/avatar.png +0 -0
  48. package/source/img/default.png +0 -0
  49. package/source/img/error_load.webp +0 -0
  50. package/source/img/happy-sticker.png +0 -0
  51. package/source/img/loading.gif +0 -0
package/source/js/main.js CHANGED
@@ -329,7 +329,7 @@ let sco = {
329
329
  */
330
330
  addRuntime: function () {
331
331
  let el = document.getElementById('runtimeshow')
332
- el && GLOBAL_CONFIG.runtime && (el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.time.day)
332
+ el && GLOBAL_CONFIG.runtime && (el.innerText = utils.timeDiff(new Date(GLOBAL_CONFIG.runtime), new Date()) + GLOBAL_CONFIG.lang.day)
333
333
  },
334
334
  /**
335
335
  * toTalk
@@ -775,17 +775,20 @@ class tabs {
775
775
  }
776
776
 
777
777
  static clickFnOfTabs() {
778
- document.querySelectorAll('#article-container .tab > button').forEach(item => {
779
- item.addEventListener('click', e => {
780
- const $tabItem = e.target.parentNode
778
+ document.querySelectorAll('#article-container .tab > button').forEach(function (item) {
779
+ item.addEventListener('click', function (e) {
780
+ const that = this
781
+ const $tabItem = that.parentNode
781
782
  if (!$tabItem.classList.contains('active')) {
782
783
  const $tabContent = $tabItem.parentNode.nextElementSibling
783
- const $siblings = $tabItem.parentNode.querySelector('.active')
784
+ const $siblings = utils.siblings($tabItem, '.active')[0]
784
785
  $siblings && $siblings.classList.remove('active')
785
786
  $tabItem.classList.add('active')
786
- const tabId = e.target.getAttribute('data-href').replace('#', '')
787
- Array.from($tabContent.children).forEach(item => {
788
- item.id === tabId ? item.classList.add('active') : item.classList.remove('active')
787
+ const tabId = that.getAttribute('data-href').replace('#', '')
788
+ const childList = [...$tabContent.children]
789
+ childList.forEach(item => {
790
+ if (item.id === tabId) item.classList.add('active')
791
+ else item.classList.remove('active')
789
792
  })
790
793
  }
791
794
  })
@@ -793,14 +796,14 @@ class tabs {
793
796
  }
794
797
 
795
798
  static backToTop() {
796
- document.querySelectorAll('#article-container .tabs .tab-to-top').forEach(item => {
797
- item.addEventListener('click', () => {
798
- utils.scrollToDest(utils.getEleTop(item.closest('.tabs')), 300)
799
+ document.querySelectorAll('#article-container .tabs .tab-to-top').forEach(function (item) {
800
+ item.addEventListener('click', function () {
801
+ utils.scrollToDest(utils.getEleTop(item.parentElement.parentElement.parentNode), 300)
802
+
799
803
  })
800
804
  })
801
805
  }
802
806
  }
803
-
804
807
  // 页面刷新
805
808
  window.refreshFn = () => {
806
809
  const {is_home, is_page, page, is_post} = PAGE_CONFIG;
@@ -59,6 +59,14 @@
59
59
  }
60
60
  return actualTop;
61
61
  },
62
+ siblings: (ele, selector) => {
63
+ return [...ele.parentNode.children].filter((child) => {
64
+ if (selector) {
65
+ return child !== ele && child.matches(selector)
66
+ }
67
+ return child !== ele
68
+ })
69
+ },
62
70
  randomNum: (length) => {
63
71
  return Math.floor(Math.random() * length)
64
72
  },
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file