hexo-theme-solitude 2.1.3 → 2.1.5

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 (39) hide show
  1. package/README.md +25 -39
  2. package/{README_zh-Hans.md → README_en-US.md} +25 -39
  3. package/README_zh-Hant.md +5 -19
  4. package/_config.yml +28 -28
  5. package/languages/default.yml +2 -0
  6. package/languages/en.yml +2 -0
  7. package/languages/zh-CN.yml +2 -0
  8. package/languages/zh-TW.yml +2 -0
  9. package/layout/includes/footer.pug +30 -29
  10. package/layout/includes/head/config.pug +2 -1
  11. package/layout/includes/keyboard.pug +2 -1
  12. package/layout/includes/widgets/aside/asideInfoCard.pug +2 -2
  13. package/layout/includes/widgets/home/topGroup.pug +15 -13
  14. package/layout/includes/widgets/rightside/hide.pug +4 -1
  15. package/layout/includes/widgets/rightside/show.pug +3 -0
  16. package/layout/includes/widgets/third-party/music.pug +3 -3
  17. package/layout/includes/widgets/third-party/search/algolia-search.pug +3 -0
  18. package/layout/post.pug +2 -1
  19. package/package.json +1 -1
  20. package/plugins.yml +7 -7
  21. package/scripts/event/merge_config.js +1 -0
  22. package/scripts/event/page.js +3 -3
  23. package/scripts/filter/default.js +3 -1
  24. package/scripts/tags/typeit.js +2 -3
  25. package/source/css/_global/function.styl +4 -0
  26. package/source/css/_global/index.styl +8 -0
  27. package/source/css/_layout/aside.styl +2 -2
  28. package/source/css/_layout/capsule.styl +228 -217
  29. package/source/css/_page/_home/category-bar.styl +1 -0
  30. package/source/css/_page/_home/home.styl +5 -0
  31. package/source/css/_page/links.styl +16 -2
  32. package/source/css/_post/pagination.styl +1 -1
  33. package/source/css/_search/algolia-search.styl +23 -16
  34. package/source/css/_search/local-search.styl +11 -11
  35. package/source/css/_tags/gallery.styl +0 -1
  36. package/source/js/main.js +42 -13
  37. package/source/js/right_menu.js +2 -2
  38. package/source/js/search/algolia.js +16 -15
  39. package/source/js/search/local.js +11 -14
@@ -253,9 +253,10 @@
253
253
 
254
254
  +maxWidth768()
255
255
  width calc(50% - 12px)
256
+ height: 120px
256
257
 
257
- +maxWidth600()
258
- width calc(100% - 12px)
258
+ a
259
+ flex-direction: column
259
260
 
260
261
  a
261
262
  display flex
@@ -286,6 +287,19 @@
286
287
  height fit-content
287
288
  padding 0 4px
288
289
 
290
+ +maxWidth768()
291
+ align-items center
292
+ width 100%
293
+
294
+ .flink-item-name
295
+ padding: 0
296
+ width: 100%
297
+ text-align: center
298
+ font-size: 14px
299
+
300
+ .flink-item-desc
301
+ display: none
302
+
289
303
  span
290
304
  transition .3s
291
305
 
@@ -19,7 +19,7 @@
19
19
  width 300px
20
20
  bottom -100px
21
21
  right 20px
22
- z-index 7
22
+ z-index 12
23
23
  height fit-content
24
24
  transition cubic-bezier(.42, 0, .3, 1.11) .3s
25
25
  border var(--style-border)
@@ -7,12 +7,14 @@
7
7
  margin-left -15rem
8
8
  padding 1rem
9
9
  width 30rem
10
+ flex-direction column
10
11
  box-shadow var(--efu-shadow-lightblack)
11
12
  background var(--efu-card-bg)
12
13
  border var(--style-border)
13
14
  transition 0.3s
14
15
  border-radius 8px
15
16
  animation slide-in .6s ease 0s 1 normal none running
17
+ gap: 16px
16
18
 
17
19
  &:hover
18
20
  border var(--style-border-hover)
@@ -31,12 +33,10 @@
31
33
  .algolia-navbar
32
34
  display flex
33
35
  align-items center
34
- margin-bottom 8px
35
36
 
36
37
  .search-close-button
37
- position absolute
38
- top 0.8rem
39
- right 1rem
38
+ margin-left: 4px
39
+ padding 4px
40
40
  color var(--efu-gray)
41
41
  font-size 1.4em
42
42
  line-height 1
@@ -49,9 +49,6 @@
49
49
  .algolia-tips-text
50
50
  margin-left .4rem
51
51
 
52
- #algolia-input-panel
53
- margin-bottom 8px
54
-
55
52
  .search-box, .ais-SearchBox
56
53
  padding-top 8px
57
54
  max-width 100%
@@ -77,7 +74,6 @@
77
74
  visibility hidden
78
75
 
79
76
  #search-results
80
- padding-top 8px
81
77
  max-height calc(80vh - 130px)
82
78
  overflow-y auto
83
79
 
@@ -86,9 +82,7 @@
86
82
 
87
83
  .ais-Hits-list
88
84
  padding 0
89
-
90
- .ais-Hits-item
91
- margin 10px 0
85
+ margin 0
92
86
 
93
87
  .algolia-hit-item-content
94
88
  margin 0
@@ -104,17 +98,21 @@
104
98
  overflow hidden
105
99
  font-weight bold
106
100
 
101
+ &:hover
102
+ color var(--efu-main)
103
+
104
+ .ais-Stats-text
105
+ font-size 12px
106
+
107
107
  mark
108
108
  color var(--efu-theme)
109
109
  font-style normal
110
110
  background var(--efu-card-bg)
111
111
 
112
112
  .ais-Hits--empty
113
- text-align center
114
113
  font-weight 600
115
114
 
116
115
  .ais-Pagination-list
117
- margin 0.2rem 0 0
118
116
  padding 0
119
117
  text-align center
120
118
 
@@ -134,15 +132,13 @@
134
132
 
135
133
  .search-dialog__title
136
134
  font-weight 700
137
- padding 0 0 0.7rem
138
135
  color var(--efu-main)
139
136
  font-size 1.4em
140
137
  line-height 1
141
138
 
142
139
  #algolia-tips
143
- padding-top 12px
144
140
  color var(--efu-secondtext)
145
- right 0
141
+ width 100%
146
142
  margin auto
147
143
 
148
144
  .algolia-tips-text
@@ -173,3 +169,14 @@
173
169
 
174
170
  .ais-Pagination-item--selected a
175
171
  background var(--efu-main)
172
+
173
+ .algolia-tips
174
+ color: var(--efu-secondtext);
175
+ margin-left: auto;
176
+ opacity: .8;
177
+
178
+ i
179
+ font-size: 18px
180
+
181
+ #algolia-search .search-dialog .ais-SearchBox-input::placeholder
182
+ opacity: .6
@@ -13,6 +13,8 @@
13
13
  transition 0.3s
14
14
  border-radius 8px
15
15
  animation slide-in .6s ease 0s 1 normal none running
16
+ gap 16px
17
+ flex-direction: column
16
18
 
17
19
  &:hover
18
20
  border var(--style-border-hover)
@@ -31,14 +33,10 @@
31
33
  .search-dialog-title
32
34
  font-weight 700
33
35
  color var(--efu-main)
34
- padding 0 0 0.7rem
35
36
  font-size 1.4em
36
37
  line-height 1
37
38
 
38
39
  .search-close-button
39
- position absolute
40
- top 0.8rem
41
- right 1rem
42
40
  color var(--efu-gray)
43
41
  font-size 1.4em
44
42
  line-height 1
@@ -77,7 +75,6 @@
77
75
 
78
76
  #search-pagination
79
77
  .pagination-list
80
- margin 0.2rem 0 0
81
78
  padding 0
82
79
  text-align center
83
80
 
@@ -103,13 +100,13 @@
103
100
  color var(--efu-white)
104
101
 
105
102
  #search-tips
106
- padding-top 12px
107
103
  color var(--efu-secondtext)
108
104
  right 0
109
105
  margin auto
110
106
 
111
107
  .search-result-count
112
108
  color var(--efu-gray)
109
+ font-size 12px
113
110
 
114
111
  b
115
112
  color var(--efu-main)
@@ -119,8 +116,6 @@
119
116
  margin 0 auto
120
117
  max-width 100%
121
118
  width 100%
122
- padding-top 8px
123
- padding-bottom 8px
124
119
 
125
120
  input
126
121
  height 100%
@@ -133,9 +128,9 @@
133
128
  color var(--efu-fontcolor)
134
129
  caret-color var(--efu-theme)
135
130
 
136
- ::placeholder
131
+ &::placeholder
137
132
  color var(--efu-gray)
138
- opacity .5
133
+ opacity .8
139
134
 
140
135
  #search-mask
141
136
  position fixed
@@ -158,4 +153,9 @@
158
153
 
159
154
  &:hover
160
155
  background var(--efu-main)
161
- color var(--efu-white)
156
+ color var(--efu-white)
157
+
158
+ .search-nav
159
+ display: flex
160
+ justify-content: space-between
161
+ align-content: center
@@ -1,7 +1,6 @@
1
1
  #article-container
2
2
  figure.gallery-group
3
3
  position: relative
4
- float: left
5
4
  overflow: hidden
6
5
  margin: 0
7
6
  width: calc(50% - 8px)
package/source/js/main.js CHANGED
@@ -150,23 +150,52 @@ const sco = {
150
150
  });
151
151
  }
152
152
  },
153
- musicToggle() {
154
- const $music = document.querySelector('#nav-music') || null;
155
- const $meting = document.querySelector('meting-js') || null;
156
- const $console = document.getElementById('consoleMusic') || null;
157
- const $rm_text = document.querySelector('#menu-music-toggle span') || null;
158
- const $rm_icon = document.querySelector('#menu-music-toggle i') || null;
153
+ musicToggle(isMeting = true) {
154
+ if (!this.isMusicBind) {
155
+ this.musicBind();
156
+ }
157
+ const $music = document.querySelector('#nav-music');
158
+ const $meting = document.querySelector('meting-js');
159
+ const $console = document.getElementById('consoleMusic');
160
+ const $rmText = document.querySelector('#menu-music-toggle span');
161
+ const $rmIcon = document.querySelector('#menu-music-toggle i');
162
+
159
163
  this.musicPlaying = !this.musicPlaying;
160
164
  $music.classList.toggle("playing", this.musicPlaying);
161
- $console && $console.classList.toggle("on", this.musicPlaying);
165
+ $music.classList.toggle("stretch", this.musicPlaying);
166
+ $console?.classList.toggle("on", this.musicPlaying);
167
+
162
168
  if (this.musicPlaying) {
163
- $meting.aplayer.play();
164
- (typeof rm !== 'undefined') && rm?.menuItems.music[0] && ($rm_text.textContent = GLOBAL_CONFIG.right_menu.music.stop) && ($rm_icon.className = 'solitude fas fa-pause')
169
+ if (typeof rm !== 'undefined' && rm?.menuItems.music[0]) {
170
+ $rmText.textContent = GLOBAL_CONFIG.right_menu.music.stop;
171
+ $rmIcon.className = 'solitude fas fa-pause';
172
+ }
165
173
  } else {
166
- $meting.aplayer.pause();
167
- (typeof rm !== 'undefined') && rm?.menuItems.music[0] && ($rm_text.textContent = GLOBAL_CONFIG.right_menu.music.start) && ($rm_icon.className = 'solitude fas fa-play')
174
+ if (typeof rm !== 'undefined' && rm?.menuItems.music[0]) {
175
+ $rmText.textContent = GLOBAL_CONFIG.right_menu.music.start;
176
+ $rmIcon.className = 'solitude fas fa-play';
177
+ }
178
+ }
179
+
180
+ if(isMeting){
181
+ this.musicPlaying ? $meting.aplayer.play() : $meting.aplayer.pause();
168
182
  }
169
183
  },
184
+ musicBind() {
185
+ const $music = document.querySelector('#nav-music');
186
+ const $name = document.querySelector('#nav-music .aplayer-music');
187
+ const $button = document.querySelector('#nav-music .aplayer-button');
188
+
189
+ $name?.addEventListener('click', () => {
190
+ $music.classList.toggle("stretch");
191
+ });
192
+
193
+ $button?.addEventListener('click', () => {
194
+ this.musicToggle(false);
195
+ });
196
+
197
+ this.isMusicBind = true;
198
+ },
170
199
  switchCommentBarrage() {
171
200
  let commentBarrageElement = document.querySelector(".comment-barrage");
172
201
  let consoleCommentBarrage = document.querySelector("#consoleCommentBarrage");
@@ -189,7 +218,7 @@ const sco = {
189
218
  this.sco_keyboards = !this.sco_keyboards;
190
219
  const consoleKeyboard = document.querySelector("#consoleKeyboard");
191
220
  const keyboardFunction = this.sco_keyboards ? openKeyboard : closeKeyboard;
192
- consoleKeyboard.classList.toggle("on", this.sco_keyboards);
221
+ consoleKeyboard?.classList.toggle("on", this.sco_keyboards);
193
222
  keyboardFunction();
194
223
  localStorage.setItem("keyboard", this.sco_keyboards);
195
224
  document.getElementById('keyboard-tips')?.classList.remove('show');
@@ -660,7 +689,7 @@ class tabs {
660
689
  if (expire.time > ex) return;
661
690
  const ele = document.createElement('div');
662
691
  ele.className = 'expire';
663
- ele.innerHTML = `<i class="solitude st-circle-exclamation-solid"></i>${expire.text_prev}${-(expire.time - ex)}${expire.text_next}`;
692
+ ele.innerHTML = `<i class="solitude fas fa-circle-exclamation"></i>${expire.text_prev}${-(expire.time - ex)}${expire.text_next}`;
664
693
  const articleContainer = document.getElementById('article-container');
665
694
  articleContainer.insertAdjacentElement(expire.position === 'top' ? 'afterbegin' : 'beforeend', ele);
666
695
  }
@@ -163,8 +163,8 @@ window.oncontextmenu = (ele) => {
163
163
  } else {
164
164
  rm.menuItems.paste.style.display = "none";
165
165
  }
166
-
167
- if (tagName === "meting-js") {
166
+ let cls = ele.target.className.toLowerCase();
167
+ if (cls.match(/aplayer/)) {
168
168
  display = true;
169
169
  rm.menuItems.music.forEach((item) => (item.style.display = "flex"));
170
170
  } else {
@@ -1,10 +1,10 @@
1
- window.addEventListener("load", () => {
1
+ document.addEventListener("DOMContentLoaded", function () {
2
2
  const $searchMask = document.getElementById("search-mask");
3
3
  const $searchDialog = document.querySelector("#algolia-search .search-dialog");
4
4
 
5
5
  window.openSearch = () => {
6
6
  utils.animateIn($searchMask, "to_show 0.5s");
7
- $searchDialog.style.display = "block";
7
+ $searchDialog.style.display = "flex";
8
8
  setTimeout(() => {
9
9
  document.querySelector("#algolia-search .ais-SearchBox-input").focus();
10
10
  }, 100);
@@ -68,12 +68,14 @@ window.addEventListener("load", () => {
68
68
 
69
69
  const search = instantsearch({
70
70
  indexName: algolia.indexName,
71
- searchClient: algoliasearch(algolia.appId, algolia.apiKey),
71
+ searchClient: algoliasearch.algoliasearch(algolia.appId, algolia.apiKey),
72
72
  searchFunction(helper) {
73
73
  if (helper.state.query) {
74
- let innerLoading = '<i class="solitude st-loading-line st-spin"></i>';
74
+ let innerLoading = `<div class="loading">${GLOBAL_CONFIG.lang.search.loading}</div>`;
75
75
  document.getElementById("algolia-hits").innerHTML = innerLoading;
76
76
  helper.search();
77
+ } else {
78
+ document.getElementById("algolia-hits").innerHTML = '';
77
79
  }
78
80
  },
79
81
  });
@@ -87,9 +89,8 @@ window.addEventListener("load", () => {
87
89
  showReset: false,
88
90
  showSubmit: false,
89
91
  placeholder: GLOBAL_CONFIG.lang.search.placeholder,
90
- showLoadingIndicator: true,
91
- searchOnEnterKeyPressOnly: true,
92
- searchAsYouType: false,
92
+ showLoadingIndicator: false,
93
+ searchAsYouType: true,
93
94
  });
94
95
 
95
96
  const hits = instantsearch.widgets.hits({
@@ -98,7 +99,7 @@ window.addEventListener("load", () => {
98
99
  item(data) {
99
100
  const link = data.permalink ? data.permalink : GLOBAL_CONFIG.root + data.path;
100
101
  const result = data._highlightResult;
101
- const loadingLogo = document.querySelector("#algolia-hits .st-spin");
102
+ const loadingLogo = document.querySelector("#algolia-hits .loading");
102
103
  if (loadingLogo) {
103
104
  loadingLogo.style.display = "none";
104
105
  }
@@ -111,7 +112,7 @@ window.addEventListener("load", () => {
111
112
  </a>`;
112
113
  },
113
114
  empty: function (data) {
114
- const loadingLogo = document.querySelector("#algolia-hits .st-spin");
115
+ const loadingLogo = document.querySelector("#algolia-hits .loading");
115
116
  if (loadingLogo) {
116
117
  loadingLogo.style.display = "none";
117
118
  }
@@ -136,10 +137,10 @@ window.addEventListener("load", () => {
136
137
  scrollTo: false,
137
138
  showFirstLast: false,
138
139
  templates: {
139
- first: '<i class="solitude st-show-left-line"></i>',
140
- last: '<i class="solitude st-show-right-line"></i>',
141
- previous: '<i class="solitude st-arrow-left-bold"></i>',
142
- next: '<i class="solitude st-arrow-right-bold"></i>',
140
+ first: '<i class="solitude fas fa-angles-left"></i>',
141
+ last: '<i class="solitude fas fa-angles-right"></i>',
142
+ previous: '<i class="solitude fas fa-angle-left"></i>',
143
+ next: '<i class="solitude fas fa-angle-right"></i>',
143
144
  },
144
145
  cssClasses: {
145
146
  root: "pagination",
@@ -162,7 +163,7 @@ window.addEventListener("load", () => {
162
163
  },
163
164
  });
164
165
 
165
- search.addWidgets([configure, searchBox,stats, hits, pagination]);
166
+ search.addWidgets([configure, searchBox, stats, hits, pagination]);
166
167
 
167
168
  search.start();
168
169
 
@@ -178,4 +179,4 @@ window.addEventListener("load", () => {
178
179
  search.on("render", () => {
179
180
  window.pjax.refresh(document.getElementById("algolia-hits"));
180
181
  });
181
- });
182
+ });
@@ -4,7 +4,7 @@ window.addEventListener("load", () => {
4
4
  const $searchDialog = document.querySelector("#local-search .search-dialog");
5
5
  window.openSearch = () => {
6
6
  utils.animateIn($searchMask, "to_show 0.5s");
7
- $searchDialog.style.display = "block";
7
+ $searchDialog.style.display = "flex";
8
8
  setTimeout(() => {
9
9
  document.querySelector("#local-search .search-box-input").focus();
10
10
  }, 100);
@@ -101,18 +101,15 @@ window.addEventListener("load", () => {
101
101
  function initUI() {
102
102
  const $results = document.getElementById("search-results");
103
103
  const $search = document.getElementById("search-input");
104
- $search.addEventListener('keydown', function (e) {
105
- if (e.keyCode === 13) {
106
- e.preventDefault();
107
- $results.innerHTML = '';
108
- query = this.value.trim();
109
- if (query !== '') {
110
- results = search(query);
111
- renderResults(results, currentPage);
112
- renderPagination(results.length);
113
- } else {
114
- clearSearchResults();
115
- }
104
+ $search.addEventListener('input', function (e) {
105
+ $results.innerHTML = '';
106
+ query = this.value.trim();
107
+ if (query !== '') {
108
+ results = search(query);
109
+ renderResults(results, currentPage);
110
+ renderPagination(results.length);
111
+ } else {
112
+ clearSearchResults();
116
113
  }
117
114
  });
118
115
  }
@@ -202,4 +199,4 @@ window.addEventListener("load", () => {
202
199
  window.addEventListener('pjax:complete', () => {
203
200
  searchClickFn()
204
201
  })
205
- });
202
+ });