hexo-theme-solitude 1.0.0 → 1.1.3

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 (125) hide show
  1. package/README.md +62 -20
  2. package/README_EN.md +98 -0
  3. package/_config.yml +162 -144
  4. package/layout/404.ejs +1 -1
  5. package/layout/layout.ejs +27 -32
  6. package/layout/page/about.ejs +3 -1
  7. package/layout/page/circle.ejs +1 -1
  8. package/layout/page/echarts.ejs +1 -14
  9. package/layout/page/links.ejs +2 -13
  10. package/layout/page/rss.ejs +10 -8
  11. package/layout/page/says.ejs +1 -0
  12. package/layout/partial/body.ejs +0 -1
  13. package/layout/partial/compoment/about/award.ejs +3 -1
  14. package/layout/partial/compoment/about/hobbies.ejs +44 -35
  15. package/layout/partial/compoment/about/other.ejs +68 -60
  16. package/layout/partial/compoment/aside/asideFlipCard.ejs +67 -3
  17. package/layout/partial/compoment/aside/asideHistory.ejs +49 -0
  18. package/layout/partial/compoment/aside/asideNewestPost.ejs +1 -1
  19. package/layout/partial/compoment/aside/asidePower.ejs +3 -3
  20. package/layout/partial/compoment/aside/asideSwitch.ejs +6 -0
  21. package/layout/partial/compoment/aside/asideToc.ejs +1 -1
  22. package/layout/partial/compoment/aside/asideWebInfo.ejs +8 -8
  23. package/layout/partial/compoment/aside/asideWelcome.ejs +33 -0
  24. package/layout/partial/compoment/circle/angle.ejs +2 -2
  25. package/layout/partial/compoment/circle/content.ejs +8 -11
  26. package/layout/partial/compoment/dorakika/rightmenu.ejs +90 -105
  27. package/layout/partial/compoment/hometop/bbTimeList.ejs +1 -1
  28. package/layout/partial/compoment/hometop/groupTag.ejs +1 -1
  29. package/layout/partial/compoment/hometop/topGroup.ejs +11 -18
  30. package/layout/partial/compoment/inject/body.ejs +20 -7
  31. package/layout/partial/compoment/inject/head.ejs +67 -3
  32. package/layout/partial/compoment/links/angle.ejs +26 -0
  33. package/layout/partial/compoment/links/banner.ejs +2 -2
  34. package/layout/partial/compoment/mixins/pagination.ejs +2 -2
  35. package/layout/partial/compoment/nav/right.ejs +6 -6
  36. package/layout/partial/compoment/post/award.ejs +30 -22
  37. package/layout/partial/compoment/post/copyright.ejs +10 -8
  38. package/layout/partial/compoment/post/postMeta.ejs +21 -19
  39. package/layout/partial/compoment/says/saysBottom.ejs +3 -3
  40. package/layout/partial/compoment/says/saysContent.ejs +0 -1
  41. package/layout/partial/compoment/says/saysFunction.ejs +15 -0
  42. package/layout/partial/compoment/third-party/comments/comment.ejs +1 -1
  43. package/layout/partial/compoment/third-party/comments/twikoo.ejs +2 -1
  44. package/layout/partial/compoment/third-party/search/algolia-search.ejs +2 -2
  45. package/layout/partial/compoment/third-party/search/local-search.ejs +2 -2
  46. package/layout/partial/console.ejs +10 -4
  47. package/layout/partial/footer.ejs +11 -9
  48. package/layout/partial/nav.ejs +2 -2
  49. package/layout/partial/sidebar.ejs +2 -2
  50. package/layout/post.ejs +19 -3
  51. package/package.json +4 -5
  52. package/scripts/event/welcome.js +6 -7
  53. package/scripts/helper/charts.js +45 -34
  54. package/scripts/helper/randomLinks.js +1 -1
  55. package/scripts/helper/related_post.js +11 -4
  56. package/scripts/helper/themeJsExport.js +12 -10
  57. package/scripts/tags/fold.js +2 -3
  58. package/scripts/tags/note.js +6 -2
  59. package/scripts/tags/tabs.js +2 -2
  60. package/source/css/main.css +79 -265
  61. package/source/css/search/algolia-search.css +1 -1
  62. package/source/css/search/local-search.css +1 -1
  63. package/source/css/var.css +3 -0
  64. package/source/img/default.png +0 -0
  65. package/source/img/error_load.png +0 -0
  66. package/source/img/logo-horizontal_version.png +0 -0
  67. package/source/img/pwa/16.png +0 -0
  68. package/source/img/pwa/180.png +0 -0
  69. package/source/img/pwa/192.png +0 -0
  70. package/source/img/pwa/32.png +0 -0
  71. package/source/img/pwa/512.png +0 -0
  72. package/source/img/pwa/logo.png +0 -0
  73. package/source/img/pwa/siteicon/splash-1125x2436.png +0 -0
  74. package/source/img/pwa/siteicon/splash-1136x640.png +0 -0
  75. package/source/img/pwa/siteicon/splash-1170x2532.png +0 -0
  76. package/source/img/pwa/siteicon/splash-1179x2556.png +0 -0
  77. package/source/img/pwa/siteicon/splash-1242x2208.png +0 -0
  78. package/source/img/pwa/siteicon/splash-1242x2688.png +0 -0
  79. package/source/img/pwa/siteicon/splash-1248x2778.png +0 -0
  80. package/source/img/pwa/siteicon/splash-1290x2796.png +0 -0
  81. package/source/img/pwa/siteicon/splash-1334x750.png +0 -0
  82. package/source/img/pwa/siteicon/splash-1536x2048.png +0 -0
  83. package/source/img/pwa/siteicon/splash-1620x2160.png +0 -0
  84. package/source/img/pwa/siteicon/splash-1668x2224.png +0 -0
  85. package/source/img/pwa/siteicon/splash-1668x2388.png +0 -0
  86. package/source/img/pwa/siteicon/splash-1792x828.png +0 -0
  87. package/source/img/pwa/siteicon/splash-2048x1536.png +0 -0
  88. package/source/img/pwa/siteicon/splash-2048x2732.png +0 -0
  89. package/source/img/pwa/siteicon/splash-2160x1620.png +0 -0
  90. package/source/img/pwa/siteicon/splash-2208x1242.png +0 -0
  91. package/source/img/pwa/siteicon/splash-2224x1668.png +0 -0
  92. package/source/img/pwa/siteicon/splash-2388x1668.png +0 -0
  93. package/source/img/pwa/siteicon/splash-2436x1125.png +0 -0
  94. package/source/img/pwa/siteicon/splash-2532x1170.png +0 -0
  95. package/source/img/pwa/siteicon/splash-2556x1179.png +0 -0
  96. package/source/img/pwa/siteicon/splash-2688x1242.png +0 -0
  97. package/source/img/pwa/siteicon/splash-2732x2048.png +0 -0
  98. package/source/img/pwa/siteicon/splash-2778x1248.png +0 -0
  99. package/source/img/pwa/siteicon/splash-2796x1290.png +0 -0
  100. package/source/img/pwa/siteicon/splash-640x1136.png +0 -0
  101. package/source/img/pwa/siteicon/splash-750x1334.png +0 -0
  102. package/source/img/pwa/siteicon/splash-828x1792.png +0 -0
  103. package/source/img/solitude-show.jpg +0 -0
  104. package/source/js/commentBarrage.js +145 -136
  105. package/source/js/extend/covercolor/local.js +104 -94
  106. package/source/js/extend/search/algolia-search.js +11 -0
  107. package/source/js/extend/search/local-search.js +12 -1
  108. package/source/js/main.js +212 -27
  109. package/source/js/rightmenu.js +402 -0
  110. package/source/js/txmap.js +236 -0
  111. package/source/lib/chuckle-post-ai.js +1 -0
  112. package/source/lib/circle.min.js +1 -0
  113. package/source/lib/friends_post.js +4 -98
  114. package/source/lib/snackbar.min.js +9 -0
  115. package/source/lib/view-image.min.js +6 -0
  116. package/scripts/filter/katex.js +0 -25
  117. package/scripts/tags/expand.js +0 -4
  118. package/source/img/power.png +0 -0
  119. package/source/js/circle.js +0 -1828
  120. package/source/js/extend/covercolor/web.js +0 -137
  121. package/source/js/post_ai.js +0 -517
  122. package/source/lib/snackbar.js +0 -16
  123. package/source/lib/view-image.js +0 -13
  124. /package/source/lib/{bundle.js → bundle.min.js} +0 -0
  125. /package/source/lib/{lazyload.js → lazyload.min.js} +0 -0
package/source/js/main.js CHANGED
@@ -1,12 +1,12 @@
1
1
  function set_fest() {
2
2
  let date = new Date();
3
- switch ((date.getMonth() + 1).toString() + '.' + date.getDate()){
3
+ switch ((date.getMonth() + 1).toString() + '.' + date.getDate()) {
4
4
  case '1.8': // 周总理逝世
5
5
  case '9.9': // 毛主席逝世
6
6
  case '7.7': // 七七事变
7
7
  case '9.18': // 九一八事变
8
8
  case '12.13': // 南京大屠杀国家公祭日
9
- {
9
+ {
10
10
  // 创建一个<style>元素
11
11
  const styleElement = document.createElement('style');
12
12
  // 定义要添加的CSS样式
@@ -24,7 +24,8 @@ function set_fest() {
24
24
  styleElement.appendChild(document.createTextNode(css));
25
25
  // 将<style>元素添加到<head>标签中
26
26
  document.head.appendChild(styleElement);
27
- }break;
27
+ }
28
+ break;
28
29
  }
29
30
  }
30
31
 
@@ -338,6 +339,117 @@ class toc {
338
339
  let lastSayHello = "";
339
340
 
340
341
  class sco {
342
+ /**
343
+ * 个性定位
344
+ */
345
+ static card_welcome() {
346
+ /**
347
+ * 请求数据
348
+ */
349
+ ipLoacation = window.saveToLocal.get('ipLocation');
350
+ if (ipLoacation) {
351
+ // 使用 ipLocation
352
+
353
+ } else {
354
+ // 数据已过期或不存在
355
+ var script = document.createElement('script');
356
+ var url = `https://apis.map.qq.com/ws/location/v1/ip?key=${txkey}&output=jsonp`;
357
+ script.src = url;
358
+ window.QQmap = function (data) {
359
+ ipLoacation = data;
360
+ // 将数据保存到 localStorage,过期时间设置为 1 天
361
+ window.saveToLocal.set('ipLocation', ipLoacation, 1);
362
+ document.body.removeChild(script);
363
+ delete window.QQmap;
364
+ };
365
+ document.body.appendChild(script);
366
+ }
367
+ showWelcome();
368
+ }
369
+
370
+ /**
371
+ * 那年今日
372
+ * @type {*}
373
+ */
374
+ static card_history() {
375
+ if (document.getElementById('history-container')) {
376
+ function append(parent, text) {
377
+ if (typeof text === 'string') {
378
+ let temp = document.createElement('div');
379
+ temp.innerHTML = text;
380
+ // 防止元素太多 进行提速
381
+ let frag = document.createDocumentFragment();
382
+ while (temp.firstChild) {
383
+ frag.appendChild(temp.firstChild);
384
+ }
385
+ parent.appendChild(frag);
386
+ } else {
387
+ parent.appendChild(text);
388
+ }
389
+ }
390
+
391
+ let history_data = sco.history_get_data()
392
+ fetch(history_data[0])
393
+ .then(data => data.json())
394
+ .then(data => {
395
+ let html_item = ''
396
+ for (let item of data[history_data[1]]) {
397
+ html_item += '<div class="swiper-slide history_slide"><span class="history_slide_time">A.D.' +
398
+ item.year + '</span>' + '<span class="history_slide_link">' + item.title + '</span></div>'
399
+
400
+ }
401
+ var history_container_wrapper = document.getElementById('history_container_wrapper')
402
+ append(history_container_wrapper, html_item);
403
+ var swiper_history = new Swiper('.history_swiper-container', {
404
+ passiveListeners: true,
405
+ spaceBetween: 30,
406
+ effect: 'coverflow',
407
+ coverflowEffect: {
408
+ rotate: 30,
409
+ slideShadows: false,
410
+ },
411
+ loop: true,
412
+ direction: 'vertical',
413
+ autoplay: {
414
+ disableOnInteraction: true,
415
+ delay: 5000
416
+ },
417
+
418
+ mousewheel: false,
419
+ // autoHeight: true,
420
+
421
+ });
422
+
423
+ let history_comtainer = document.getElementById('history-container');
424
+ history_comtainer.onmouseenter = function () {
425
+ swiper_history.autoplay.stop();
426
+ };
427
+ history_comtainer.onmouseleave = function () {
428
+ swiper_history.autoplay.start();
429
+ }
430
+ })
431
+ }
432
+ }
433
+
434
+ static history_get_data() {
435
+ let myDate = new Date();
436
+ let myMonth = myDate.getMonth() + 1;
437
+ let getMonth;
438
+ if (myMonth < 10) {
439
+ getMonth = "0" + String(myMonth);
440
+ } else {
441
+ getMonth = String(myMonth);
442
+ }
443
+ let getDate = String(myDate.getDate());
444
+ if (getDate < 10) {
445
+ getDate = "0" + String(getDate);
446
+ } else {
447
+ getDate = String(getDate);
448
+ }
449
+ let getMonthDate = "S" + getMonth + getDate;
450
+ return ["https://cdn.meuicat.com/gh/Zfour/Butterfly-card-history@2.08/" + getMonth + ".json", getMonthDate]
451
+ }
452
+
341
453
  /*
342
454
  * 隐藏协议提醒助手
343
455
  */
@@ -389,6 +501,17 @@ class sco {
389
501
  }
390
502
  }
391
503
 
504
+ static switchHideAside() {
505
+ const e = document.documentElement.classList;
506
+ e.contains("hide-aside") ? saveToLocal.set("aside-status", "show", 2) : saveToLocal.set("aside-status", "hide", 2),
507
+ e.toggle("hide-aside"),
508
+ e.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on")
509
+ }
510
+
511
+ static initConsoleState() {
512
+ document.documentElement.classList.contains("hide-aside") ? document.querySelector("#consoleHideAside").classList.add("on") : document.querySelector("#consoleHideAside").classList.remove("on")
513
+ }
514
+
392
515
  static sayhi() {
393
516
  document.querySelector("#author-info__sayhi") && (document.getElementById("author-info__sayhi").innerHTML = getTimeState())
394
517
  }
@@ -408,12 +531,14 @@ class sco {
408
531
  'light'
409
532
  if (nowMode === 'light') {
410
533
  document.documentElement.setAttribute('data-theme', 'dark')
411
- localStorage.setItem('theme', 'dark')
534
+ saveToLocal.set('theme', 'dark', 0.04);
412
535
  utils.snackbarShow(GLOBALCONFIG.lang.theme.dark, false, 2000)
536
+ document.querySelector(".menu-darkmode-text").textContent = "深色模式";
413
537
  } else {
414
538
  document.documentElement.setAttribute('data-theme', 'light')
415
- localStorage.setItem('theme', 'light')
539
+ saveToLocal.set('theme', 'light', 0.04);
416
540
  utils.snackbarShow(GLOBALCONFIG.lang.theme.light, false, 2000)
541
+ document.querySelector(".menu-darkmode-text").textContent = "浅色模式";
417
542
  }
418
543
  }
419
544
 
@@ -439,29 +564,29 @@ class sco {
439
564
  }
440
565
  }
441
566
 
442
- static copyPageUrl() {
443
- utils.copy(window.location.href)
444
- }
445
-
446
567
  static lightbox(el) {
447
568
  window.ViewImage && window.ViewImage.init("#article-container img:not(.flink-avatar), .bber-content-img img, #album_detail img, #equipment img, #twikoo .tk-content img:not(.tk-owo-emotion)");
448
569
  }
449
570
 
450
571
  static initTheme() {
451
572
  const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
452
- const cachedMode = localStorage.getItem('theme');
453
- const isLightMode = !isDarkMode;
454
-
455
- const nowMode =
456
- cachedMode && (cachedMode === 'dark' || cachedMode === 'light')
457
- ? cachedMode === 'dark' && isLightMode ? 'light'
458
- : cachedMode === 'light' && isDarkMode ? 'dark'
459
- : cachedMode
460
- : isDarkMode ? 'dark'
461
- : 'light';
462
-
463
- document.documentElement.setAttribute('data-theme', nowMode);
464
- localStorage.setItem('theme', nowMode);
573
+ try {
574
+ const cachedMode = saveToLocal.get('theme');
575
+ if (cachedMode === undefined) {
576
+ const nowMode =
577
+ isDarkMode ? 'dark' : 'light'
578
+ document.documentElement.setAttribute('data-theme', nowMode);
579
+ saveToLocal.set('theme', nowMode, 0.5);
580
+ } else {
581
+ document.documentElement.setAttribute('data-theme', cachedMode);
582
+ }
583
+ } catch (e) {
584
+ if (isDarkMode) {
585
+ saveToLocal.set('theme', 'dark', 0.5)
586
+ } else {
587
+ saveToLocal.set('theme', 'light', 0.5)
588
+ }
589
+ }
465
590
  }
466
591
 
467
592
  static reflashEssayWaterFall() {
@@ -535,6 +660,39 @@ class sco {
535
660
  });
536
661
  }
537
662
 
663
+ /*
664
+ * 图片加水印
665
+ */
666
+ static downloadImage(e, t) {
667
+ rm.hideRightMenu();
668
+ if (0 == rm.downloadimging) {
669
+ rm.downloadimging = !0;
670
+ utils.snackbarShow("正在下载中,请稍后", !1, 1e4);
671
+ setTimeout((function () {
672
+ let o = new Image;
673
+ o.setAttribute("crossOrigin", "anonymous");
674
+ o.onload = function () {
675
+ let e = document.createElement("canvas");
676
+ e.width = o.width;
677
+ e.height = o.height;
678
+ e.getContext("2d").drawImage(o, 0, 0, o.width, o.height);
679
+ let n = e.toDataURL("image/png");
680
+ let a = document.createElement("a");
681
+ let l = new MouseEvent("click");
682
+ a.download = t || "photo";
683
+ a.href = n;
684
+ a.dispatchEvent(l);
685
+ };
686
+ o.src = e;
687
+ utils.snackbarShow("图片已添加盲水印,请遵守版权协议");
688
+ rm.downloadimging = !1;
689
+ }), "10000");
690
+ } else {
691
+ utils.snackbarShow("有正在进行中的下载,请稍后再试");
692
+ }
693
+ }
694
+
695
+
538
696
  static musicToggle() {
539
697
  const $music = document.querySelector('#nav-music'),
540
698
  $meting = document.querySelector('meting-js'),
@@ -544,12 +702,34 @@ class sco {
544
702
  $console.classList.remove("on")
545
703
  wleelw_musicPlaying = false;
546
704
  $meting.aplayer.pause();
705
+ document.getElementById('menu-music-toggle').innerHTML = `<i class="scoicon sco-play-fill"></i><span>播放音乐</span>`
547
706
  } else {
548
707
  $music.classList.add("playing")
549
708
  $console.classList.add("on")
550
709
  wleelw_musicPlaying = true;
551
710
  $meting.aplayer.play();
711
+ document.getElementById('menu-music-toggle').innerHTML = `<i class="scoicon sco-pause-fill"></i><span>暂停音乐</span>`
712
+ }
713
+ rm.hideRightMenu()
714
+ }
715
+
716
+ static musicSkipBack() {
717
+ document.querySelector('meting-js').aplayer.skipBack()
718
+ rm.hideRightMenu()
719
+ }
720
+
721
+ static musicSkipForward() {
722
+ document.querySelector('meting-js').aplayer.skipForward()
723
+ rm.hideRightMenu()
724
+ }
725
+
726
+ static musicGetName() {
727
+ var e = document.querySelectorAll('.aplayer-title');
728
+ var t = [];
729
+ for (var o = e.length - 1; o >= 0; o--) {
730
+ t[o] = e[o].innerText;
552
731
  }
732
+ return t[0];
553
733
  }
554
734
 
555
735
  static scrollToComment() {
@@ -560,8 +740,8 @@ class sco {
560
740
  class hightlight {
561
741
  static createEle(langEl, item) {
562
742
  const fragment = document.createDocumentFragment()
563
- const highlightCopyEle = '<i class="ri-file-copy-fill"></i>'
564
- const highlightExpandEle = '<i class="ri-arrow-down-s-line expand" style="font-size: 16px"></i>'
743
+ const highlightCopyEle = '<i class="scoicon sco-copy-fill"></i>'
744
+ const highlightExpandEle = '<i class="scoicon sco-arrow-down expand" style="font-size: 16px"></i>'
565
745
 
566
746
  const hlTools = document.createElement('div')
567
747
  hlTools.className = `highlight-tools`
@@ -581,7 +761,7 @@ class hightlight {
581
761
  $expand[0].setAttribute('style', 'display:block')
582
762
  }
583
763
  if (itemHeight < 200) {
584
- $table.setAttribute('style', 'height:' + itemHeight + "px")
764
+ $table.setAttribute('style', 'height: auto')
585
765
  } else {
586
766
  $table.setAttribute('style', 'height:200px')
587
767
  ele.classList.remove("expand-done")
@@ -599,7 +779,7 @@ class hightlight {
599
779
  if (GLOBALCONFIG.hightlight.limit && itemHeight > GLOBALCONFIG.hightlight.limit + 30) {
600
780
  $table.setAttribute('style', `height: ${GLOBALCONFIG.hightlight.limit}px`)
601
781
  ele.className = 'code-expand-btn'
602
- ele.innerHTML = '<i class="ri-arrow-down-double-fill" style="font-size: 1.2rem"></i>'
782
+ ele.innerHTML = '<i class="scoicon sco-show-line" style="font-size: 1.2rem"></i>'
603
783
  ele.addEventListener('click', (e) => {
604
784
  $table.setAttribute('style', `height: ${itemHeight}px`)
605
785
  e.target.className !== 'code-expand-btn' ? e.target.parentNode.classList.add('expand-done') : e.target.classList.add('expand-done')
@@ -668,6 +848,7 @@ window.refreshFn = () => {
668
848
  sco.hideCookie()
669
849
  sco.addPhotoFigcaption()
670
850
  sco.sayhi()
851
+ addRightMenuClickEvent()
671
852
  GLOBALCONFIG.lazyload.enable && sco.lazyloadImg()
672
853
  GLOBALCONFIG.lightbox && sco.lightbox('')
673
854
  GLOBALCONFIG.randomlinks && randomLinksList()
@@ -687,6 +868,10 @@ window.refreshFn = () => {
687
868
  }
688
869
  GLOBALCONFIG.covercolor && coverColor();
689
870
  set_fest()
871
+ sco.initConsoleState()
872
+ if (document.getElementById('history-baidu')) sco.card_history() // 那年今日
873
+ if (document.getElementById('welcome-info')) sco.card_welcome() // 个性定位
874
+ if (GLOBALCONFIG.comment.enable) initializeCommentBarrage() // 热评
690
875
  }
691
876
 
692
877
  sco.initTheme()
@@ -702,4 +887,4 @@ document.addEventListener('pjax:complete', () => {
702
887
 
703
888
  window.onkeydown = function (e) {
704
889
  123 === e.keyCode && utils.snackbarShow("开发者模式已打开,请遵循GPL协议", !1, 3e3)
705
- }
890
+ };