hexo-theme-shokax 0.4.16 → 0.5.0-dev-58aa58e

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,43 +1,23 @@
1
- # 📣 公告
2
- [你的 ShokaX Shoka 站点可能正在遭遇供应链攻击](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/293) \
3
- [关于 ShokaX 部署平台和 Astro 迁移的调查](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/229)
4
-
5
- # hexo-theme-shokaX
6
- ![LICENSE]( https://img.shields.io/github/license/theme-shoka-x/hexo-theme-shokaX)
7
- ![stars](https://img.shields.io/github/stars/theme-shoka-x/hexo-theme-shokaX)
8
- ![version](https://shields.io/npm/v/hexo-theme-shokax)
9
- ![build](https://img.shields.io/github/actions/workflow/status/theme-shoka-x/hexo-theme-shokaX/build-theme.yml)
10
-
11
- #### 语言(language): 简体中文 | [English](./README_en.MD) \
12
- 此项目是shoka的一个二次开发版(算精神续作),致力于提高性能和优化魔改体验 \
13
- 诞生原因是目前shoka已经三年没有更新了,积压了大量BUG和功能请求。
14
-
15
- shokaX的社区资源导航和插件仓库为[awesome-shokaX](https://github.com/theme-shoka-x/awesome-shokaX)
16
-
17
- ## 💬 和shoka的区别
18
- 原先shoka使用了javascript+Native+nunjucks的技术 \
19
- 而shokaX则使用了typescript+Vue 3+Pug的技术搭配 \
20
- 更改了大量难以访问的CDN链接
21
-
22
- ## ✨ 功能清单
23
-
24
- | 功能名称 | 实现状态 | 功能名称 | 实现状态 |
25
- |:--------:|:----:|:------------:|:----:|
26
- | PWA支持 | ✅ | JSD拆分 | ✅ |
27
- | 注入API | ✅ | 社区插件系统 | ✅ |
28
- | 自定义字体 | ✅* | 自定义样式 | ✅* |
29
- | 多种评论系统支持 | ✅ | AI生成文章概括 | 🔬 |
30
- | 底部备案号 | ✅ | 自定义页尾 | ✅* |
31
- | CSS渐变封面 | ✅ | typescript支持 | ✅ |
32
-
33
- 备注:
34
- - *: 需要使用注入API实现
35
- - 🔬: 实验中,可能存在问题
36
-
37
-
38
- ## 🔧 如何安装?
39
- 注意: 本项目需要 node.js 18.x 或更高版本才能运行 \
40
- 见文档中[如何安装](https://docs-hexo.shokax.top/getting-started/)部分
1
+ **🏗️ 当前分支为 ShokaX 0.5 Dev分支,不建议普通用户使用** \
2
+ 此分支为 ShokaX 0.5 实验性变更分支,确保0.5开发期间0.4的维护不受影响
3
+
4
+ 计划更改:
5
+ - 移除 pjax
6
+ - 移除 quicklink
7
+ - 移除 assetUrl 为基的动态 Vendor 机制
8
+ - 移除 ShokaX Inject
9
+ - 引入新的 Inject 类技术 (长期)
10
+ - 引入新的工作流程
11
+ - 引入 CI 自动测试
12
+ - 重构 player (暂时移除)
13
+ - 优化 menu 配置格式
14
+ - 优化和异步化 Smart Bundle 技术
15
+ - 优化 CSS 结构和加载
16
+ - 修复/重置 fancybox
17
+ - 修复模板长期遗留问题
18
+ - 修复 images 遗留问题
19
+ - 规范化配置文件
20
+ - 规范化文档
41
21
 
42
22
  ## 📚子项目
43
23
  - [ShokaX docs](https://github.com/theme-shoka-x/shokaX-docs) ShokaX 主题文档 (正在编写中,欢迎加入!)
package/_images.yml CHANGED
@@ -1,9 +1,2 @@
1
1
  # 此images已失效,见https://github.com/theme-shoka-x/hexo-theme-shokaX/issues/6
2
- - 6833939bly1giciryrr3rj20zk0m8nhk.jpg
3
- - 6833939bly1gicis081o9j20zk0m8dmr.jpg
4
- - 6833939bly1gicis3attqj20zk0m8k7l.jpg
5
- - 6833939bly1giciszlczyj20zk0m816d.jpg
6
- - 6833939bly1gicit31ffoj20zk0m8naf.jpg
7
- - 6833939bly1gicit4jrvuj20zk0m8785.jpg
8
- - 6833939bly1gicitcxhpij20zk0m8hdt.jpg
9
2
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.4.16",
3
+ "version": "0.5.0-dev-58aa58e",
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",
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "@algolia/client-search": "^5.5.3",
31
31
  "@waline/client": "^3.3.2",
32
- "algoliasearch": "5.5.3",
32
+ "algoliasearch": "5.10.2",
33
33
  "esbuild": "^0.24.0",
34
34
  "hexo": "^7.3.0",
35
35
  "hexo-algoliasearch": "^2.0.1",
@@ -65,4 +65,4 @@
65
65
  "object.values": "npm:@nolyfill/object.values@latest"
66
66
  }
67
67
  }
68
- }
68
+ }
@@ -74,7 +74,6 @@ export const walineRecentComments = async function () {
74
74
  commentTime.className = 'breadcrumb'
75
75
  commentTime.innerText = `${item.nick} @ ${item.time}`
76
76
  commentLink.href = root + item.href
77
- commentLink['data-pjax-state'] = 'data-pjax-state'
78
77
  commentEl.className = 'item'
79
78
 
80
79
  commentText.appendChild(document.createElement('br'))
@@ -40,7 +40,6 @@ export const twikooRecentComments = async function () {
40
40
  commentTime.className = 'breadcrumb'
41
41
  commentTime.innerText = `${item.nick} @ ${item.time}`
42
42
  commentLink.href = root + item.href
43
- commentLink['data-pjax-state'] = 'data-pjax-state'
44
43
  commentEl.className = 'item'
45
44
 
46
45
  commentText.appendChild(document.createElement('br'))
@@ -1,5 +1,3 @@
1
- import { $dom } from '../library/dom'
2
- import Pjax from 'theme-shokax-pjax'
3
1
  import initProto from '../library/proto'
4
2
 
5
3
  export const CONFIG = shokax_CONFIG
@@ -29,7 +27,6 @@ export let oWinHeight = window.innerHeight
29
27
  export let oWinWidth = window.innerWidth
30
28
  export let LOCAL_HASH = 0
31
29
  export let LOCAL_URL = window.location.href
32
- export let pjax:Pjax
33
30
 
34
31
  export function setSiteNavHeight (value:number):void {
35
32
  siteNavHeight = value
@@ -66,10 +63,6 @@ export function setLocalUrl (value:string):void {
66
63
  LOCAL_URL = value
67
64
  }
68
65
 
69
- export function setPjax (value:Pjax):void {
70
- pjax = value
71
- }
72
-
73
66
  export function setOriginTitle (value:string):void {
74
67
  originTitle = value
75
68
  }
@@ -1,4 +1,3 @@
1
- import { getScript } from './scriptPjax'
2
1
  import { CONFIG } from '../globals/globalVars'
3
2
  import { createChild } from './proto'
4
3
 
@@ -19,9 +18,7 @@ const assetUrl = (asset: string, type: string): string => {
19
18
 
20
19
  export const vendorJs = (type: string, callback?: Function, condition?: string) => {
21
20
  if (LOCAL[type]) {
22
- getScript(assetUrl('js', type),CONFIG['js'][type].sri, callback || function () {
23
- window[type] = true
24
- }, condition || window[type])
21
+ assetUrl('js', type)
25
22
  }
26
23
  }
27
24
 
@@ -231,15 +231,15 @@ export const postBeauty = () => {
231
231
  element.className = ['primary', 'success', 'info', 'warning', 'danger'][Math.floor(Math.random() * 5)]
232
232
  })
233
233
 
234
- if (__shokax_player__) {
235
- $dom.each('.md div.player', (element) => {
236
- mediaPlayer(element, {
237
- type: element.getAttribute('data-type'),
238
- mode: 'order',
239
- btns: []
240
- }).player.load(JSON.parse(element.getAttribute('data-src'))).fetch()
241
- })
242
- }
234
+ // if (__shokax_player__) {
235
+ // $dom.each('.md div.player', (element) => {
236
+ // mediaPlayer(element, {
237
+ // type: element.getAttribute('data-type'),
238
+ // mode: 'order',
239
+ // btns: []
240
+ // }).player.load(JSON.parse(element.getAttribute('data-src'))).fetch()
241
+ // })
242
+ // }
243
243
 
244
244
  const angleDown = document.querySelectorAll('.show-btn .i-angle-down')
245
245
  if (angleDown.length) {
@@ -5,7 +5,7 @@ import type { HitHighlightResult } from 'instantsearch.js/es/types/results'
5
5
  import instantsearch from 'instantsearch.js'
6
6
  import { liteClient as algoliasearch } from 'algoliasearch/lite'
7
7
 
8
- export function algoliaSearch (pjax) {
8
+ export function algoliaSearch () {
9
9
  const search = instantsearch({
10
10
  indexName: CONFIG.search.indexName,
11
11
  searchClient: algoliasearch(CONFIG.search.appID, CONFIG.search.apiKey),
@@ -18,10 +18,6 @@ export function algoliaSearch (pjax) {
18
18
  }
19
19
  })
20
20
 
21
- search.on('render', () => {
22
- pjax.refresh(document.getElementById("search-hits"))
23
- })
24
-
25
21
  // Registering Widgets
26
22
  search.addWidgets([
27
23
  configure({
@@ -105,7 +101,7 @@ export function algoliaSearch (pjax) {
105
101
  }
106
102
  })
107
103
  document.querySelector('.close-btn').addEventListener('click', onPopupClose)
108
- window.addEventListener('pjax:success', onPopupClose)
104
+ // window.addEventListener('pjax:success', onPopupClose)
109
105
  window.addEventListener('keyup', (event) => {
110
106
  if (event.key === 'Escape') {
111
107
  onPopupClose()
@@ -45,13 +45,13 @@ export default function domInit () {
45
45
  goToComment.addEventListener('click', goToCommentHandle)
46
46
  showContents.addEventListener('click', sideBarToggleHandle)
47
47
 
48
- if (__shokax_player__) {
49
- mediaPlayer(toolPlayer)
50
-
51
- document.querySelector('main').addEventListener('click', () => {
52
- toolPlayer.player.mini()
53
- })
54
- }
48
+ // if (__shokax_player__) {
49
+ // mediaPlayer(toolPlayer)
50
+ //
51
+ // document.querySelector('main').addEventListener('click', () => {
52
+ // toolPlayer.player.mini()
53
+ // })
54
+ // }
55
55
 
56
56
  const createIntersectionObserver = () => {
57
57
  // waves在视口外时停止动画
@@ -2,7 +2,6 @@ import { $dom } from '../library/dom'
2
2
  import { cardActive } from '../page/common'
3
3
  import { pageScroll, transition } from '../library/anime'
4
4
  import { vendorCss, vendorJs } from '../library/loadFile'
5
- import { pjaxScript } from '../library/scriptPjax'
6
5
  import { resizeHandle } from '../globals/handles'
7
6
  import {
8
7
  CONFIG,
@@ -61,10 +60,6 @@ export const siteRefresh = async (reload) => {
61
60
  lazyBg.observe(el)
62
61
  })
63
62
 
64
- if (reload !== 1) {
65
- $dom.each('script[data-pjax]', pjaxScript)
66
- }
67
-
68
63
  setOriginTitle(document.title)
69
64
 
70
65
  resizeHandle()
@@ -1,11 +1,10 @@
1
1
  import domInit from './domInit'
2
- import { pjaxReload, siteRefresh } from './refresh'
2
+ import { siteRefresh } from './refresh'
3
3
  import { cloudflareInit } from '../components/cloudflare'
4
- import { BODY, CONFIG, pjax, setPjax, setSiteSearch, siteSearch } from '../globals/globalVars'
4
+ import { BODY, CONFIG, setSiteSearch, siteSearch } from '../globals/globalVars'
5
5
  import { autoDarkmode, themeColorListener } from '../globals/themeColor'
6
6
  import { resizeHandle, scrollHandle, visibilityListener } from '../globals/handles'
7
7
  import { pagePosition } from '../globals/tools'
8
- import Pjax from 'theme-shokax-pjax'
9
8
  import { initVue } from '../library/vue'
10
9
  import { $dom } from '../library/dom'
11
10
  import { createChild } from '../library/proto'
@@ -15,18 +14,6 @@ const siteInit = async () => {
15
14
  initVue()
16
15
  domInit()
17
16
 
18
- setPjax(new Pjax({
19
- selectors: [
20
- 'head title',
21
- '.languages',
22
- '.twikoo',
23
- '.pjax',
24
- '.leancloud-recent-comment',
25
- 'script[data-config]'
26
- ],
27
- cacheBust: false
28
- }))
29
-
30
17
  CONFIG.quicklink.ignores = LOCAL.ignores
31
18
  import('quicklink').then(({listen}) => {
32
19
  listen(CONFIG.quicklink)
@@ -53,7 +40,7 @@ const siteInit = async () => {
53
40
  }
54
41
 
55
42
  import('../page/search').then(({algoliaSearch}) => {
56
- algoliaSearch(pjax)
43
+ algoliaSearch()
57
44
  })
58
45
 
59
46
  // Handle and trigger popup window
@@ -83,13 +70,13 @@ const siteInit = async () => {
83
70
  passive: true
84
71
  })
85
72
 
86
- window.addEventListener('pjax:send', pjaxReload, {
87
- passive: true
88
- })
73
+ // window.addEventListener('pjax:send', pjaxReload, {
74
+ // passive: true
75
+ // })
89
76
 
90
- window.addEventListener('pjax:success', siteRefresh, {
91
- passive: true
92
- }) // 默认会传入一个event参数
77
+ // window.addEventListener('pjax:success', siteRefresh, {
78
+ // passive: true
79
+ // }) // 默认会传入一个event参数
93
80
 
94
81
  window.addEventListener('beforeunload', () => {
95
82
  pagePosition()
@@ -1,3 +1,5 @@
1
+ // 临时性弃用,等待重构
2
+
1
3
  import { CONFIG, originTitle } from './globals/globalVars'
2
4
  import { showtip } from './globals/tools'
3
5
  import { pageScroll } from './library/anime'
@@ -0,0 +1,14 @@
1
+ import fs from 'node:fs';
2
+ import { execSync } from 'child_process';
3
+
4
+ const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
5
+ const currentVersion = packageJson.version;
6
+
7
+ const shortHash = execSync('git rev-parse --short HEAD').toString().trim();
8
+
9
+ const newVersion = `${currentVersion}-dev-${shortHash}`;
10
+
11
+ packageJson.version = newVersion;
12
+ fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 4));
13
+
14
+ console.log(`Updated package version to ${newVersion}`);
package/README_en.MD DELETED
@@ -1,75 +0,0 @@
1
- # 📣 Announcement
2
- [Your ShokaX and Shoka sites might be under a supply chain attack](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/293) \
3
- [Survey on ShokaX deployment platform and Astro migration](https://github.com/theme-shoka-x/hexo-theme-shokaX/discussions/229)
4
-
5
- # hexo-theme-shokaX
6
- ![LICENSE](https://img.shields.io/github/license/theme-shoka-x/hexo-theme-shokaX)
7
- ![stars](https://img.shields.io/github/stars/theme-shoka-x/hexo-theme-shokaX)
8
- ![version](https://shields.io/npm/v/hexo-theme-shokax)
9
- ![build](https://img.shields.io/github/actions/workflow/status/theme-shoka-x/hexo-theme-shokaX/build-theme.yml)
10
-
11
- #### Language: Simplified Chinese | [English](./README_en.MD) \
12
- This project is a secondary development version of Shoka (considered a spiritual successor), dedicated to improving performance and optimizing the custom modification experience. \
13
- The reason for its creation is that Shoka hasn't been updated for three years, accumulating a large number of bugs and feature requests.
14
-
15
- ShokaX's community resource guide and plugin repository can be found at [awesome-shokaX](https://github.com/theme-shoka-x/awesome-shokaX).
16
-
17
- ## 💬 Differences from Shoka
18
- The original Shoka used javascript+Native+nunjucks technology, \
19
- while ShokaX uses typescript+Vue 3+Pug technology. \
20
- Many inaccessible CDN links have been changed.
21
-
22
- ## ✨ Feature List
23
-
24
- | Feature Name | Status | Feature Name | Status |
25
- |:--------------------------------:|:------:|:----------------------------:|:------:|
26
- | PWA Support | ✅ | JSD Split | ✅ |
27
- | API Injection | ✅ | Community Plugin System | ✅ |
28
- | Custom Fonts | ✅* | Custom Styles | ✅* |
29
- | Multiple Comment Systems Support | ✅ | AI-Generated Article Summary | 🔬 |
30
- | Footer Record Number | ✅ | Custom Footer | ✅* |
31
- | CSS Gradient Cover | ✅ | Typescript Support | ✅ |
32
-
33
- Notes:
34
- - *: Requires API injection
35
- - 🔬: Experimental, may have issues
36
-
37
- ## 🔧 How to Install?
38
- Note: This project requires node.js version 18.x or higher to run. \
39
- See the [installation guide](https://docs-hexo.shokax.top/getting-started/) in the documentation.
40
-
41
- ## 📚 Sub-Projects
42
- - [ShokaX docs](https://github.com/theme-shoka-x/shokaX-docs) ShokaX theme documentation (currently being written, feel free to join!)
43
- - [HRMNMI](https://github.com/theme-shoka-x/hexo-renderer-multi-next-markdown-it) Markdown renderer used by ShokaX (awaiting refactoring)
44
- - [ShokaX Pjax](https://github.com/theme-shoka-x/theme-shokax-pjax) Efficient Pjax implementation provided by ShokaX
45
- - [ShokaX Anime](https://github.com/theme-shoka-x/theme-shokax-anime) Simplified version of Anime.js provided by ShokaX
46
-
47
- # [License](https://github.com/theme-shoka-x/hexo-theme-shokaX/blob/main/LICENSE)
48
- License: AGPL 3 or later
49
-
50
- ## Special Notes
51
- The AGPL license primarily aims to restrict modified distribution behavior to avoid unauthorized secondary modifications and commercial packaging. \
52
- Any modifications to the source code **must** be open-sourced because, according to the AGPL license, building a website requires the modified portions to be open-sourced.
53
-
54
- ## Special Usage Instructions
55
- According to AGPLv3 Section 7, we have added some additional terms: \
56
- Please see [Usage Restrictions](./UsageRestrictions.md). By using ShokaX, you acknowledge this file's content.
57
-
58
- # Acknowledgements
59
- ## Open Source Projects
60
- | Name | Author | Description |
61
- |:----------------:|:-----------------:|:--------------------------------------------:|
62
- | Hexo | Hexo contributors | Provided a great foundation for this project |
63
- | hexo-theme-shoka | amehime | Parent theme of this project |
64
-
65
- ## Developers
66
- Hexo theme: \
67
- [![](https://contributors-img.web.app/image?repo=theme-shoka-x/hexo-theme-shokaX)](https://github.com/theme-shoka-x/hexo-theme-shokaX/graphs/contributors) \
68
- ShokaX documentation: \
69
- [![](https://contributors-img.web.app/image?repo=theme-shoka-x/shokaX-docs)](https://github.com/theme-shoka-x/shokaX-docs/graphs/contributors)
70
-
71
- ## Special Thanks
72
- [<img src="https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.png" width="25%">](https://jb.gg/OpenSourceSupport)
73
-
74
- ## Other Information
75
- ![Star history chart](https://api.star-history.com/svg?repos=theme-shoka-x/hexo-theme-shokaX&type=Date)
@@ -1,56 +0,0 @@
1
- export const getScript = (url: string,sri: string, callback?: Function, condition?: string): void => {
2
- // url: 脚本文件的URL地址
3
- // callback: 当脚本加载完成时要执行的回调函数
4
- // condition: 可选的条件参数,如果存在,则执行callback
5
- if (condition) {
6
- // 如果条件存在,则执行回调函数
7
- callback()
8
- } else {
9
- let script = document.createElement('script')
10
-
11
- // @ts-ignore
12
- script.onload = function (_, isAbort: boolean) {
13
- // _: 事件对象
14
- // isAbort: 是否中止
15
- // @ts-ignore
16
- if (isAbort || !script.readyState) {
17
- console.log('abort!')
18
- script.onload = null
19
- script = undefined
20
- if (!isAbort && callback) setTimeout(callback, 0)
21
- }
22
- }
23
- script.src = url
24
- script.integrity = sri
25
- script.crossOrigin = 'anonymous'
26
- document.head.appendChild(script)
27
- }
28
- }
29
-
30
- export const pjaxScript = (element: HTMLScriptElement) => {
31
- const { text, parentNode, id, className, type, src, dataset } = element
32
- const code = text || element.textContent || element.innerHTML || ''
33
- parentNode.removeChild(element)
34
- const script = document.createElement('script')
35
- if (id) {
36
- script.id = id
37
- }
38
- if (className) {
39
- script.className = className
40
- }
41
- if (type) {
42
- script.type = type
43
- }
44
- if (src) {
45
- // Force synchronous loading of peripheral JS.
46
- script.src = src
47
- script.async = false
48
- }
49
- if (dataset.pjax !== undefined) {
50
- script.dataset.pjax = ''
51
- }
52
- if (code !== '') {
53
- script.appendChild(document.createTextNode(code))
54
- }
55
- parentNode.appendChild(script)
56
- }