hexo-theme-shokax 0.4.1 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
package/_config.yml CHANGED
@@ -234,16 +234,17 @@ summary:
234
234
  # Value before `||` delimiter is the target permalink,
235
235
  # secend value is the name of Font icon.
236
236
  social:
237
- github: https://github.com/name || github || "#191717"
237
+ github: https://github.com/yourname || github || "#191717"
238
+ #gitee: https://gitee.com/yourname || gitee || "#e60026"
238
239
  #google: https://plus.google.com/yourname || google
239
240
  #twitter: https://twitter.com/yourname || twitter || "#00aff0"
240
241
  #zhihu: https://www.zhihu.com/people/yourname || zhihu || "#1e88e5"
241
242
  #music: https://music.163.com/#/user/home?id=yourid || cloud-music || "#e60026"
242
243
  #weibo: https://weibo.com/yourname || weibo || "#ea716e"
243
244
  #about: https://about.me/yourname || address-card || "#3b5998"
244
- # email: mailto:foo@xxx.com || envelope || "#55acd5"
245
+ #email: mailto:foo@xxx.com || envelope || "#55acd5"
245
246
  #facebook: https://www.facebook.com/yourname || facebook
246
- # stackoverflow: https://stackoverflow.com/ || stack-overflow
247
+ #stackoverflow: https://stackoverflow.com/ || stack-overflow
247
248
  #youtube: https://youtube.com/yourname || youtube
248
249
  #instagram: https://instagram.com/yourname || instagram
249
250
  #skype: skype:yourname?call|chat || skype
@@ -370,13 +371,13 @@ vendors:
370
371
  unpkg: https://unpkg.com
371
372
  js:
372
373
  pace: bytedance|pace/1.2.4/pace.min.js
373
- # pjax: npm_webcache|theme-shokax-pjax@0.0.3/pjax.shokax.min.js
374
- # anime: npm_webcache|theme-shokax-anime@0.0.6/anime.shokax.min.js
375
- # lozad: npm_webcache|lozad@1.16.0/dist/lozad.min.js
376
- # algolia: bytedance|algoliasearch/4.12.1/algoliasearch-lite.umd.min.js
377
- # instantsearch: bytedance|instantsearch.js/4.39.0/instantsearch.production.min.js
378
- # quicklink: npm_webcache|quicklink@2.3.0/dist/quicklink.umd.js
379
- # mouse_firework: npm_webcache|mouse-firework@0.0.4/dist/index.umd.js
374
+ # pjax: npm_webcache|theme-shokax-pjax@0.0.3/pjax.shokax.min.js
375
+ # anime: npm_webcache|theme-shokax-anime@0.0.6/anime.shokax.min.js
376
+ # lozad: npm_webcache|lozad@1.16.0/dist/lozad.min.js
377
+ # algolia: bytedance|algoliasearch/4.12.1/algoliasearch-lite.umd.min.js
378
+ # instantsearch: bytedance|instantsearch.js/4.39.0/instantsearch.production.min.js
379
+ # quicklink: npm_webcache|quicklink@2.3.0/dist/quicklink.umd.js
380
+ # mouse_firework: npm_webcache|mouse-firework@0.0.4/dist/index.umd.js
380
381
  async_js:
381
382
  fancybox: bytedance|??jquery/3.5.1/jquery.min.js,fancybox/3.5.7/jquery.fancybox.min.js,justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js
382
383
  copy_tex: npm_webcache|katex@0.16.7/dist/contrib/copy-tex.min.js
@@ -384,4 +385,4 @@ vendors:
384
385
  katex: npm_webcache|katex@0.16.7/dist/katex.min.css
385
386
  comment: css/comment.css
386
387
  fancybox: npm_webcache|@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css
387
- justifiedGallery: npm_webcache|justifiedGallery@3.8.1/dist/css/justifiedGallery.min.css
388
+ justifiedGallery: npm_webcache|justifiedGallery@3.8.1/dist/css/justifiedGallery.min.css
@@ -0,0 +1,55 @@
1
+ export default [
2
+ {
3
+ files: ['*.ts', '*.tsx', '*.vue'],
4
+ languageOptions: {
5
+ parser: '@typescript-eslint/parser',
6
+ parserOptions: {
7
+ ecmaVersion: 2022
8
+ }
9
+ },
10
+ plugins: {
11
+ '@typescript-eslint': await import('@typescript-eslint/eslint-plugin'),
12
+ 'vue': await import('eslint-plugin-vue')
13
+ },
14
+ rules: {
15
+ camelcase: 'off',
16
+ 'n/no-callback-literal': 'off',
17
+ '@typescript-eslint/ban-types': 'off',
18
+ '@typescript-eslint/ban-ts-comment': 'off',
19
+ '@typescript-eslint/no-var-requires': 'off',
20
+ '@typescript-eslint/no-unused-vars': 'off',
21
+ 'prefer-const': 'off'
22
+ }
23
+ },
24
+ {
25
+ files: ['*.js', '*.jsx'],
26
+ languageOptions: {
27
+ ecmaVersion: 2022
28
+ },
29
+ env: {
30
+ browser: true,
31
+ commonjs: true,
32
+ es6: true,
33
+ node: true
34
+ },
35
+ extends: [
36
+ 'standard'
37
+ ],
38
+ rules: {
39
+ camelcase: 'off',
40
+ 'n/no-callback-literal': 'off',
41
+ 'prefer-const': 'off'
42
+ }
43
+ },
44
+ {
45
+ files: ['*.vue'],
46
+ languageOptions: {
47
+ parserOptions: {
48
+ ecmaVersion: 2022
49
+ }
50
+ },
51
+ extends: [
52
+ 'plugin:vue/vue3-recommended'
53
+ ]
54
+ }
55
+ ];
@@ -23,11 +23,6 @@ mixin WRender(item)
23
23
  div(class="rpost pjax")
24
24
  h2
25
25
  != __('index.recent_comments')
26
- ul(class="leancloud-recent-comment" id="new-comment")
27
- if tk || waline
28
- li(v-for="com in coms" class="item")
29
- a(v-bind:href="root + com.href" data-pjax-state="data-pjax-state")
30
- span(class="breadcrumb") {{com.nick}} @ {{com.time}}
31
- span {{com.text}}
32
- br
26
+ if tk || waline
27
+ ul(class="leancloud-recent-comment" id="new-comment")
33
28
 
@@ -15,7 +15,8 @@ div(class="status")
15
15
  i(class="ic i-chart-area")
16
16
  span(title=__('symbols_count_time.count_total'))
17
17
  != `${ symbolsCountTotal(site) } ${__('symbols_count_time.word')}`
18
- span(class="post-meta-divider") |
18
+ span(class="post-meta-divider")
19
+ != " | "
19
20
  span(class="post-meta-item-icon")
20
21
  i(class="ic i-coffee")
21
22
  span(title=__('symbols_count_time.time_total'))
@@ -27,14 +28,14 @@ div(class="status")
27
28
  != __('footer.powered', _url('https://hexo.io', 'Hexo') + ' & Theme.' + _url('https://github.com/theme-shoka-x/hexo-theme-shokaX/', 'ShokaX'))
28
29
  if theme.footer.icp.enable
29
30
  br
30
- span(style="display:inline;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;")
31
+ span(style="display:inline;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:var(--grey-5);")
31
32
  a(href="https://beian.miit.gov.cn")
32
33
  != theme.footer.icp.icpnumber
33
34
  - var beianN = theme.footer.icp?.beian, RC=theme.footer.icp?.recordcode
34
35
  if beianN && RC
35
36
  br
36
37
  a(target="_blank" href=`https://beian.mps.gov.cn/#/query/webSearch?code=${RC}`)
37
- img(loading="lazy" decoding="async" data-src=theme.statics + theme.assets + '/' + theme.footer.icp.icon style="max-width: 2em;display:inline;" width="20" height="20")
38
+ img(loading="lazy" decoding="async" data-src=theme.statics + theme.assets + '/' + theme.footer.icp.icon style="max-width: 2em;display:inline;" width="20" height="20" alt="备案")
38
39
  != beianN
39
40
  != shokax_inject('status')
40
41
 
@@ -11,6 +11,13 @@ else if page.tags && page.tags.length
11
11
  else if config.keywords
12
12
  meta(name="keywords" content=config.keywords)
13
13
 
14
+ if page.description
15
+ meta(name="description" content=page.description)
16
+ else if page.excerpt
17
+ meta(name="description" content=page.excerpt)
18
+ else if config.description
19
+ meta(name="description" content=config.description)
20
+
14
21
  != canonical()
15
22
 
16
23
  if theme.open_graph
@@ -47,14 +47,14 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
47
47
  if theme.homeConfig.gradient || enableFixedCover
48
48
  //- cover不可用时用Bing随机图片代替
49
49
  - var coverImage = theme.homeConfig?.fixedCover || "https://7ed.net/bing/api"
50
- img(src=coverImage loading="eager" decoding="async" fetchpriority="high")
50
+ img(src=coverImage loading="eager" decoding="async" fetchpriority="high" alt=title)
51
51
  else
52
52
  if covers.length === 6
53
53
  ul
54
54
  each image in covers
55
55
  li(class="item" style=`background-image: url("${image}");`)
56
56
  else
57
- img(src=covers loading="eager" decoding="async" fetchpriority="high")
57
+ img(src=covers loading="eager" decoding="async" fetchpriority="high" alt=title)
58
58
  div(id="waves")
59
59
  svg(class="waves" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 24 150 28" preserveAspectRatio="none" shape-rendering="auto")
60
60
  defs
@@ -4,7 +4,8 @@ div(class="meta")
4
4
  span(class="icon")
5
5
  i(class="ic i-eye")
6
6
  span 此文章已被阅读次数:
7
- span(id="twikoo_visitors" class="waline-pageview-count" data-path=post.path) 正在加载...
7
+ - var prefixedPath = post.path.startsWith('/') ? post.path : '/' + post.path
8
+ span(id="twikoo_visitors" class="waline-pageview-count" data-path=prefixedPath) 正在加载...
8
9
  span(class="item")
9
10
  span(class="icon")
10
11
  i(class="ic i-calendar-check")
@@ -8,7 +8,7 @@ mixin item(name, path, parent, sublist)
8
8
  if parent
9
9
  li(class="item dropdown")
10
10
  if itemURL === '/'
11
- a(href="javascript:void(0);")
11
+ a(href="#" onclick="return false;")
12
12
  != menuIcon + menuText
13
13
  else
14
14
  != _url(itemURL, menuIcon + menuText, {rel: 'section'})
@@ -1,5 +1,5 @@
1
1
  div(class="author" itemprop="author" itemscope itemtype="http://schema.org/Person")
2
- img(loading="eager" decoding="async" class="image" itemprop="image" alt=author
2
+ img(loading="lazy" decoding="async" class="image" itemprop="image" alt=author
3
3
  src=url_for(theme.statics + theme.assets + '/'+ theme.sidebar.avatar))
4
4
  p(class="name" itemprop="name")
5
5
  != author
package/package.json CHANGED
@@ -1,50 +1,50 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
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",
7
7
  "author": "zkz098",
8
8
  "license": "AGPL-3.0-or-later",
9
- "packageManager": "pnpm@8.14.1",
9
+ "packageManager": "pnpm@9.4.0",
10
10
  "scripts": {
11
11
  "test": "tsc --build --verbose",
12
12
  "build": "cd ./scripts && tsc --build --verbose"
13
13
  },
14
14
  "devDependencies": {
15
- "@types/fancybox": "^3.5.6",
16
- "@types/jquery": "^3.5.29",
15
+ "@types/fancybox": "^3.5.7",
16
+ "@types/jquery": "^3.5.30",
17
17
  "@types/js-yaml": "^4.0.9",
18
- "@types/node": "^20.11.10",
18
+ "@types/node": "^20.14.8",
19
19
  "@types/quicklink": "^2.3.4",
20
- "@typescript-eslint/eslint-plugin": "^6.20.0",
21
- "@typescript-eslint/parser": "^6.20.0",
22
- "eslint": "^8.56.0",
20
+ "@typescript-eslint/eslint-plugin": "^7.13.1",
21
+ "@typescript-eslint/parser": "^7.13.1",
22
+ "eslint": "^9.5.0",
23
23
  "eslint-config-standard": "~17",
24
24
  "eslint-plugin-import": "^2.29.1",
25
- "eslint-plugin-n": "^16.6.2",
26
- "eslint-plugin-promise": "^6.1.1",
27
- "eslint-plugin-vue": "^9.20.1",
28
- "typescript": "^5.3.3"
25
+ "eslint-plugin-n": "^17.9.0",
26
+ "eslint-plugin-promise": "^6.2.0",
27
+ "eslint-plugin-vue": "^9.26.0",
28
+ "typescript": "^5.5.2"
29
29
  },
30
30
  "dependencies": {
31
- "@waline/client": "3.0.0-alpha.11",
32
- "vue": "^3.4.15",
33
- "@algolia/client-search": "^4.22.1",
34
- "algoliasearch": "4.22.1",
35
- "esbuild": "^0.20.0",
36
- "hexo": "7.0.0",
37
- "hexo-fs": "^4.1.1",
31
+ "@waline/client": "^3.2.2",
32
+ "vue": "^3.4.30",
33
+ "@algolia/client-search": "^4.23.3",
34
+ "algoliasearch": "4.23.3",
35
+ "esbuild": "^0.21.5",
36
+ "hexo": "7.2.0",
37
+ "hexo-fs": "^4.1.3",
38
38
  "hexo-pagination": "^3.0.0",
39
- "hexo-util": "^3.2.0",
40
- "instantsearch.js": "^4.64.2",
39
+ "hexo-util": "^3.3.0",
40
+ "instantsearch.js": "^4.72.1",
41
41
  "js-yaml": "^4.1.0",
42
42
  "mouse-firework": "^0.0.5",
43
43
  "quicklink": "^2.3.0",
44
44
  "theme-shokax-anime": "^0.0.6",
45
45
  "theme-shokax-pjax": "^0.0.3",
46
- "twikoo": "^1.6.31",
47
- "unlazy": "^0.10.4",
46
+ "twikoo": "^1.6.36",
47
+ "unlazy": "^0.11.3",
48
48
  "hexo-lightning-minify": "latest",
49
49
  "hexo-algoliasearch": "latest",
50
50
  "hexo-feed": "latest",
@@ -53,5 +53,18 @@
53
53
  "engines": {
54
54
  "node": ">=18.0.0"
55
55
  },
56
- "engineStrict": true
56
+ "engineStrict": true,
57
+ "pnpm": {
58
+ "overrides": {
59
+ "array-includes": "npm:@nolyfill/array-includes@latest",
60
+ "array.prototype.findlastindex": "npm:@nolyfill/array.prototype.findlastindex@latest",
61
+ "array.prototype.flat": "npm:@nolyfill/array.prototype.flat@latest",
62
+ "array.prototype.flatmap": "npm:@nolyfill/array.prototype.flatmap@latest",
63
+ "hasown": "npm:@nolyfill/hasown@latest",
64
+ "is-regex": "npm:@nolyfill/is-regex@latest",
65
+ "object.fromentries": "npm:@nolyfill/object.fromentries@latest",
66
+ "object.groupby": "npm:@nolyfill/object.groupby@latest",
67
+ "object.values": "npm:@nolyfill/object.values@latest"
68
+ }
69
+ }
57
70
  }
@@ -39,7 +39,10 @@ hexo.extend.filter.register('before_generate', () => {
39
39
  else {
40
40
  hexo.theme.config.image_list = js_yaml_1.default.load(node_fs_1.default.readFileSync(path_1.default.join(__dirname, '../../_images.yml'), { encoding: 'utf-8' }));
41
41
  }
42
- if (node_fs_1.default.existsSync(path_1.default.join(__dirname, '../../_images_index.yml'))) {
42
+ if (data.images_index && data.images_index.length > 0) {
43
+ hexo.theme.config.index_images = data.images_index;
44
+ }
45
+ else if (node_fs_1.default.existsSync(path_1.default.join(__dirname, '../../_images_index.yml'))) {
43
46
  hexo.theme.config.index_images = js_yaml_1.default.load(node_fs_1.default.readFileSync(path_1.default.join(__dirname, '../../_images_index.yml'), { encoding: 'utf-8' }));
44
47
  }
45
48
  else {
@@ -22,7 +22,7 @@ hexo.extend.helper.register('_vendor_font', () => {
22
22
  return '';
23
23
  const fontDisplay = '&display=swap';
24
24
  const fontSubset = '&subset=latin,latin-ext';
25
- const fontStyles = ':300,300italic,400,400italic,700,700italic';
25
+ const fontStyles = ':400,400italic,700,700italic';
26
26
  const fontHost = 'https://fonts.googleapis.com';
27
27
  // Get a font list from config
28
28
  let fontFamilies = ['global', 'logo', 'title', 'headings', 'posts', 'codes'].map(item => {
@@ -47,10 +47,10 @@ hexo.on('generateBefore', () => {
47
47
  });
48
48
  hexo.on('generateAfter', () => {
49
49
  // 检查版本更新
50
- fetch('https://registry.npmmirror.com/hexo-theme-shokax').then((res) => {
50
+ fetch('https://api.shokax.top/version/hexo').then((res) => {
51
51
  res.json().then((resp) => {
52
52
  try {
53
- const latest = resp['dist-tags'].latest;
53
+ const latest = resp['version'];
54
54
  const current = package_json_1.version.split('.');
55
55
  let isOutdated = false;
56
56
  for (let i = 0; i < Math.max(latest.length, current.length); i++) {
package/scripts/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getVendorLink = void 0;
3
+ exports.getVendorLink = getVendorLink;
4
4
  function getVendorLink(hexo, source) {
5
5
  const VendorsCfg = hexo.theme.config.vendors;
6
6
  const tagIdx = source.indexOf('|');
@@ -11,4 +11,3 @@ function getVendorLink(hexo, source) {
11
11
  return source;
12
12
  }
13
13
  }
14
- exports.getVendorLink = getVendorLink;
@@ -267,11 +267,11 @@ code,
267
267
  }
268
268
 
269
269
  // For diff highlight
270
- .deletion {
270
+ .deletion, .deleted {
271
271
  background: var(--color-pink-light);
272
272
  }
273
273
 
274
- .addition {
274
+ .addition, .inserted {
275
275
  background: var(--color-cyan-light);
276
276
  }
277
277
 
@@ -20,6 +20,7 @@
20
20
  padding: 1.25rem 2.5rem;
21
21
  background-size: cover;
22
22
  position: relative;
23
+ transform: scale(1);
23
24
 
24
25
  &::before {
25
26
  content: "";
@@ -6,7 +6,7 @@
6
6
  background: var(--body-bg-shadow);
7
7
 
8
8
  .inner {
9
- margin: 0 auto;
9
+ margin: 2rem auto .625rem;
10
10
  width: $content-desktop;
11
11
  position: relative;
12
12
 
@@ -35,7 +35,6 @@
35
35
  .status {
36
36
  width: 100%;
37
37
  text-align: center;
38
- margin-top: 2rem;
39
38
  }
40
39
 
41
40
  .languages {
@@ -65,5 +64,4 @@
65
64
 
66
65
  .powered-by, .theme-info {
67
66
  display: inline-block;
68
- margin-bottom: .625rem;
69
67
  }
@@ -1,7 +1,8 @@
1
1
  import { CONFIG } from '../globals/globalVars'
2
- import { init, pageviewCount, RecentComments } from '@waline/client'
2
+ import { init, RecentComments } from '@waline/client'
3
+ import { pageviewCount } from '@waline/client/pageview'
3
4
 
4
- import { createApp } from 'vue'
5
+ import { $dom } from '../library/dom'
5
6
 
6
7
  export const walineComment = function () {
7
8
  init({
@@ -21,6 +22,7 @@ export const walineComment = function () {
21
22
  }
22
23
 
23
24
  export const walinePageview = function () {
25
+ // TODO waline 上游此模块存在问题
24
26
  pageviewCount({
25
27
  serverURL: CONFIG.waline.serverURL,
26
28
  path: window.location.pathname
@@ -34,24 +36,54 @@ export const walineRecentComments = async function () {
34
36
  serverURL: CONFIG.waline.serverURL.replace(/\/+$/, ''),
35
37
  count: 10
36
38
  })
37
- comments.forEach(function (item) {
39
+ // TODO 疑似 waline API 返回格式与文档不一致,需要确认是否为上游问题
40
+ // @ts-ignore
41
+ comments.data.forEach(function (item) {
38
42
  let cText = (item.orig.length > 50) ? item.orig.substring(0, 50) + '...' : item.orig
39
43
  item.url = item.url.startsWith('/') ? item.url : '/' + item.url
40
44
  const siteLink = item.url + '#' + item.objectId
45
+
46
+ const time = new Date(item.time)
47
+ const now = new Date()
48
+ const diff = now.valueOf() - time.valueOf()
49
+ let dateStr:string
50
+ if (diff < 3600000) {
51
+ dateStr = `${Math.floor(diff / 60000)} 分钟前`
52
+ } else if (diff < 86400000) {
53
+ dateStr = `${Math.floor(diff / 3600000)} 小时前`
54
+ } else if (diff < 2592000000) {
55
+ dateStr = `${Math.floor(diff / 86400000)} 天前`
56
+ } else {
57
+ dateStr = `${time.getFullYear()}-${time.getMonth() + 1}-${time.getDate()}`
58
+ }
59
+
41
60
  items.push({
42
61
  href: siteLink,
43
62
  nick: item.nick,
44
- // @ts-ignore
45
- time: item.insertedAt.split('T').shift(),
63
+ time: dateStr,
46
64
  text: cText
47
65
  })
48
66
  })
49
- createApp({
50
- data () {
51
- return {
52
- coms: items,
53
- root
54
- }
55
- }
56
- }).mount('#new-comment')
67
+ const newComments = new DocumentFragment()
68
+ items.forEach(function (item) {
69
+ const commentEl = document.createElement('li')
70
+ const commentLink = document.createElement('a')
71
+ const commentTime = document.createElement('span')
72
+ const commentText = document.createElement('span')
73
+
74
+ commentText.innerText = item.text
75
+ commentTime.className = 'breadcrumb'
76
+ commentTime.innerText = `${item.nick} @ ${item.time}`
77
+ commentLink.href = root + item.href
78
+ commentLink['data-pjax-state'] = 'data-pjax-state'
79
+ commentEl.className = 'item'
80
+
81
+ commentText.appendChild(document.createElement('br'))
82
+ commentLink.appendChild(commentTime)
83
+ commentLink.appendChild(commentText)
84
+ commentEl.appendChild(commentLink)
85
+ newComments.appendChild(commentEl)
86
+ })
87
+
88
+ $dom('#new-comment').appendChild(newComments)
57
89
  }
@@ -228,7 +228,7 @@ export const menuActive = () => {
228
228
  if (!target) return
229
229
  const isSamePath = target.pathname === location.pathname || target.pathname === location.pathname.replace('index.html', '')
230
230
  const isSubPath = !CONFIG.root.startsWith(target.pathname) && location.pathname.startsWith(target.pathname)
231
- const active = target.hostname === location.hostname && (isSamePath || isSubPath)
231
+ const active = !target.onclick && target.hostname === location.hostname && (isSamePath || isSubPath)
232
232
  element.toggleClass('active', active)
233
233
  if (element.parentNode.child('.active') && parentItem.hasClass('dropdown')) {
234
234
  parentItem.removeClass('active').addClass('expand')
@@ -1,6 +1,6 @@
1
- import twikoo from 'twikoo'
1
+ import * as twikoo from 'twikoo'
2
2
  import { CONFIG } from '../globals/globalVars'
3
- import { createApp } from 'vue'
3
+ import { $dom } from '../library/dom'
4
4
 
5
5
  export const twikooComment = function () {
6
6
  twikoo.init({
@@ -30,12 +30,26 @@ export const twikooRecentComments = async function () {
30
30
  text: cText
31
31
  })
32
32
  })
33
- createApp({
34
- data () {
35
- return {
36
- coms: comments,
37
- root
38
- }
39
- }
40
- }).mount('#new-comment')
33
+ const newComments = new DocumentFragment()
34
+ comments.forEach(function (item) {
35
+ const commentEl = document.createElement('li')
36
+ const commentLink = document.createElement('a')
37
+ const commentTime = document.createElement('span')
38
+ const commentText = document.createElement('span')
39
+
40
+ commentText.innerText = item.text
41
+ commentTime.className = 'breadcrumb'
42
+ commentTime.innerText = `${item.nick} @ ${item.time}`
43
+ commentLink.href = root + item.href
44
+ commentLink['data-pjax-state'] = 'data-pjax-state'
45
+ commentEl.className = 'item'
46
+
47
+ commentText.appendChild(document.createElement('br'))
48
+ commentLink.appendChild(commentTime)
49
+ commentLink.appendChild(commentText)
50
+ commentEl.appendChild(commentLink)
51
+ newComments.appendChild(commentEl)
52
+ })
53
+
54
+ $dom('#new-comment').appendChild(newComments)
41
55
  }
@@ -72,35 +72,33 @@ export const siteRefresh = (reload) => {
72
72
  sideBarTab()
73
73
  sidebarTOC()
74
74
 
75
- if (LOCAL.ispost) {
76
- import('../page/post').then(({ postBeauty }) => {
77
- postBeauty()
78
- })
75
+ import('../page/post').then(({ postBeauty }) => {
76
+ postBeauty()
77
+ })
79
78
 
80
- const comment = new IntersectionObserver((entries) => {
81
- entries.forEach((entry) => {
82
- if (entry.isIntersecting) {
83
- if (__shokax_waline__) {
84
- import('../components/comments').then(({ walinePageview, walineComment }) => {
85
- walinePageview()
86
- walineComment()
87
- })
88
- }
89
- if (__shokax_twikoo__) {
90
- import('../components/tcomments').then(({ twikooComment }) => {
91
- twikooComment()
92
- })
93
- }
94
- comment.disconnect()
79
+ const comment = new IntersectionObserver((entries) => {
80
+ entries.forEach((entry) => {
81
+ if (entry.isIntersecting) {
82
+ if (__shokax_waline__) {
83
+ import('../components/comments').then(({ walinePageview, walineComment }) => {
84
+ walinePageview()
85
+ walineComment()
86
+ })
95
87
  }
96
- })
97
- }, {
98
- root: null,
99
- threshold: 0.2
88
+ if (__shokax_twikoo__) {
89
+ import('../components/tcomments').then(({ twikooComment }) => {
90
+ twikooComment()
91
+ })
92
+ }
93
+ comment.disconnect()
94
+ }
100
95
  })
96
+ }, {
97
+ root: null,
98
+ threshold: 0.2
99
+ })
101
100
 
102
- comment.observe($dom('#copyright'))
103
- }
101
+ comment.observe($dom('#copyright'))
104
102
 
105
103
  lazyLoad()
106
104
 
@@ -55,6 +55,7 @@ const siteInit = () => {
55
55
  })
56
56
 
57
57
  // Handle and trigger popup window
58
+ // search 只有一个,不需要 each
58
59
  $dom.each('.search', (element) => {
59
60
  element.addEventListener('click', () => {
60
61
  document.body.style.overflow = 'hidden'