hexo-theme-shokax 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
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",
@@ -47,7 +47,9 @@ hexo.on('generateBefore', () => {
47
47
  });
48
48
  hexo.on('generateAfter', () => {
49
49
  // 检查版本更新
50
- fetch('https://api.shokax.top/version/hexo').then((res) => {
50
+ fetch('https://api.shokax.top/version/hexo', { headers: {
51
+ "User-Agent": "Mozilla/5.0 ShokaX Client (hexo-theme-shokax)"
52
+ } }).then((res) => {
51
53
  res.json().then((resp) => {
52
54
  try {
53
55
  const latest = resp['version'];
@@ -76,29 +76,32 @@ export const siteRefresh = (reload) => {
76
76
  postBeauty()
77
77
  })
78
78
 
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
- })
87
- }
88
- if (__shokax_twikoo__) {
89
- import('../components/tcomments').then(({ twikooComment }) => {
90
- twikooComment()
91
- })
79
+ const cpel = $dom('#copyright')
80
+ if (cpel) {
81
+ const comment = new IntersectionObserver((entries) => {
82
+ entries.forEach((entry) => {
83
+ if (entry.isIntersecting) {
84
+ if (__shokax_waline__) {
85
+ import('../components/comments').then(({walinePageview, walineComment}) => {
86
+ walinePageview()
87
+ walineComment()
88
+ })
89
+ }
90
+ if (__shokax_twikoo__) {
91
+ import('../components/tcomments').then(({twikooComment}) => {
92
+ twikooComment()
93
+ })
94
+ }
95
+ comment.disconnect()
92
96
  }
93
- comment.disconnect()
94
- }
97
+ })
98
+ }, {
99
+ root: null,
100
+ threshold: 0.2
95
101
  })
96
- }, {
97
- root: null,
98
- threshold: 0.2
99
- })
100
102
 
101
- comment.observe($dom('#copyright'))
103
+ comment.observe(cpel)
104
+ }
102
105
 
103
106
  lazyLoad()
104
107