hexo-theme-stellar 1.6.0 → 1.8.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 (48) hide show
  1. package/_config.yml +107 -33
  2. package/layout/404.ejs +1 -1
  3. package/layout/_partial/cover/index.ejs +12 -0
  4. package/layout/_partial/cover/post_cover.ejs +19 -0
  5. package/layout/_partial/{main/article → cover}/wiki_cover.ejs +1 -4
  6. package/layout/_partial/head.ejs +3 -2
  7. package/layout/_partial/main/article/article_footer.ejs +4 -4
  8. package/layout/_partial/main/post_list/paginator.ejs +2 -2
  9. package/layout/_partial/main/post_list/post_card.ejs +43 -5
  10. package/layout/_partial/main/post_list/wiki_card.ejs +2 -0
  11. package/layout/_partial/plugins/comments/valine/script.ejs +1 -1
  12. package/layout/_partial/plugins/comments/waline/layout.ejs +19 -0
  13. package/layout/_partial/plugins/comments/waline/script.ejs +22 -0
  14. package/layout/_partial/scripts/index.ejs +7 -1
  15. package/layout/_partial/sidebar/widgets/recent.ejs +5 -13
  16. package/layout/index.ejs +5 -2
  17. package/layout/layout.ejs +1 -1
  18. package/layout/post.ejs +6 -2
  19. package/package.json +1 -1
  20. package/scripts/events/index.js +5 -7
  21. package/scripts/tags/grid.js +35 -0
  22. package/scripts/tags/image.js +21 -1
  23. package/scripts/tags/note.js +7 -22
  24. package/scripts/tags/poetry.js +48 -0
  25. package/scripts/tags/quot.js +51 -0
  26. package/scripts/tags/{site.js → sites.js} +3 -0
  27. package/source/css/_common/device.styl +1 -1
  28. package/source/css/_common/highlight.styl +1 -1
  29. package/source/css/_common/title.styl +3 -1
  30. package/source/css/_custom.styl +6 -5
  31. package/source/css/_layout/layout.styl +2 -2
  32. package/source/css/_layout/list.styl +70 -36
  33. package/source/css/_layout/main.styl +2 -2
  34. package/source/css/_layout/md.styl +36 -8
  35. package/source/css/_layout/pages/archives.styl +1 -0
  36. package/source/css/_layout/partial/cover.styl +50 -10
  37. package/source/css/_layout/sidebar/sidebar.styl +20 -4
  38. package/source/css/_layout/tag-plugins/folding.styl +1 -0
  39. package/source/css/_layout/tag-plugins/frame.styl +1 -1
  40. package/source/css/_layout/tag-plugins/image.styl +1 -2
  41. package/source/css/_layout/tag-plugins/inline-labels.styl +3 -0
  42. package/source/css/_layout/tag-plugins/poetry.styl +50 -0
  43. package/source/css/_layout/tag-plugins/quot.styl +82 -0
  44. package/source/css/_plugins/fancybox.styl +5 -0
  45. package/source/css/_plugins/index.styl +2 -0
  46. package/source/js/main.js +60 -13
  47. package/source/js/plugins/friends.js +1 -1
  48. package/source/js/plugins/sites.js +2 -2
@@ -27,7 +27,7 @@
27
27
  margin-top: 19px
28
28
  margin-bottom: 20px
29
29
  .frame
30
- background-image: url(https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/frame/iphone11.svg);
30
+ background-image: url(https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/frame/iphone11.svg);
31
31
  width: 329px
32
32
  height: 658px
33
33
  &[focus='top']
@@ -2,7 +2,6 @@
2
2
  margin-top: 1rem
3
3
  margin-bottom: 1rem
4
4
  .image-bg
5
- line-height: 0
6
5
  text-align: center
7
6
  border-radius: $border-image
8
7
  position: relative
@@ -11,7 +10,7 @@
11
10
  .image-download
12
11
  opacity: 1 !important
13
12
  img
14
- display: inline-block
13
+ display: block
15
14
  object-fit: cover
16
15
  .image-download
17
16
  position: absolute
@@ -32,3 +32,6 @@
32
32
  line-height: 1
33
33
  font-weight: 700
34
34
  font-family: $ff-code
35
+ h1,h2,h3,h4
36
+ sup,sub
37
+ font-size: .85rem
@@ -0,0 +1,50 @@
1
+ .md .tag-plugin.poetry
2
+ align-self: center
3
+ &[align=center]
4
+ align-items: center
5
+ >.title
6
+ font-weight: 500
7
+ font-size: 1rem
8
+ margin-top: var(--gap-p)
9
+ >.meta
10
+ color: var(--text-p2)
11
+ font-size: $fs-12
12
+ font-weight: 500
13
+ span+span
14
+ margin-left: 4px
15
+ >.body
16
+ margin: var(--gap-p) 0
17
+ border-top: 1px dashed var(--block-border)
18
+ border-bottom: 1px dashed var(--block-border)
19
+ p
20
+ font-size: $fs-14
21
+ >.footer
22
+ font-style: italic
23
+ color: var(--text-p4)
24
+ margin: var(--gap-p) 0
25
+ font-size: $fs-12
26
+
27
+ // 描边修饰
28
+ .md .tag-plugin.poetry
29
+ padding-left: 1rem
30
+ position: relative
31
+ &:before
32
+ content: ''
33
+ position: absolute
34
+ width: 4px
35
+ left: -4px
36
+ top: 4px
37
+ bottom: 4px
38
+ border-radius: 4px
39
+ background: var(--block)
40
+ >.title
41
+ position: relative
42
+ &:before
43
+ content: ''
44
+ position: absolute
45
+ width: 4px
46
+ left: calc(-1rem - 4px)
47
+ top: 6px
48
+ bottom: 6px
49
+ border-radius: 4px
50
+ background: $color-highlight
@@ -0,0 +1,82 @@
1
+ .md .tag-plugin.quot
2
+ text-align: center
3
+ position: relative
4
+ align-items: center
5
+ .md .tag-plugin.quot:not(span)
6
+ display: flex
7
+ align-self: center
8
+ border-bottom: none
9
+ font-weight: 700
10
+ &:first-child
11
+ margin-top: 1.5rem
12
+ a.headerlink:before
13
+ content: ''
14
+ padding: 16px 24px 8px 24px
15
+ @media screen and (max-width: $device-mobile)
16
+ padding: 16px 20px 8px
17
+ line-height: 1.2
18
+
19
+ // override
20
+ article.md.content
21
+ .quot:not(span)
22
+ color: var(--text-p0)
23
+ h1.quot
24
+ font-size: $fs-h1
25
+ font-weight: 900
26
+ padding: 20px 32px 12px 32px
27
+ @media screen and (max-width: $device-mobile)
28
+ padding: 20px 24px 12px
29
+ h2.quot,h3.quot,h4.quot,h5.quot,h6.quot
30
+ font-size: $fs-h3
31
+ p.quot
32
+ font-size: $fs-h4
33
+
34
+ // type=text
35
+ .md .tag-plugin.quot[type=text]:not(span)
36
+ &:before,&:after
37
+ content: ""
38
+ position: absolute
39
+ width: 8px
40
+ height: 14px
41
+ &:before
42
+ top: 8px
43
+ left: 0
44
+ border-top: 6px solid $color-highlight
45
+ border-left: 6px solid $color-highlight
46
+ &:after
47
+ right: 0
48
+ bottom: 0
49
+ border-right: 6px solid $color-highlight
50
+ border-bottom: 6px solid $color-highlight
51
+ article.md.content h1.quot[type=text]
52
+ &:before,&:after
53
+ width: 12px
54
+ height: 20px
55
+ border-width: 8px
56
+
57
+ // type=icon
58
+ .md .tag-plugin.quot[type=icon]:not(span)
59
+ .icon
60
+ height: 1.5em
61
+ display: inline-block
62
+ color: $color-highlight
63
+ border-radius: 0
64
+ &.prefix
65
+ margin-right: .5rem
66
+ &.suffix
67
+ margin-left: .5rem
68
+
69
+ // inline quot
70
+ .md span.tag-plugin.quot
71
+ font-weight: 500
72
+ &:before,&:after
73
+ color: $color-highlight
74
+ font-weight: 900
75
+ &:before
76
+ content: "「"
77
+ margin-left: -0.125em
78
+ margin-right: 0.125em
79
+ &:after
80
+ content: "」"
81
+ margin-left: 0.125em
82
+ margin-right: -0.125em
@@ -0,0 +1,5 @@
1
+ img[fancybox='true']
2
+ cursor: zoom-in
3
+
4
+ .swiper-slide
5
+ cursor: zoom-in
@@ -5,6 +5,8 @@ if hexo-config('plugins.swiper.enable')
5
5
  @import 'swiper'
6
6
  if hexo-config('plugins.scrollreveal.enable')
7
7
  @import 'scrollreveal'
8
+ if hexo-config('plugins.fancybox.enable')
9
+ @import 'fancybox'
8
10
 
9
11
  // 评论
10
12
  if hexo-config('comments.service') == 'beaudar'
package/source/js/main.js CHANGED
@@ -59,16 +59,16 @@ const util = {
59
59
 
60
60
  const hud = {
61
61
  toast: (msg, duration) => {
62
- duration=isNaN(duration)?2000:duration;
62
+ duration = isNaN(duration) ? 2000 : duration;
63
63
  var el = document.createElement('div');
64
64
  el.classList.add('toast');
65
65
  el.innerHTML = msg;
66
66
  document.body.appendChild(el);
67
- setTimeout(function() {
67
+ setTimeout(function () {
68
68
  var d = 0.5;
69
69
  el.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
70
70
  el.style.opacity = '0';
71
- setTimeout(function() { document.body.removeChild(el) }, d * 1000);
71
+ setTimeout(function () { document.body.removeChild(el) }, d * 1000);
72
72
  }, duration);
73
73
  },
74
74
 
@@ -96,7 +96,7 @@ const init = {
96
96
  segs.push(node)
97
97
  });
98
98
  // 滚动
99
- $(document, window).scroll(function(e) {
99
+ $(document, window).scroll(function (e) {
100
100
  var scrollTop = $(this).scrollTop();
101
101
  var topSeg = null
102
102
  for (var idx in segs) {
@@ -124,7 +124,7 @@ const init = {
124
124
  },
125
125
  sidebar: () => {
126
126
  stellar.jQuery(() => {
127
- $("#toc a.toc-link").click(function(e) {
127
+ $("#toc a.toc-link").click(function (e) {
128
128
  l_body.classList.remove("sidebar");
129
129
  });
130
130
  })
@@ -142,7 +142,7 @@ const init = {
142
142
  /**
143
143
  * Tabs tag listener (without twitter bootstrap).
144
144
  */
145
- registerTabsTag: function() {
145
+ registerTabsTag: function () {
146
146
  // Binding `nav-tabs` & `tab-content` by real time permalink changing.
147
147
  document.querySelectorAll('.tabs ul.nav-tabs .tab').forEach(element => {
148
148
  element.addEventListener('click', event => {
@@ -192,7 +192,7 @@ if (stellar.plugins.scrollreveal) {
192
192
 
193
193
  // lazyload
194
194
  if (stellar.plugins.lazyload) {
195
- stellar.loadScript(stellar.plugins.lazyload.js, {defer:true})
195
+ stellar.loadScript(stellar.plugins.lazyload.js, { defer: true })
196
196
  // https://www.npmjs.com/package/vanilla-lazyload
197
197
  // Set the options globally
198
198
  // to make LazyLoad self-initialize
@@ -217,16 +217,16 @@ if (stellar.plugins.lazyload) {
217
217
  if (stellar.plugins.sitesjs) {
218
218
  const issues_api = document.getElementById('sites-api');
219
219
  if (issues_api != undefined) {
220
- stellar.jQuery( () => {
221
- stellar.loadScript(stellar.plugins.sitesjs, {defer:true})
220
+ stellar.jQuery(() => {
221
+ stellar.loadScript(stellar.plugins.sitesjs, { defer: true })
222
222
  })
223
223
  }
224
224
  }
225
225
  if (stellar.plugins.friendsjs) {
226
226
  const issues_api = document.getElementById('friends-api');
227
227
  if (issues_api != undefined) {
228
- stellar.jQuery( () => {
229
- stellar.loadScript(stellar.plugins.friendsjs, {defer:true})
228
+ stellar.jQuery(() => {
229
+ stellar.loadScript(stellar.plugins.friendsjs, { defer: true })
230
230
  })
231
231
  }
232
232
  }
@@ -236,7 +236,7 @@ if (stellar.plugins.swiper) {
236
236
  const swiper_api = document.getElementById('swiper-api');
237
237
  if (swiper_api != undefined) {
238
238
  stellar.loadCSS(stellar.plugins.swiper.css);
239
- stellar.loadScript(stellar.plugins.swiper.js, {defer:true}).then(function () {
239
+ stellar.loadScript(stellar.plugins.swiper.js, { defer: true }).then(function () {
240
240
  var swiper = new Swiper('.swiper-container', {
241
241
  slidesPerView: 'auto',
242
242
  spaceBetween: 8,
@@ -270,6 +270,53 @@ if (stellar.plugins.preload) {
270
270
  maxRPS: 5,
271
271
  hoverDelay: 25
272
272
  };
273
- stellar.loadScript(stellar.plugins.preload.flying_pages, {defer:true})
273
+ stellar.loadScript(stellar.plugins.preload.flying_pages, { defer: true })
274
+ }
275
+ }
276
+
277
+ // fancybox
278
+ if (stellar.plugins.fancybox) {
279
+ let selector = 'img[fancybox]:not(.error)';
280
+ if (stellar.plugins.fancybox.selector) {
281
+ selector += `, ${stellar.plugins.fancybox.selector}`
282
+ }
283
+ if (document.querySelectorAll(selector).length !== 0) {
284
+ stellar.loadCSS(stellar.plugins.fancybox.css);
285
+ stellar.loadScript(stellar.plugins.fancybox.js, { defer: true }).then(function () {
286
+ Fancybox.bind(selector, {
287
+ groupAll: true,
288
+ hideScrollbar: false,
289
+ Thumbs: {
290
+ autoStart: false,
291
+ },
292
+ caption: function (fancybox, carousel, slide) {
293
+ return slide.$trigger.alt || null
294
+ }
295
+ });
296
+ })
274
297
  }
275
298
  }
299
+
300
+ // heti
301
+ if (stellar.plugins.heti) {
302
+ stellar.loadCSS(stellar.plugins.heti.css);
303
+ stellar.loadScript(stellar.plugins.heti.js, { defer: true }).then(function () {
304
+ const heti = new Heti('.heti');
305
+
306
+ // Copied from heti.autoSpacing() without DOMContentLoaded.
307
+ // https://github.com/sivan/heti/blob/eadee6a3b748b3b7924a9e7d5b395d4bce479c9a/js/heti-addon.js
308
+ //
309
+ // We managed to minimize the code modification to ensure .autoSpacing()
310
+ // is synced with upstream; therefore, we use `.bind()` to emulate the
311
+ // behavior of .autoSpacing() so we can even modify almost no code.
312
+ void (function () {
313
+ const $$rootList = document.querySelectorAll(this.rootSelector)
314
+
315
+ for (let $$root of $$rootList) {
316
+ this.spacingElement($$root)
317
+ }
318
+ }).bind(heti)();
319
+
320
+ stellar.plugins.heti.enable = false;
321
+ });
322
+ }
@@ -77,7 +77,7 @@ $(function () {
77
77
  cfg.el = el;
78
78
  cfg.api = api;
79
79
  cfg.class = el.getAttribute('class');
80
- cfg.avatar = 'https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg';
80
+ cfg.avatar = 'https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg';
81
81
  friendsjs.layout(cfg);
82
82
  }
83
83
  });
@@ -80,8 +80,8 @@ $(function () {
80
80
  cfg.class = el.getAttribute('class');
81
81
  cfg.el = el;
82
82
  cfg.api = api;
83
- cfg.avatar = 'https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/link/8f277b4ee0ecd.svg';
84
- cfg.screenshot = 'https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/cover/76b86c0226ffd.svg';
83
+ cfg.avatar = 'https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/link/8f277b4ee0ecd.svg';
84
+ cfg.screenshot = 'https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/cover/76b86c0226ffd.svg';
85
85
  sitesjs.layout(cfg);
86
86
  }
87
87
  });