hexo-theme-stellar 1.6.1 → 1.7.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.
package/_config.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ######## Stellar info ########
2
2
  stellar:
3
- version: '1.6.1'
3
+ version: '1.7.0'
4
4
  homepage: 'https://xaoxuu.com/wiki/stellar/'
5
5
  repo: 'https://github.com/xaoxuu/hexo-theme-stellar'
6
6
  cdn_css: # Use cdn links instead of /css/main.css
@@ -179,12 +179,23 @@ tag_plugins:
179
179
  # {% checkbox %}
180
180
  checkbox:
181
181
  interactive: false # enable interactive for user
182
+ # {% quot %}
183
+ quot:
184
+ default: # 可以自行配置多种图标方案
185
+ prefix: https://s2.loli.net/2022/01/04/vsTB5pGrIHfPxSj.png
186
+ suffix: https://s2.loli.net/2022/01/04/NORdtjlAhifZSns.png
187
+ hashtag:
188
+ prefix: https://s2.loli.net/2022/01/04/UvHcsa73jQPnobq.png
189
+ # {% emoji %}
182
190
  emoji:
183
191
  default: https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/qq/%s.gif
184
192
  twemoji: https://cdn.jsdelivr.net/gh/twitter/twemoji/assets/svg/%s.svg
185
193
  qq: https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/qq/%s.gif
186
194
  aru: https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/aru-l/%s.gif
187
195
  tieba: https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/tieba/%s.png
196
+ # {% image %}
197
+ image:
198
+ fancybox: # true, false
188
199
 
189
200
 
190
201
  ######## JS Plugins ########
@@ -193,14 +204,6 @@ plugins:
193
204
  # jquery
194
205
  jquery: https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js
195
206
 
196
- ## lazyload plugins ##
197
- # fancybox
198
- fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css
199
- # swiper
200
- swiper:
201
- enable: true
202
- css: https://unpkg.com/swiper@6/swiper-bundle.min.css
203
- js: https://unpkg.com/swiper@6/swiper-bundle.min.js
204
207
  # issues api
205
208
  sitesjs: /js/plugins/sites.js
206
209
  friendsjs: /js/plugins/friends.js
@@ -229,6 +232,32 @@ plugins:
229
232
  interval: 100 # ms
230
233
  scale: 1 # 0.1~1
231
234
 
235
+ # https://fancyapps.com/docs/ui/fancybox/
236
+ # available for {% image xxx %}
237
+ fancybox:
238
+ enable: true
239
+ js: https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.umd.js
240
+ css: https://cdn.jsdelivr.net/npm/@fancyapps/ui@4.0/dist/fancybox.css
241
+ # 可以处理评论区的图片(不支持 iframe 类评论系统)例如:
242
+ # 使用valine评论可以写: .vcontent img:not(.vemoji)
243
+ # 使用twikoo评论可以写: .tk-content img:not([class*="emo"])
244
+ selector: .swiper-slide img # 多个选择器用英文逗号隔开
245
+
246
+ # swiper
247
+ swiper:
248
+ enable: true
249
+ css: https://unpkg.com/swiper@6/swiper-bundle.min.css
250
+ js: https://unpkg.com/swiper@6/swiper-bundle.min.js
251
+
252
+
253
+ # 赫蹏 (Heti) - 专为中文网页内容设计的排版样式增强
254
+ # https://github.com/sivan/heti
255
+ heti:
256
+ enable: false
257
+ css: https://unpkg.com/heti/umd/heti.min.css
258
+ js: https://unpkg.com/heti/umd/heti-addon.min.js
259
+
260
+
232
261
  style:
233
262
  darkmode: auto # auto / always / false
234
263
  theme:
@@ -0,0 +1,12 @@
1
+ <%
2
+ function layoutCover() {
3
+ if (page.layout == 'wiki') {
4
+ return partial('wiki_cover');
5
+ }
6
+ if (page.layout == 'post') {
7
+ return partial('post_cover');
8
+ }
9
+ return '';
10
+ }
11
+ %>
12
+ <%- layoutCover() %>
@@ -0,0 +1,19 @@
1
+ <%
2
+ function div() {
3
+ var el = '';
4
+ if (page.banner == undefined || page.banner == false) {
5
+ return el;
6
+ }
7
+ el += '<div class="l_cover post' + scrollreveal() + '">';
8
+ el += '<div class="cover">';
9
+ if (theme.plugins.lazyload && theme.plugins.lazyload.enable) {
10
+ el += '<div class="lazy img bg" data-bg="' + page.banner + '"></div>';
11
+ } else {
12
+ el += '<div class="lazy img bg" style="background-image:url(&quot;' + page.banner + '&quot;)"></div>';
13
+ }
14
+ el += '</div>';
15
+ el += '</div>';
16
+ return el;
17
+ }
18
+ %>
19
+ <%- div() %>
@@ -1,9 +1,6 @@
1
1
  <%
2
2
  function layoutWikiCover() {
3
3
  var el = '';
4
- if (page.layout !== 'wiki') {
5
- return el;
6
- }
7
4
  let proj = theme.wiki.projects[page.wiki];
8
5
  if (proj == undefined) {
9
6
  return el;
@@ -21,7 +18,7 @@ function layoutWikiCover() {
21
18
  if (cover === true) {
22
19
  cover = ['logo', 'title', 'description'];
23
20
  }
24
- el += '<div class="l_cover' + scrollreveal() + '">';
21
+ el += '<div class="l_cover wiki' + scrollreveal() + '">';
25
22
  el += '<article class="cover-wrap md">';
26
23
 
27
24
  if (logo && logo.src && cover.includes('logo')) {
@@ -51,6 +51,7 @@ function og_args() {
51
51
  <meta http-equiv='x-dns-prefetch-control' content='on' />
52
52
  <link rel='dns-prefetch' href='https://cdn.jsdelivr.net'>
53
53
  <link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
54
+ <link rel='dns-prefetch' href='//unpkg.com'>
54
55
 
55
56
  <meta name="renderer" content="webkit">
56
57
  <meta name="force-rendering" content="webkit">
@@ -61,6 +62,15 @@ function og_args() {
61
62
  <meta name="theme-color" content="#f8f8f8">
62
63
  <title><%- generate_title() %></title>
63
64
 
65
+ <% if (theme.heti) { %>
66
+ <link rel="stylesheet" href="//unpkg.com/heti/umd/heti.min.css">
67
+ <script src="//unpkg.com/heti/umd/heti-addon.min.js"></script>
68
+ <script defer>
69
+ const heti = new Heti('.heti');
70
+ heti.autoSpacing(); // 自动进行中西文混排美化和标点挤压
71
+ </script>
72
+ <% } %>
73
+
64
74
  <% if (theme.open_graph && theme.open_graph.enable) { %>
65
75
  <%- open_graph(og_args()) %>
66
76
  <% } %>
@@ -1,6 +1,8 @@
1
1
  <%
2
- function layoutDiv() {
2
+ function div_default() {
3
3
  var el = '';
4
+ el += '<article class="md">';
5
+
4
6
  // 封面
5
7
  if (post.cover || theme.article.auto_cover) {
6
8
  var cover_url;
@@ -38,7 +40,11 @@ function layoutDiv() {
38
40
  el += '</h2>';
39
41
 
40
42
  // 摘要
41
- el += '<div class="excerpt">';
43
+ el += '<div class="excerpt';
44
+ if (theme.plugins.heti && theme.plugins.heti.enable) {
45
+ el += ' heti';
46
+ }
47
+ el += '">';
42
48
  el += '<p>';
43
49
  if (post.excerpt) {
44
50
  el += strip_html(post.excerpt);
@@ -76,9 +82,41 @@ function layoutDiv() {
76
82
  if (post.pin) {
77
83
  el += '<span class="pin"><img src="https://cdn.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/badge/3279dd441df8b.svg"/></span>';
78
84
  }
79
- el += '<div>';
85
+ el += '</div>';
86
+ el += '</article>';
87
+ return el;
88
+ }
89
+ function div_photo() {
90
+ var el = '';
91
+ el += '<div class="cover">';
92
+ el += '<img src="' + post.cover + '"/>';
93
+ if (post.cover_info) {
94
+ el += '<div class="cover-info"';
95
+ if (post.cover_info.meta) {
96
+ el += 'position="top">';
97
+ } else {
98
+ el += 'position="bottom">';
99
+ }
100
+ if (post.cover_info.meta) {
101
+ el += '<div class="cap">' + post.cover_info.meta + '</div>';
102
+ }
103
+ if (post.cover_info.title) {
104
+ el += '<div class="title">' + post.cover_info.title + '</div>';
105
+ }
106
+ if (post.cover_info.subtitle) {
107
+ el += '<div class="cap">' + post.cover_info.subtitle + '</div>';
108
+ }
109
+ el += '</div>';
80
110
 
111
+ }
112
+ el += '</div>';
81
113
  return el;
82
114
  }
115
+ function div() {
116
+ if (post.cover && post.cover.length > 0 && post.cover_info != undefined) {
117
+ return div_photo();
118
+ }
119
+ return div_default();
120
+ }
83
121
  %>
84
- <%- layoutDiv() %>
122
+ <%- div() %>
@@ -1,6 +1,7 @@
1
1
  <%
2
2
  function layoutDiv() {
3
3
  var el = '';
4
+ el += '<article class="md">';
4
5
  if (proj.logo && proj.logo.src) {
5
6
  el += '<div class="preview">';
6
7
  el += '<img src="' + proj.logo.src + '" alt="logo"';
@@ -20,6 +21,7 @@ function layoutDiv() {
20
21
  el += '<p>' + proj.description + '</p>';
21
22
  }
22
23
  el += '</div>';
24
+ el += '</article>';
23
25
  return el;
24
26
  }
25
27
  %>
@@ -121,6 +121,12 @@
121
121
  if ('<%- theme.plugins.preload.enable %>' == 'true') {
122
122
  stellar.plugins.preload = Object.assign(<%- JSON.stringify(theme.plugins.preload) %>);
123
123
  }
124
+ if ('<%- theme.plugins.fancybox.enable %>' == 'true') {
125
+ stellar.plugins.fancybox = Object.assign(<%- JSON.stringify(theme.plugins.fancybox) %>);
126
+ }
127
+ if ('<%- theme.plugins.heti.enable %>' == 'true') {
128
+ stellar.plugins.heti = Object.assign(<%- JSON.stringify(theme.plugins.heti) %>);
129
+ }
124
130
  </script>
125
131
 
126
132
  <!-- required -->
@@ -27,29 +27,21 @@ function layoutDiv() {
27
27
  }
28
28
  el += '<div class="widget-body fs14">';
29
29
  arr.sort("updated", -1).limit(item.limit).each(function(post) {
30
- el += '<div class="line"></div>'
31
- el += '<a class="more-item" href="' + url_for(post.link || post.path) + '">';
32
- el += '<div class="cap">';
33
- el += '<time>' + date(post.updated, config.date_format) + '</time>';
30
+ el += '<div class="more-item">';
31
+ el += '<a class="title" href="' + url_for(post.link || post.path) + '">';
34
32
  if (post.layout == 'wiki') {
35
33
  el += '<span>';
36
34
  let proj = theme.wiki.projects[post.wiki];
37
35
  if (proj && proj.title) {
38
- el += proj.title;
36
+ el += proj.title + __('symbol.colon');
39
37
  } else if (post.wiki) {
40
- el += post.wiki;
38
+ el += post.wiki + __('symbol.colon');
41
39
  }
42
40
  el += '</span>';
43
- } else {
44
- post.categories.limit(1).forEach((cat, i) => {
45
- el += '<span>' + cat.name + '</span>';
46
- });
47
41
  }
48
- el += '</div>';
49
- el += '<span class="title">';
50
42
  el += post.title || post.seo_title || post.wiki;
51
- el += '</span>';
52
43
  el += '</a>';
44
+ el += '</div>';
53
45
  el += '';
54
46
  });
55
47
  el += '</div>';
package/layout/index.ejs CHANGED
@@ -12,10 +12,13 @@ if (page.title && page.wiki) {
12
12
 
13
13
  function layout_post_card(layout, post, content) {
14
14
  var el = '';
15
+ var layout = layout;
16
+ if (layout == 'post' && post.cover != undefined && post.cover_info != undefined) {
17
+ layout += ' photo';
18
+ }
15
19
  el += '<a class="post-card ' + layout + ' ' + scrollreveal() + '" href="' + url_for(post.link || post.path) + '">';
16
- el += '<article class="md">';
17
20
  el += content;
18
- el += '</article></a>';
21
+ el += '</a>';
19
22
  return el;
20
23
  }
21
24
 
package/layout/layout.ejs CHANGED
@@ -2,7 +2,7 @@
2
2
  <html lang='<%- page.lang %>'>
3
3
  <%- partial('_partial/head') %>
4
4
  <body>
5
- <%- partial('_partial/main/article/wiki_cover') %>
5
+ <%- partial('_partial/cover/index') %>
6
6
  <div class='l_body' id='start'>
7
7
  <aside class='l_left' layout='<%- page.layout %>'>
8
8
  <%- partial('_partial/sidebar/index') %>
package/layout/post.ejs CHANGED
@@ -13,10 +13,14 @@ function layoutTitle() {
13
13
  return '';
14
14
  }
15
15
  }
16
+ let post = page;
17
+ let heti = '';
18
+ if (theme.plugins.heti && theme.plugins.heti.enable) {
19
+ heti = ' heti';
20
+ }
16
21
  %>
17
- <% let post = page; %>
18
22
  <%- partial('_partial/main/navbar/breadcrumb') %>
19
- <article class='content md <%- post.layout %><%- scrollreveal() %>'>
23
+ <article class='content<%- heti %> md <%- post.layout %><%- post.indent ? ' indent' : '' %><%- scrollreveal() %>'>
20
24
  <%- layoutTitle() %>
21
25
  <%- post.content %>
22
26
  <%- partial('_partial/main/article/article_footer') %>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-stellar",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "Elegant and powerful theme for Hexo.",
5
5
  "main": "package.json",
6
6
  "scripts": {
@@ -10,11 +10,9 @@ hexo.on('generateBefore', () => {
10
10
  });
11
11
 
12
12
  hexo.on('ready', () => {
13
- const { version } = require('../../package.json');
14
- hexo.log.info(`
15
- =======================================================
16
- Stellar ${version}
17
- Docs: https://xaoxuu.com/wiki/stellar/
18
- Repo: https://github.com/xaoxuu/hexo-theme-stellar/
19
- =======================================================`);
13
+ const { version, homepage, repository } = require('../../package.json');
14
+ hexo.log.info(`Welcome to Stellar ${version}
15
+ DOCS ${homepage}
16
+ REPO ${repository.url}
17
+ `);
20
18
  });
@@ -8,7 +8,7 @@
8
8
  'use strict';
9
9
 
10
10
  hexo.extend.tag.register('image', function(args) {
11
- args = hexo.args.map(args, ['width', 'height', 'bg', 'download', 'padding'], ['src', 'alt']);
11
+ args = hexo.args.map(args, ['width', 'height', 'bg', 'download', 'padding', 'fancybox'], ['src', 'alt']);
12
12
  var style = '';
13
13
  if (args.width) {
14
14
  style += 'width:' + args.width + ';';
@@ -16,12 +16,32 @@ hexo.extend.tag.register('image', function(args) {
16
16
  if (args.height) {
17
17
  style += 'height:' + args.height + ';';
18
18
  }
19
+ // fancybox
20
+ var fancybox = false;
21
+ if (hexo.theme.config.plugins.fancybox && hexo.theme.config.plugins.fancybox.enable) {
22
+ // 主题配置
23
+ if (hexo.theme.config.tag_plugins.image && hexo.theme.config.tag_plugins.image.fancybox) {
24
+ fancybox = hexo.theme.config.tag_plugins.image.fancybox;
25
+ }
26
+ // 覆盖配置
27
+ if (args.fancybox && args.fancybox.length > 0) {
28
+ if (args.fancybox == 'true') {
29
+ fancybox = true;
30
+ } else if (args.fancybox == 'false') {
31
+ fancybox = false;
32
+ }
33
+ }
34
+ }
35
+
19
36
  function img(src, alt, style) {
20
37
  let img = '';
21
38
  img += '<img src="' + src + '"';
22
39
  if (alt) {
23
40
  img += ' alt="' + alt + '"';
24
41
  }
42
+ if (fancybox) {
43
+ img += ' fancybox="true"';
44
+ }
25
45
  if (style.length > 0) {
26
46
  img += ' style="' + style + '"';
27
47
  }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * poetry.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * poetry:
6
+ * {% poetry [align:center] [title] [author:作者] [date:日期] [footer:footer] %}
7
+ * body
8
+ * {% endpoetry %}
9
+ *
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ hexo.extend.tag.register('poetry', function(args, content) {
15
+ var el = '';
16
+ args = hexo.args.map(args, ['author', 'date', 'align', 'footer'], ['title']);
17
+
18
+ el += '<div class="tag-plugin poetry"';
19
+ if (args.align) {
20
+ el += ' align="' + args.align + '"';
21
+ }
22
+ el += '>';
23
+ if (args.title) {
24
+ el += '<div class="title">';
25
+ el += args.title;
26
+ el += '</div>';
27
+ }
28
+ if (args.author || args.date) {
29
+ el += '<div class="meta">';
30
+ if (args.author) {
31
+ el += '<span>' + args.author + '</span>';
32
+ }
33
+ if (args.date) {
34
+ el += '<span>' + args.date + '</span>';
35
+ }
36
+ el += '</div>';
37
+ }
38
+ el += '<div class="body">';
39
+ el += hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('');
40
+ el += '</div>';
41
+ if (args.footer) {
42
+ el += '<div class="footer">';
43
+ el += args.footer;
44
+ el += '</div>';
45
+ }
46
+ el += '</div>';
47
+ return el;
48
+ }, {ends: true});
@@ -0,0 +1,51 @@
1
+ /**
2
+ * quot.js v1.1 | https://github.com/xaoxuu/hexo-theme-stellar/
3
+ * 格式与官方标签插件一致使用空格分隔,中括号内的是可选参数(中括号不需要写出来)
4
+ *
5
+ * quot:
6
+ * {% quot [el:h1] [icon:default] text %}
7
+ *
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ hexo.extend.tag.register('quot', function(args) {
13
+ var el = '';
14
+ args = hexo.args.map(args, ['el', 'icon'], ['text']);
15
+ if (!args.el) {
16
+ args.el = 'p';
17
+ }
18
+
19
+ var type = '';
20
+ if (args.icon && args.icon != 'square' && args.icon != 'quotes') {
21
+ type = ' type="icon"';
22
+ } else {
23
+ type = ' type="text"';
24
+ }
25
+ function content() {
26
+ if (!args.icon) {
27
+ return args.text;
28
+ }
29
+ var el = '';
30
+ const cfg = hexo.theme.config.tag_plugins.quot[args.icon];
31
+ if (cfg && cfg.prefix) {
32
+ el += '<img class="icon prefix" src="' + cfg.prefix + '" />';
33
+ }
34
+ el += args.text;
35
+ if (cfg && cfg.suffix) {
36
+ el += '<img class="icon suffix" src="' + cfg.suffix + '" />';
37
+ }
38
+ return el;
39
+ }
40
+ if (args.el.includes('h')) {
41
+ el += '<' + args.el + ' class="tag-plugin quot"' + type + ' id="' + args.text + '">';
42
+ el += '<a href="#' + args.text + '" class="headerlink" title="' + args.text + '"></a>';
43
+ el += content();
44
+ el += '</' + args.el + '>';
45
+ } else {
46
+ el += '<' + args.el + ' class="tag-plugin quot"' + type + '>';
47
+ el += content();
48
+ el += '</' + args.el + '>';
49
+ }
50
+ return el;
51
+ });
@@ -10,7 +10,7 @@ code
10
10
  border-radius: 4px
11
11
 
12
12
  article.md .highlight
13
- margin: 1rem 0
13
+ margin: var(--gap-p) 0
14
14
  border-radius: $border-block
15
15
  overflow: hidden
16
16
  background: var(--block)
@@ -5,6 +5,7 @@ $color-theme = #1BCDFC
5
5
  $color-link = #2196f3
6
6
  $color-button = #1BCDFC
7
7
  $color-hover = #ff5722
8
+ $color-highlight = #ff5722
8
9
  $color-inner = #fff
9
10
  $color-cat = #FF7844
10
11
  $color-cat-hover = darken($color-cat, 20)
@@ -47,7 +48,7 @@ $fs-14 = .875rem
47
48
  $fs-13 = .8125rem
48
49
  $fs-12 = .75rem
49
50
 
50
- $fs-h1 = 2rem // 32px
51
+ $fs-h1 = 1.75rem // 32px
51
52
  $fs-h2 = 1.5rem // 24px
52
53
  $fs-h3 = 1.375rem // 22px
53
54
  $fs-h4 = 1.125rem // 18px
@@ -63,14 +64,14 @@ $border-image = 6px
63
64
  // 可以动态变化的属性
64
65
  :root
65
66
  --width-left: 256px
66
- --width-main: 680px
67
+ --width-main: 720px
67
68
  --gap-l: 16px
68
- --gap-p: 1.25rem // gap for paragraph
69
+ --gap-p: .75rem // gap for paragraph
69
70
  // desktop 2k or larger
70
71
  @media screen and (min-width: $device-2k)
71
72
  --gap-l: 32px
72
73
  --width-left: 320px
73
- --width-main: 740px
74
+ --width-main: 780px
74
75
  // desktop 4k or larger
75
76
  @media screen and (min-width: $device-4k)
76
77
  --width-main: 860px
@@ -11,15 +11,18 @@
11
11
  trans1 box-shadow
12
12
  overflow: hidden
13
13
  background: var(--card)
14
+ position: relative
14
15
  .excerpt
15
16
  margin: 1rem 0
16
17
  >p
17
18
  margin: 1rem 0
19
+ line-height: 1.5
18
20
  .meta.cap
19
21
  display: flex
20
22
  flex-wrap: wrap
21
23
  align-items: center
22
24
  margin: .5rem 0
25
+ line-height: 1.5
23
26
  span+span
24
27
  margin-left: 0.5rem
25
28
  span.pin
@@ -28,49 +31,76 @@
28
31
  object-fit: contain
29
32
  height: 1.5em
30
33
  .post-list .post-card:hover
31
- box-shadow: 0 1px 4px 0px rgba(0, 0, 0, 0.08), 0 2px 8px 0px rgba(0, 0, 0, 0.06), 0 4px 16px 0px rgba(0, 0, 0, 0.04)
34
+ box-shadow: 0 1px 4px 0px rgba(0, 0, 0, 0.1), 0 4px 16px 0px rgba(0, 0, 0, 0.1)
32
35
 
33
36
 
34
37
  // common article
35
- .post-list article
38
+ .post-list article.md
36
39
  padding: 1rem
40
+ p
41
+ color: var(--text-p2)
42
+ @media screen and (min-width: $device-mobile)
43
+ font-size: $fs-14
44
+
37
45
 
38
46
  // posts
39
- .post-list .post-card
40
- .post-cover
41
- overflow: hidden
42
- margin-left: -1rem
43
- margin-top: -1rem
44
- margin-right: -1rem
47
+ .post-list .post-card .post-cover
48
+ overflow: hidden
49
+ width: 'calc(100% + 2 * %s)' % 1rem
50
+ border-radius: 0
51
+ margin-left: -1rem
52
+ margin-top: -1rem
53
+ margin-right: -1rem
54
+ &:not(.lazy)
55
+ trans1: transform 1s
56
+ img
57
+ object-fit: cover
58
+ width: 100%
59
+ border-radius: 0
60
+ height: 280px
61
+ @media screen and (max-width: 900px)
62
+ height: 240px
63
+ @media screen and (max-width: $device-tablet)
64
+ height: 280px
65
+ @media screen and (max-width: $device-mobile)
66
+ height: 240px
67
+ @media screen and (max-width: $device-mobile-425)
68
+ height: 220px
69
+ @media screen and (max-width: $device-mobile-375)
70
+ height: 180px
71
+
72
+ .post-list .post-card.post.photo
73
+ .cover
74
+ position: relative
75
+ line-height: 0
45
76
  img
46
- object-fit: cover
47
77
  width: 100%
48
- border-radius: 0
49
- height: 280px
50
- @media screen and (max-width: 900px)
51
- height: 240px
52
- @media screen and (max-width: $device-tablet)
53
- height: 280px
54
- @media screen and (max-width: $device-mobile)
55
- height: 240px
56
- @media screen and (max-width: $device-mobile-425)
57
- height: 220px
58
- @media screen and (max-width: $device-mobile-375)
59
- height: 180px
60
- &:not(.lazy)
61
- trans1: transform 1s
62
- .post-list .post-card.post.photo .post-cover img
63
- height: 400px
64
- @media screen and (max-width: 900px)
65
- height: 320px
66
- @media screen and (max-width: $device-tablet)
67
- height: 400px
68
- @media screen and (max-width: $device-mobile)
69
- height: 320px
70
- @media screen and (max-width: $device-mobile-425)
71
- height: 280px
72
- @media screen and (max-width: $device-mobile-375)
73
- height: 240px
78
+ .cover-info
79
+ padding: 1rem
80
+ position: absolute
81
+ line-height: 1.2
82
+ width: 'calc(100% - %s * 2)' % 1rem
83
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2)
84
+ color: white
85
+ &[position=top]
86
+ top: 0
87
+ background-image: linear-gradient(rgba(0,0,0,0.4),rgba(0,0,0,0.3),rgba(0,0,0,0))
88
+ &[position=bottom]
89
+ bottom: 0
90
+ background-image: linear-gradient(rgba(0,0,0,0),rgba(0,0,0,0.3),rgba(0,0,0,0.4))
91
+ div+div
92
+ margin-top: 8px
93
+ @media screen and (max-width: $device-mobile)
94
+ margin-top: 4px
95
+ .cap
96
+ color: white
97
+ font-size: $fs-13
98
+ .title
99
+ font-weight: 500
100
+ font-size: $fs-h3
101
+ h2
102
+ margin: .25rem 0
103
+ font-size: $fs-h4
74
104
 
75
105
 
76
106
  // wiki
@@ -1,9 +1,9 @@
1
1
  .l_main
2
2
  position: relative
3
3
  padding-bottom: "calc(1 * %s)" % var(--gap-l)
4
- @media screen and (min-width: 1200px)
4
+ @media screen and (min-width: 1280px)
5
5
  margin-left: "calc(2 * %s)" % var(--gap-l)
6
- margin-right: "calc(0.75 * %s)" % var(--width-left)
6
+ margin-right: "calc(2 * %s + %s)" % (var(--gap-l) var(--width-left))
7
7
  @media screen and (min-width: $device-tablet)
8
8
  padding-top: "calc(2 * %s)" % var(--gap-l)
9
9
  header
@@ -10,16 +10,29 @@ article.md.excerpt
10
10
  font-size: $fs-14
11
11
  margin: 1em 0
12
12
 
13
+ h1.article-title
14
+ margin-top: .5em
15
+ margin-bottom: 1em
16
+ line-height: 1.2
17
+ color: var(--text-p0)
18
+
13
19
  article.md.content
14
20
  position: relative
15
21
  margin-bottom: 2rem
22
+ display: flex
23
+ flex-direction: column
24
+ &.indent
25
+ >p:not([class])
26
+ text-indent: 'calc(%s * 2)' % $fs-p
27
+ text-align: justify
28
+ h1,h2,h3,h4,h5,h6
29
+ text-align: center
30
+ >h2:not([class])
31
+ align-self: center
32
+ border-bottom-style: dashed
33
+ border-bottom-color: $color-highlight
16
34
  >:first-child
17
- margin-top: 0
18
- h1.article-title
19
- margin-top: .5em
20
- margin-bottom: 1em
21
- line-height: 1.2
22
- color: var(--text-p0)
35
+ margin-top: 1rem
23
36
  h1:not(:first-child)
24
37
  margin-top: 2em
25
38
  h2:first-child
@@ -27,12 +40,14 @@ article.md.content
27
40
  h2,h3,h4,h5,h6
28
41
  color: var(--text-p0)
29
42
  padding-top: 1rem
30
- margin-bottom: 1em
43
+ margin-bottom: .5rem
31
44
  line-height: 1.8
32
45
  &:hover
33
46
  a.headerlink:before
34
47
  opacity: 1
35
48
 
49
+
50
+
36
51
  .md
37
52
  ul:not(:last-child),
38
53
  ol:not(:last-child)
@@ -45,11 +60,17 @@ article.md.content
45
60
  p,blockquote,.tag-plugin,ul,ol,.highlight,table
46
61
  *
47
62
  --gap-p: .5rem
48
- p,.tag-plugin
63
+ p,>ul:not(:last-child),>ol:not(:last-child)
64
+ margin-top: 'calc(%s - 4px)' % var(--gap-p)
65
+ margin-bottom: 'calc(%s - 4px)' % var(--gap-p)
66
+ .tag-plugin,iframe
49
67
  margin-top: var(--gap-p)
50
68
  margin-bottom: var(--gap-p)
69
+ p,.tag-plugin
51
70
  .highlight,table
52
71
  --gap-p: 1rem
72
+ iframe
73
+ display: block
53
74
 
54
75
  // titles
55
76
  article.md.content
@@ -59,7 +80,7 @@ article.md.content
59
80
  position: absolute
60
81
  margin-left: -0.75em
61
82
  h2
62
- margin-top: 3rem
83
+ margin-top: 2rem
63
84
  border-bottom: 1px solid var(--block-border)
64
85
  font-weight: 400
65
86
  h3
@@ -93,6 +114,10 @@ article.md pre
93
114
  -webkit-font-smoothing: auto
94
115
  -moz-osx-font-smoothing: auto
95
116
 
117
+ article.md
118
+ .center
119
+ align-self: center
120
+
96
121
  // div
97
122
  article.md>div
98
123
  margin: var(--gap-p) 0
@@ -1,4 +1,5 @@
1
1
  .post-list #archive
2
+ padding: 1rem
2
3
  .archive-header
3
4
  display: inline-block
4
5
  font-family: $ff-code
@@ -5,9 +5,59 @@
5
5
  flex-direction: column
6
6
  justify-content: center
7
7
  align-items: center
8
+ position: relative
9
+ &.post
10
+ height: inherit
11
+
8
12
 
9
13
  .l_cover .cover-wrap
10
14
  margin-bottom: 0
15
+ display: flex
16
+ flex-direction: column
17
+ justify-content: center
18
+ align-items: center
19
+ .cover-title
20
+ font-weight: 700
21
+ font-size: 1.5rem
22
+ margin: 1rem 0
23
+ line-height: 1.2
24
+ .description
25
+ margin: 1rem 0
26
+ .start-wrap
27
+ margin: 2rem 0
28
+ flex-shrink: 0
29
+ a.start
30
+ display: inline-block
31
+
32
+ .l_cover.post
33
+ .cover
34
+ z-index: -1
35
+ width: 100%
36
+ height: 30vh
37
+ max-width: $device-2k
38
+ min-height: 150px
39
+ max-height: 400px
40
+ @media screen and (max-width: $device-tablet)
41
+ height: 25vh
42
+ @media screen and (max-width: $device-mobile)
43
+ height: 20vh
44
+ @media screen and (min-width: $device-2k)
45
+ margin-top: 4rem
46
+ .img
47
+ border-radius: 2rem
48
+
49
+
50
+ .l_cover.post .cover-wrap
51
+ z-index: 1
52
+ .article-title
53
+ text-align: center
54
+ padding: 1rem
55
+ margin: 1em 0 0 0
56
+ @media screen and (min-width: $device-2k)
57
+ font-size: 3rem
58
+
59
+
60
+ .l_cover.wiki .cover-wrap
11
61
  max-width: $device-mobile
12
62
  .preview
13
63
  margin-bottom: 2rem
@@ -18,15 +68,5 @@
18
68
  @media screen and (max-width: $device-mobile)
19
69
  max-width: 60%
20
70
  .cover-title
21
- font-weight: 700
22
- font-size: 1.5rem
23
- margin: 1rem 0
24
71
  &:first-child
25
72
  font-size: 3rem
26
- .description
27
- margin: 1rem 0
28
- .start-wrap
29
- margin: 2rem 0
30
- flex-shrink: 0
31
- a.start
32
- display: inline-block
@@ -164,7 +164,9 @@ nav.menu
164
164
  background: var(--site-bg)
165
165
  padding-top: 2px
166
166
  z-index 1
167
- line-height: 2.4
167
+ line-height: 2
168
+ color: var(--text-p4)
169
+ font-size: $fs-14
168
170
  &:empty
169
171
  display: none
170
172
  .cap-action
@@ -190,7 +192,21 @@ nav.menu
190
192
  text-decoration: underline
191
193
  .widget-header+.widget-body
192
194
  margin-top: 0
193
- .widget-wrap#recent .widget-body, .widget-wrap#related .widget-body
195
+
196
+ .widget-wrap .widget-body
197
+ .more-item
198
+ margin: .5rem 0
199
+ .cap
200
+ margin-bottom: .25rem
201
+ .widget-wrap#recent .widget-body
202
+ a
203
+ line-height: 1.2
204
+ font-weight: 500
205
+ color: var(--text-p2)
206
+ font-size: $fs-13
207
+ &:hover
208
+ color: $color-hover
209
+ .widget-wrap#related .widget-body
194
210
  >a
195
211
  padding 0.5rem
196
212
  display: block
@@ -57,6 +57,7 @@ details.folding[open]
57
57
  details.folding[child=codeblock]>div.body
58
58
  padding: 0
59
59
  background: transparent
60
+ overflow: hidden
60
61
  .highlight
61
62
  border: none
62
63
  border-radius: 0
@@ -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
@@ -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,39 @@ 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
274
  }
275
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
+ })
297
+ }
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 p');
305
+ heti.autoSpacing();
306
+ stellar.plugins.heti.enable = false;
307
+ });
308
+ }