hexo-theme-shokax 0.2.6 → 0.2.7

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/LICENSE-shoka ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 霜月琉璃
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/_config.yml CHANGED
@@ -173,7 +173,7 @@ waline:
173
173
  - mail
174
174
  wordLimit: 0 # 字数限制,0为不限制
175
175
  pageSize: 10 # 每页评论条数
176
- pageview: true # 是否开启浏览量统计
176
+ pageview: false # 是否开启浏览量统计,可独立开启
177
177
 
178
178
  # https://github.com/gitalk/gitalk/blob/master/readme-cn.md
179
179
  gitalk:
@@ -13,7 +13,7 @@ mixin CommentRender()
13
13
  })
14
14
  }, 1000)
15
15
  else if wl
16
- div(class="warp" id="wcomments")
16
+ div(class="wrap" id="wcomments")
17
17
  - var locale = JSON.stringify(theme.waline.locale)
18
18
  - var emoji = JSON.stringify(theme.waline.emoji)
19
19
  - var meta = JSON.stringify(theme.waline.meta)
@@ -38,7 +38,7 @@ mixin CommentRender()
38
38
  });
39
39
  }, 1000)
40
40
  else if gt
41
- div(class="warp" id="gtcomments")
41
+ div(class="wrap" id="gtcomments")
42
42
  script(type="text/javascript" data-pjax).
43
43
  const gproxy = theme.gitalk.proxy || undefined
44
44
  const gitalk = new Gitalk({
@@ -53,7 +53,7 @@ mixin CommentRender()
53
53
  });
54
54
  gitalk.render("gtcomments")
55
55
  else if gs
56
- div(class="warp giscus" id="gscomments")
56
+ div(class="wrap giscus" id="gscomments")
57
57
  script( src="https://giscus.app/client.js"
58
58
  data-repo="#{theme.giscus.repo}"
59
59
  data-repo-id="#{theme.giscus.repoId}"
@@ -10,6 +10,7 @@ mixin field(item)
10
10
 
11
11
  mixin WRender(item)
12
12
  - var tk = theme?.twikoo?.enable
13
+ - var waline = theme.waline.enable
13
14
  if theme.widgets.random_posts
14
15
  div(class="rpost pjax")
15
16
  h2
@@ -22,10 +23,10 @@ mixin WRender(item)
22
23
  div(class="rpost pjax")
23
24
  h2 最新评论
24
25
  ul(class="leancloud-recent-comment" id="new-comment")
25
- if tk
26
+ if tk || waline
26
27
  li(v-for="com in coms" class="item")
27
28
  a(v-bind:href="com.href" data-pjax-state="data-pjax-state")
28
- span(class="breadcrumb") {{com.nick}}@{{com.time}}
29
+ span(class="breadcrumb") {{com.nick}} @ {{com.time}}
29
30
  span {{com.text}}
30
31
  br
31
32
 
@@ -1,9 +1,10 @@
1
1
  div(class="meta")
2
2
  if date(post.date) != date(post.updated) || time(post.date) != time(post.updated)
3
- span(class="icon")
4
- i(class="ic i-eye")
5
- span 此文章已被阅读次数:
6
- span(id="twikoo_visitors" class="waline-pageview-count" data-path=post.path) 正在加载...
3
+ if theme.twikoo.enable || theme.waline.pageview
4
+ span(class="icon")
5
+ i(class="ic i-eye")
6
+ span 此文章已被阅读次数:
7
+ span(id="twikoo_visitors" class="waline-pageview-count" data-path=post.path) 正在加载...
7
8
  span(class="item")
8
9
  span(class="icon")
9
10
  i(class="ic i-calendar-check")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/theme-shoka-x/hexo-theme-shokaX",
@@ -8,12 +8,10 @@
8
8
  "license": "GPL-3.0-or-later",
9
9
  "scripts": {
10
10
  "test": "tsc",
11
- "build": "pnpm install && tsc",
12
- "docs:dev": "vuepress dev docs",
13
- "docs:build": "vuepress build docs"
11
+ "build": "pnpm install && tsc"
14
12
  },
15
13
  "devDependencies": {
16
- "@algolia/client-search": "^4",
14
+
17
15
  "@types/fancybox": "^3.5.3",
18
16
  "@types/hexo": "^3.8.8",
19
17
  "@types/jquery": "^3.5.16",
@@ -22,9 +20,7 @@
22
20
  "@types/node": "^20.1.0",
23
21
  "@typescript-eslint/eslint-plugin": "^5.59.0",
24
22
  "@typescript-eslint/parser": "^5.59.0",
25
- "@vuepress/client": "2.0.0-beta.61",
26
- "@vuepress/plugin-docsearch": "2.0.0-beta.61",
27
- "algoliasearch": "^4.17.0",
23
+
28
24
  "eslint": "^8.39.0",
29
25
  "eslint-config-standard": "^17.0.0",
30
26
  "eslint-plugin-import": "^2.27.5",
@@ -37,12 +33,9 @@
37
33
  "theme-shokax-anime": "^0.0.4",
38
34
  "theme-shokax-pjax": "^0.0.2",
39
35
  "typescript": "^5.0.4",
40
- "vue": "^3.2.47",
41
- "vuepress": "2.0.0-beta.61",
42
- "vuepress-plugin-sitemap2": "2.0.0-beta.208"
36
+ "vue": "^3.3.4"
43
37
  },
44
38
  "dependencies": {
45
- "js-yaml": "^4.1.0",
46
- "sass": "^1.62.0"
39
+ "js-yaml": "^4.1.0"
47
40
  }
48
41
  }
@@ -41,12 +41,33 @@ hexo.extend.helper.register('_new_comments', function (mode) {
41
41
  else if (mode === 'waline') {
42
42
  return `
43
43
  <script type="module" data-pjax>
44
+ let items = []
44
45
  import { RecentComments } from 'https://unpkg.com/@waline/client@v2/dist/waline.mjs'
45
46
  RecentComments({
46
- el: '#new-comment',
47
47
  serverURL: '${hexo.theme.config.waline.serverURL.replace(/\/+$/, '')}',
48
48
  count: 10,
49
- });
49
+ }).then(({ comments }) => {
50
+ comments.forEach(function (item) {
51
+ let cText = (item.orig.length > 50) ? item.orig.substring(0,50)+'...' : item.orig
52
+ item.url = item.url !== '/' ? '/' + item.url : item.url;
53
+ const siteLink = item.url + "#" + item.objectId
54
+ items.push({
55
+ href: siteLink,
56
+ nick: item.nick,
57
+ time: item.insertedAt.split('T').shift(),
58
+ text: cText
59
+ })
60
+ })
61
+ Vue.createApp({
62
+ data() {
63
+ return {
64
+ coms: items
65
+ }
66
+ }
67
+ }).mount('#new-comment')
68
+ }).catch(function (err) {
69
+ console.error(err)
70
+ })
50
71
  </script>
51
72
  `;
52
73
  }