hexo-theme-shokax 0.0.8 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
package/_config.yml CHANGED
@@ -28,6 +28,8 @@ experiments:
28
28
  debug: false # 使用debug模式启动
29
29
  disableThemeComment: false # 禁用主题评论系统(一般用于关闭评论或让插件接管评论系统)
30
30
 
31
+ playerAPI: "https://api.injahow.cn" # 结尾不带/,只填写域名
32
+
31
33
  icon:
32
34
  favicon: "/favicon.ico"
33
35
  apple_touch_icon: "/apple-touch-icon.png"
@@ -156,6 +158,7 @@ waline:
156
158
  - mail
157
159
  wordLimit: 0 # 字数限制,0为不限制
158
160
  pageSize: 10 # 每页评论条数
161
+ pageview: true # 是否开启浏览量统计
159
162
 
160
163
  # https://github.com/gitalk/gitalk/blob/master/readme-cn.md
161
164
  gitalk:
@@ -3,7 +3,7 @@
3
3
  <id><%= config.url %></id>
4
4
  <title><%= config.title %></title>
5
5
  <subtitle><%= config.subtitle %></subtitle>
6
- <icon><%= full_url_for('/images/favicon.ico') %></icon>
6
+ <icon><%= full_url_for('/assets/favicon.ico') %></icon>
7
7
  <link href="<%= config.url %>" />
8
8
  <author>
9
9
  <name><%= config.author %></name>
@@ -2,7 +2,7 @@
2
2
  version: 'https://jsonfeed.org/version/1',
3
3
  title: config.title,
4
4
  subtitle: config.subtitle,
5
- icon: full_url_for('/images/favicon.ico'),
5
+ icon: full_url_for('/assets/favicon.ico'),
6
6
  description: config.description,
7
7
  home_page_url: config.url,
8
8
  items: posts.map(post => ({
@@ -3,7 +3,7 @@
3
3
  <channel>
4
4
  <title><%= config.title %></title>
5
5
  <subtitle><%= config.subtitle %></subtitle>
6
- <icon><%= full_url_for('/images/favicon.ico') %></icon>
6
+ <icon><%= full_url_for('/assets/favicon.ico') %></icon>
7
7
  <link><%= config.url %></link>
8
8
  <author>
9
9
  <name><%= config.author %></name>
@@ -14,20 +14,27 @@ mixin CommentRender()
14
14
  }, 1000)
15
15
  else if wl
16
16
  div(class="warp" id="wcomments")
17
+ - var locale = JSON.stringify(theme.waline.locale)
18
+ - var emoji = JSON.stringify(theme.waline.emoji)
19
+ - var meta = JSON.stringify(theme.waline.meta)
20
+ - var requiredMeta = JSON.stringify(theme.waline.requiredMeta)
17
21
  script(type="module" data-pjax).
18
22
  import { init } from 'https://unpkg.com/@waline/client@v2/dist/waline.mjs';
19
23
 
24
+ var path = document.getElementById("twikoo_visitors").getAttribute("data-path");
20
25
  setTimeout(function () {
21
26
  init({
22
27
  el: '#wcomments',
23
28
  serverURL: '#{hexo.theme.config.waline.serverURL}',
24
29
  lang: '#{hexo.theme.config.waline.lang}',
25
- locale: #{hexo.theme.config.waline.locale},
26
- emoji: #{hexo.theme.config.waline.emoji},
27
- meta: #{hexo.theme.config.waline.meta},
28
- requiredMeta: #{hexo.theme.config.waline.requiredMeta},
30
+ locale: !{locale},
31
+ emoji: !{emoji},
32
+ meta: !{meta},
33
+ requiredMeta: !{requiredMeta},
29
34
  wordLimit: #{hexo.theme.config.waline.wordLimit},
30
- pageSize: #{hexo.theme.config.waline.pageSize}
35
+ pageSize: #{hexo.theme.config.waline.pageSize},
36
+ pageview: #{theme.waline.pageview},
37
+ path: path
31
38
  });
32
39
  }, 1000)
33
40
  else if gt
@@ -2,7 +2,7 @@
2
2
  article(itemscope itemtype="http://schema.org/Article" class="post block" lang=temp)
3
3
  link(itemprop="mainEntityOfPage" href!=post.permalink)
4
4
  span(hidden itemprop="author" itemscope itemtype="http://schema.org/Person")
5
- meta(itemprop="image" content=url_for(theme.statics + theme.images + '/' + theme.sidebar.avatar))
5
+ meta(itemprop="image" content=url_for(theme.statics + theme.assets + '/' + theme.sidebar.avatar))
6
6
  meta(itemprop="name" content=author)
7
7
  meta(itemprop="description" content=`${ subtitle }, ${ description }`)
8
8
  span(hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization")
@@ -13,6 +13,6 @@ if page.reward !== false
13
13
  else
14
14
  - var translation = name
15
15
  div
16
- img(data-src=`${url_for(theme.statics + theme.images + image) }` alt=`${ author } ${ translation }`)
16
+ img(data-src=`${url_for(theme.statics + theme.assets + image) }` alt=`${ author } ${ translation }`)
17
17
  p
18
18
  != translation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.0.8",
3
+ "version": "0.1.1",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/zkz098/hexo-theme-shokaX",
@@ -42,7 +42,8 @@ hexo.extend.generator.register('script', function (locals) {
42
42
  quicklink: {
43
43
  timeout: theme.quicklink.timeout,
44
44
  priority: theme.quicklink.priority
45
- }
45
+ },
46
+ playerAPI: theme.playerAPI
46
47
  }
47
48
 
48
49
  if (config?.algolia) {
@@ -38,7 +38,7 @@ hexo.extend.helper.register('_new_comments', function (mode) {
38
38
  </script>`
39
39
  } else if (mode === 'waline') {
40
40
  return `
41
- <script type="module">
41
+ <script type="module" data-pjax>
42
42
  import { RecentComments } from 'https://unpkg.com/@waline/client@v2/dist/waline.mjs'
43
43
  RecentComments({
44
44
  el: '#new-comment',
@@ -53,7 +53,7 @@ function linkGrid (args, content) {
53
53
  urlparam = new URL(item.url)
54
54
  }
55
55
 
56
- let item_image = item.image || theme.images + '/404.png'
56
+ let item_image = item.image || theme.assets + '/404.png'
57
57
 
58
58
  if (!item_image.startsWith('//') && !item_image.startsWith('http')) {
59
59
  item_image = theme.statics + item_image
@@ -8,7 +8,7 @@
8
8
  .notfound {
9
9
  width: 18.75rem;
10
10
  height: 22.625rem;
11
- background: url("../images/404.png") no-repeat center bottom;
11
+ background: url("../assets/404.png") no-repeat center bottom;
12
12
  text-align: center;
13
13
  margin: 6.25rem auto;
14
14
  }
@@ -303,7 +303,7 @@
303
303
  content: "";
304
304
  position: absolute;
305
305
  z-index: 1;
306
- background: url("../images/play_needle.png") no-repeat center/contain;
306
+ background: url("../assets/play_needle.png") no-repeat center/contain;
307
307
  width: 3.4375rem;
308
308
  height: 5.1875rem;
309
309
  top: -1.5625rem;
@@ -322,7 +322,7 @@
322
322
  &::after {
323
323
  content: "";
324
324
  position: absolute;
325
- background: url("../images/play_disc.png") no-repeat center/contain;
325
+ background: url("../assets/play_disc.png") no-repeat center/contain;
326
326
  z-index: 1;
327
327
  width: 100%;
328
328
  height: 100%;
@@ -71,7 +71,7 @@
71
71
  padding: 1.875rem 1.875rem .3125rem;
72
72
  border-radius: .3125rem;
73
73
 
74
- background: var(--grey-1-a7) url(../images/search.png) no-repeat bottom right;
74
+ background: var(--grey-1-a7) url(../assets/search.png) no-repeat bottom right;
75
75
 
76
76
  color: var(--text-color);
77
77
 
@@ -91,7 +91,7 @@
91
91
 
92
92
  .algolia-powered {
93
93
  float: right;
94
- background: url('../images/algolia_logo.svg') no-repeat;
94
+ background: url('../assets/algolia_logo.svg') no-repeat;
95
95
  display: inline-block;
96
96
  height: 1.125rem;
97
97
  width: 4.25rem;
@@ -1,7 +1,7 @@
1
1
  const getDocHeight = () => $dom('main > .inner').offsetHeight;
2
2
  const $dom = (selector, element = document) => {
3
- if (selector.indexOf('#') === 0) {
4
- return element.getElementById(selector.replace('#', ''));
3
+ if (selector[0] === '#') {
4
+ return element.getElementById(selector.substring(1));
5
5
  }
6
6
  return element.querySelector(selector);
7
7
  };
@@ -567,7 +567,7 @@ const siteRefresh = function (reload) {
567
567
  vendorJs('copy_tex');
568
568
  vendorCss('mermaid');
569
569
  vendorJs('chart');
570
- if (!reload) {
570
+ if (reload !== 1) {
571
571
  $dom.each('script[data-pjax]', pjaxScript);
572
572
  }
573
573
  originTitle = document.title;
@@ -388,7 +388,7 @@ const mediaPlayer = function (t, config) {
388
388
  resolve(list);
389
389
  }
390
390
  else {
391
- fetch('https://api.i-meto.com/meting/api?server=' + meta[0] + '&type=' + meta[1] + '&id=' + meta[2] + '&r=' + Math.random())
391
+ fetch(`${CONFIG.playerAPI}/meting/api?server=` + meta[0] + '&type=' + meta[1] + '&id=' + meta[2] + '&r=' + Math.random())
392
392
  .then(function (response) {
393
393
  return response.json();
394
394
  }).then(function (json) {