hexo-theme-shokax 0.2.5 → 0.2.7

Sign up to get free protection for your applications and to get access to all the features.
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:
package/languages/en.yml CHANGED
@@ -1,15 +1,15 @@
1
1
  name: English
2
2
 
3
3
  favicon:
4
- show: (●´3`●)Goooood
5
- hide: (´Д`)Booooom
4
+ show: (●´3`●) Here we go again.
5
+ hide: (´Д`) It's a disaster!
6
6
 
7
7
  title:
8
8
  archive: Archive
9
9
  category: Category
10
10
  tag: Tag
11
11
  all: All
12
- not_found: Σ( ° △ °|||)︴404!
12
+ not_found: Σ( ° △ °|||)︴404! Nothing can be seen
13
13
  category_in: Posted in category "%s"
14
14
  tag_in: Posted with tag "%s"
15
15
  archive_in: Posted on "%s"
@@ -22,13 +22,13 @@ menu:
22
22
  tags: Tags
23
23
  about: About
24
24
  search: Search
25
- aboutsite: About the Website
26
- census: Blog access statistics
27
- updata: Changelog
28
- statistics: Article statistics
29
- admiration: Appreciation to author
25
+ census: Blog Visits Statistics
26
+ aboutsite: About This Site
27
+ updata: Update Log
28
+ statistics: Statistics
29
+ admiration: Appreciation
30
30
  friends: Friends
31
- privacy: Privacy policy
31
+ privacy: Privacy Policy
32
32
 
33
33
  sidebar:
34
34
  overview: Overview
@@ -22,6 +22,13 @@ menu:
22
22
  tags: 標籤
23
23
  about: 關於
24
24
  search: 檢索
25
+ census: 博客訪問統計
26
+ aboutsite: 關於本站
27
+ updata: 更新日誌
28
+ statistics: 統計
29
+ admiration: 讚賞博主
30
+ friends: 友鏈
31
+ privacy: 隱私政策
25
32
 
26
33
  sidebar:
27
34
  overview: 本站概覽
@@ -22,6 +22,13 @@ menu:
22
22
  tags: 標籤
23
23
  about: 關於
24
24
  search: 檢索
25
+ census: 博客訪問統計
26
+ aboutsite: 關於本站
27
+ updata: 更新日誌
28
+ statistics: 統計
29
+ admiration: 讚賞博主
30
+ friends: 友鏈
31
+ privacy: 隱私政策
25
32
 
26
33
  sidebar:
27
34
  overview: 本站概要
@@ -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
 
@@ -2,7 +2,7 @@
2
2
  - var yandexValid = theme?.seo?.yandex,baiduValid = theme?.seo?.baidu
3
3
  - var siteTitle = config.title,noBaiduT = theme?.seo?.disable_baidu_transformation
4
4
  - var feedLink = full_url_for("/feed.json")
5
- - var tk= theme?.twikoo?.enable;var jsInjects = theme?.inject?.head?.js,cssInjects = theme?.inject?.head?.css
5
+ - var tk= theme?.twikoo?.enable
6
6
  - var wl = theme.waline.enable,gt=theme?.gitalk?.enable
7
7
  meta(charset="UTF-8")
8
8
  meta(name="viewport" content="width=device-width,initial-scale=1,maximum-scale=2")
@@ -2,6 +2,10 @@ include ../_mixin/breadcrumb.pug
2
2
  include ../_mixin/sidebar.pug
3
3
  include ../_mixin/widgets.pug
4
4
 
5
+ - var ignores = []
6
+ if (theme.quicklink.ignores)
7
+ - ignores.push(theme.quicklink.ignores)
8
+
5
9
  doctype html
6
10
  html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'filter: grayscale(1);':'' )
7
11
  head
@@ -67,65 +71,43 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
67
71
  != partial('_partials/footer.pug', {}, {cache: true})
68
72
  - var ccIcon = '<i class="ic i-creative-commons"></i>'
69
73
  - var ccText = theme.creative_commons.license.toUpperCase()
70
- <script data-config type="text/javascript" >
71
- | var LOCAL = {
72
- != `path: \"${_permapath(page.path)}\",`
73
- | favicon: {
74
- != `show: \'${__('favicon.show')}\',`
75
- != `hide: \'${__('favicon.hide')}\'`
76
- | },
77
- | search: {
78
- != `placeholder: \"${__('search.placeholder')}\",`
79
- != `empty: \"${__('search.empty')}\",`
80
- != `stats: \"${__('search.stats')}\"`
81
- | },
82
- if theme.widgets.recent_comments || page.comment !== false
83
- != `valine: ${page.valine ? _safedump(page.valine) : 'true'},`
84
- if page.chart
85
- | chart: true,
86
- if page.math
87
- | copy_tex: true,
88
- | katex: true,
89
- if page.mermaid
90
- | mermaid: true,
91
- if page.audio
92
- != `audio: ${_safedump(page.audio)},`
93
- if page.audio === false
94
- | audio: {},
95
- if page.fancybox !== false
96
- | fancybox: true,
97
- if page.copyright !== false
98
- if page.copyright === true
99
- | nocopy: true,
100
- != `copyright: \'${__("tips.nocopy")}\',`
101
- else
102
- != `copyright: \'${__("tips.copyright", ccIcon + ccText)}\',`
103
- if page.outime === false
104
- | outime: false,
105
- else
106
- | outime: true,template: `!{ __('outime.template') }`,
107
- if page.quiz
108
- | quiz: {
109
- != `choice: \'${__('quiz.choice')}\',`
110
- != `multiple: \'${__('quiz.multiple')}\',`
111
- != `true_false: \'${__('quiz.true_false')}\',`
112
- != `essay: \'${__('quiz.essay')}\',`
113
- != `gap_fill: \'${__('quiz.gap_fill')}\',`
114
- != `mistake: \'${__('quiz.mistake')}\'`
115
- | },
116
- | ignores : [
117
- | function(uri) {
118
- | return uri.includes('#');
119
- | },
120
- | function(uri) {
121
- | return new RegExp(LOCAL.path+"$").test(uri);
122
- | }
123
- if theme.quicklink.ignores
124
- | ,
125
- != _safedump(theme.quicklink.ignores)
126
- | ]
127
- | };
128
- </script>
74
+ script(data-config type="text/javascript").
75
+ var LOCAL = {
76
+ path: `#{_permapath(page.path)}`,
77
+ favicon: {
78
+ show: `#{__('favicon.show')}`,
79
+ hide: `#{__('favicon.hide')}`
80
+ },
81
+ search: {
82
+ placeholder: "!{__('search.placeholder')}",
83
+ empty: "!{__('search.empty')}",
84
+ stats: "!{__('search.stats')}"
85
+ },
86
+ valine: `#{page.valine ? _safedump(page.valine) : 'true'}`,
87
+ chart: `#{page.chart ? 'true' : 'false'}`,
88
+ copy_tex: `#{page.math ? 'true' : 'false'}`,
89
+ katex: `#{page.math ? 'true' : 'false'}`,
90
+ mermaid: `#{page.mermaid ? 'true' : 'false'}`,
91
+ audio: `#{_safedump(page.audio)}`,
92
+ fancybox: `#{page.fancybox !== false ? 'true' : 'false'}`,
93
+ nocopy: `#{page.nocopy ? 'true' : 'false'}`,
94
+ outime: `#{page.outime !== false ? 'true' : 'false'}`,
95
+ template: `#{__('outime.template')}`,
96
+ quiz: {
97
+ choice: `#{__('quiz.choice')}`,
98
+ multiple: `#{__('quiz.multiple')}`,
99
+ true_false: `#{__('quiz.true_false')}`,
100
+ essay: `#{__('quiz.essay')}`,
101
+ gap_fill: `#{__('quiz.gap_fill')}`,
102
+ mistake: `#{__('quiz.mistake')}`
103
+ },
104
+ ignores: [
105
+ (uri) => uri.includes('#'),
106
+ (uri) => new RegExp(LOCAL.path + '$').test(uri),
107
+ !{JSON.stringify(ignores)}
108
+ ]
109
+ };
110
+
129
111
  script(src="https://polyfill.alicdn.com/polyfill.min.js")
130
112
  if theme.advVendors.enable
131
113
  each i in _list_vendor_js()
@@ -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")
@@ -11,7 +12,7 @@ div(class="meta")
11
12
  != __('post.edited')
12
13
  time(title=__('post.modified') + __('symbol.colon') + full_date(post.updated) itemprop="dateModified" datetime=moment(post.updated).format())
13
14
  != date(post.updated)
14
- if theme.waline.pageview && !theme.waline.enable
15
+ if theme.waline.pageview && !theme.waline.enable && !theme.twikoo.enable
15
16
  script(type = "module" data-pjax).
16
17
  import { pageviewCount } from 'https://unpkg.com/@waline/client/dist/pageview.mjs';
17
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.2.5",
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,23 +8,19 @@
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",
20
18
  "@types/js-yaml": "^4.0.5",
21
19
  "@types/lozad": "^1.16.1",
22
- "@types/node": "^18.15.13",
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.206"
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
  }
@@ -3,20 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const hexo_util_1 = __importDefault(require("hexo-util"));
6
+ const hexo_util_1 = require("hexo-util");
7
7
  const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const js_yaml_1 = __importDefault(require("js-yaml"));
10
10
  hexo.extend.filter.register('before_generate', () => {
11
11
  if (hexo.config.theme_config) {
12
- hexo.theme.config = hexo_util_1.default.deepMerge(hexo.theme.config, hexo.config.theme_config);
12
+ hexo.theme.config = (0, hexo_util_1.deepMerge)(hexo.theme.config, hexo.config.theme_config);
13
13
  }
14
14
  const data = hexo.locals.get('data');
15
15
  if (data.languages) {
16
16
  const { i18n } = hexo.theme;
17
17
  const mergeLang = lang => {
18
18
  if (data.languages[lang]) {
19
- i18n.set(lang, hexo_util_1.default.deepMerge(i18n.get([lang]), data.languages[lang]));
19
+ i18n.set(lang, (0, hexo_util_1.deepMerge)(i18n.get([lang]), data.languages[lang]));
20
20
  }
21
21
  };
22
22
  for (const lang of ['en', 'ja', 'zh-CN', 'zh-HK', 'zh-TW']) {
@@ -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
  }
@@ -303,3 +303,15 @@ const pageScroll = function (target, offset, complete) {
303
303
  };
304
304
  anime(opt).play();
305
305
  };
306
+ let inCloudFlare = true;
307
+ window.addEventListener('DOMContentLoaded', function () {
308
+ inCloudFlare = false;
309
+ });
310
+ if (document.readyState === 'loading') {
311
+ window.addEventListener('load', function () {
312
+ if (inCloudFlare) {
313
+ window.dispatchEvent(new Event('DOMContentLoaded'));
314
+ console.log('%c ☁️cloudflare patch ' + '%c running(rocket & minify)', 'color: white; background: #ff8c00; padding: 5px 3px;', 'padding: 4px;border:1px solid #ff8c00');
315
+ }
316
+ });
317
+ }
@@ -2,35 +2,26 @@ const cardActive = function () {
2
2
  if (!$dom('.index.wrap')) {
3
3
  return;
4
4
  }
5
- if (!window.IntersectionObserver) {
6
- $dom.each('.index.wrap article.item, .index.wrap section.item', function (article) {
7
- if (article.hasClass('show') === false) {
8
- article.addClass('show');
5
+ const io = new IntersectionObserver(function (entries) {
6
+ entries.forEach(function (article) {
7
+ if (article.target.hasClass('show')) {
8
+ io.unobserve(article.target);
9
9
  }
10
- });
11
- }
12
- else {
13
- const io = new IntersectionObserver(function (entries) {
14
- entries.forEach(function (article) {
15
- if (article.target.hasClass('show')) {
10
+ else {
11
+ if (article.isIntersecting || article.intersectionRatio > 0) {
12
+ article.target.addClass('show');
16
13
  io.unobserve(article.target);
17
14
  }
18
- else {
19
- if (article.isIntersecting || article.intersectionRatio > 0) {
20
- article.target.addClass('show');
21
- io.unobserve(article.target);
22
- }
23
- }
24
- });
25
- }, {
26
- root: null,
27
- threshold: [0.3]
28
- });
29
- $dom.each('.index.wrap article.item, .index.wrap section.item', function (article) {
30
- io.observe(article);
15
+ }
31
16
  });
32
- $dom('.index.wrap .item:first-child').addClass('show');
33
- }
17
+ }, {
18
+ root: null,
19
+ threshold: [0.3]
20
+ });
21
+ $dom.each('.index.wrap article.item, .index.wrap section.item', function (article) {
22
+ io.observe(article);
23
+ });
24
+ $dom('.index.wrap .item:first-child').addClass('show');
34
25
  $dom.each('.cards .item', function (element, index) {
35
26
  ['mouseenter', 'touchstart'].forEach(function (item) {
36
27
  element.addEventListener(item, function (event) {
@@ -50,7 +41,7 @@ const cardActive = function () {
50
41
  const registerExtURL = function () {
51
42
  $dom.each('span.exturl', function (element) {
52
43
  const link = document.createElement('a');
53
- link.href = decodeURIComponent(atob(element.dataset.url).split('').map(function (c) {
44
+ link.href = decodeURIComponent(window.atob(element.dataset.url).split('').map(function (c) {
54
45
  return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
55
46
  }).join(''));
56
47
  link.rel = 'noopener external nofollow noreferrer';
@@ -688,5 +679,5 @@ const siteInit = function () {
688
679
  window.addEventListener('DOMContentLoaded', siteInit, {
689
680
  passive: true
690
681
  });
691
- console.log('%c Theme.ShokaX v' + CONFIG.version + ' %c https://github.com/zkz098/hexo-theme-shokaX ', 'color: white; background: #e9546b; padding:5px 0;', 'padding:4px;border:1px solid #e9546b;');
682
+ console.log('%c Theme.ShokaX v' + CONFIG.version + ' %c https://github.com/theme-shoka-x/hexo-theme-shokaX ', 'color: white; background: #e9546b; padding:5px 0;', 'padding:4px;border:1px solid #e9546b;');
692
683
  console.log('%c by kaitaku ' + '%c https://www.kaitaku.xyz', 'color: white; background: #00bfff; padding: 5px 3px;', 'padding: 4px;border:1px solid #00bfff');