hexo-theme-shokax 0.0.1-alpha6 → 0.0.2-alpha2

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/README.md CHANGED
@@ -7,7 +7,9 @@
7
7
  此项目是shoka的一个二次开发版(算精神续作),致力于提高性能和优化魔改体验 \
8
8
  诞生原因是目前shoka已经两年没有更新了,积压了大量BUG和功能请求。\
9
9
  本项目处于高强度开发期,但github仓库版本已基本可用 \
10
- 二次开发与常见问题请看wiki
10
+ 二次开发与常见问题请看wiki \
11
+ `0.0.2-alpha2`开始,`lantern`和`qweather`已迁移为插件 \
12
+ 插件系统已完工,食用方法见[awesome-shokaX](https://github.com/zkz098/awesome-shokaX)
11
13
 
12
14
  ## 待办名单
13
15
  - [x] 推出一个可用的测试版
@@ -17,7 +19,7 @@
17
19
  - [x] 注入js和css支持
18
20
  - [x] 自定义font
19
21
  - [x] 部分功能调整为可关闭
20
- - [ ] 插件系统
22
+ - [x] 插件系统
21
23
 
22
24
  ## 和shoka的区别
23
25
  原先shoka使用了javascript+Native+nunjucks的技术 \
package/_config.yml CHANGED
@@ -47,11 +47,6 @@ auto_dark: # 自动亮/暗模式
47
47
  start: 20 #开始时间
48
48
  end: 7 #结束时间
49
49
 
50
- plugin:
51
- enable: false
52
- load:
53
- # - example
54
-
55
50
  auto_scroll: true
56
51
 
57
52
  loader:
@@ -1,4 +1,5 @@
1
1
  mixin CommentRender()
2
+ != shokax_inject('comment')
2
3
  - var tk = theme?.twikoo?.enable,wl = theme?.waline?.enable
3
4
  if page.comment !== false
4
5
  if tk
@@ -8,3 +9,4 @@ mixin CommentRender()
8
9
  div(class="warp" id="wcomments")
9
10
  != _init_comments("waline")
10
11
 
12
+
@@ -36,5 +36,5 @@ div(class="status")
36
36
  img(src=theme.statics + theme.assets + '/' + theme.footer.icp.icon style="max-width: 2em;display:inline;")
37
37
  != beianN
38
38
 
39
- != insert_footer()
39
+ != shokax_inject('footer')
40
40
 
@@ -14,6 +14,5 @@ nav(id="nav")
14
14
  i(class="ic" :class="{'i-sun': !themeStatus,'i-moon': themeStatus}")
15
15
  li(class="item search")
16
16
  i(class="ic i-search")
17
- li(class="item weather")
18
- div(id="he-plugin-simple")
17
+ != shokax_inject('rightNav')
19
18
 
@@ -7,6 +7,7 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
7
7
  head
8
8
  != partial('_partials/head/head.pug', {}, {cache: true})
9
9
  != partial('_partials/head/head_com.pug')
10
+ != shokax_inject('head')
10
11
  title
11
12
  block title
12
13
  != `${alternate?alternate + " = ":""}${title}${subtitle?" = "+subtitle:""}`
@@ -133,10 +134,11 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
133
134
  != _vendor_js()
134
135
  != _js('app.js')
135
136
  != partial('_partials/third-party/baidu-analytics.pug', {}, {cache: true})
136
- != partial('_partials/third-party/qweather.pug', {}, {cache: true})
137
+ if theme.qweather.enable
138
+ != partial('_partials/third-party/qweather.pug', {}, {cache: true})
137
139
  != partial('_partials/third-party/clarity.pug', {}, {cache: true})
138
140
  != _new_comments('twikoo')
139
- if theme.qweather.enable
141
+
140
142
 
141
143
  - var jsInjects = theme?.inject?.body?.js,cssInjects = theme?.inject?.body?.css
142
144
  if cssInjects
@@ -145,5 +147,7 @@ html(lang=page.language?page.language:config.language, style=theme.grayMode ? 'f
145
147
  if jsInjects
146
148
  != js(jsInjects)
147
149
 
150
+ != shokax_inject('bodyEnd')
151
+
148
152
 
149
153
 
@@ -11,3 +11,4 @@ div(class="meta")
11
11
  != __('post.edited')
12
12
  time(title=__('post.modified') + __('symbol.colon') + full_date(post.updated) itemprop="dateModified" datetime=moment(post.updated).format())
13
13
  != date(post.updated)
14
+ != shokax_inject('postMeta')
@@ -1,4 +1,5 @@
1
- article(itemscope itemtype="http://schema.org/Article" class="post block" lang="{{ post.lang or config.language }}")
1
+ - var temp = post.lang || config.language
2
+ article(itemscope itemtype="http://schema.org/Article" class="post block" lang=temp)
2
3
  link(itemprop="mainEntityOfPage" href!=post.permalink)
3
4
  span(hidden itemprop="author" itemscope itemtype="http://schema.org/Person")
4
5
  meta(itemprop="image" content=url_for(theme.statics + theme.images + '/' + theme.sidebar.avatar))
@@ -24,3 +25,4 @@ article(itemscope itemtype="http://schema.org/Article" class="post block" lang="
24
25
  != partial('_partials/post/reward.pug', {}, {cache: true})
25
26
  if theme.creative_commons.license
26
27
  != partial('_partials/post/copyright.pug')
28
+ != shokax_inject('postBodyEnd')
@@ -35,6 +35,8 @@ div(class="social")
35
35
  - var sidebarIcon = '<i class="ic i-' + link.split('||')[1].trim() + '"></i>'
36
36
  != _url(sidebarURL, sidebarIcon, {title: sidebarURL, class: 'item ' + name})
37
37
 
38
+ != shokax_inject('sidebar')
39
+
38
40
  div(class="menu")
39
41
  //!= partial('_partials/sidebar/menu.pug', {}, {cache: true})
40
42
  != partial('_partials/sidebar/menu.pug')
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "hexo-theme-shokax",
3
- "version": "0.0.1-alpha6",
3
+ "version": "0.0.2-alpha2",
4
4
  "description": "a hexo theme based on shoka",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/zkz098/hexo-theme-shokaX",
7
7
  "author": "Chou kaitaku",
8
- "license": "MIT",
8
+ "license": "BSD-3-Clause",
9
9
  "scripts": {
10
10
  "test": "cd ./source/js && tsc"
11
11
  },
@@ -182,3 +182,9 @@ hexo.extend.helper.register('random_color', function () {
182
182
  b.toString(16).length > 1 ? b.toString(16) : '0' + b.toString(16)
183
183
  }`
184
184
  })
185
+
186
+ hexo.extend.helper.register('shokax_inject', function (point) {
187
+ return hexo.theme.config.injects[point]
188
+ .map(item => this.partial(item.layout, item.locals, item.options))
189
+ .join('')
190
+ })
@@ -1,6 +1,6 @@
1
1
  /* global hexo */
2
2
 
3
- // hexo.on('generateBefore', () => {
4
- // // 加载`theme_injects`过滤器
5
- // require('./lib/injects')(hexo);
6
- // });
3
+ hexo.on('generateBefore', () => {
4
+ // 加载`theme_injects`过滤器
5
+ require('./lib/injects')(hexo)
6
+ })
@@ -3,7 +3,6 @@
3
3
  module.exports = {
4
4
  views: [
5
5
  'head',
6
- 'header',
7
6
  'sidebar',
8
7
  'rightNav',
9
8
  'postMeta',
@@ -1,7 +1,13 @@
1
1
  @import "_variables";
2
2
 
3
+ for $inject_variable in hexo-config('injects.variable')
4
+ @import $inject_variable;
5
+
3
6
  @import "_mixins";
4
7
 
8
+ for $inject_mixin in hexo-config('injects.mixin')
9
+ @import $inject_mixin;
10
+
5
11
  if $colors = hexo-config('style.colors')
6
12
  @import $colors;
7
13
  else
@@ -24,4 +30,7 @@ else
24
30
  if $custom = hexo-config('style.custom')
25
31
  @import $custom;
26
32
 
27
- @import "plugin.styl"
33
+ for $inject_style in hexo-config('injects.style')
34
+ @import $inject_style;
35
+
36
+
@@ -1,35 +0,0 @@
1
- script.
2
- WIDGET = {
3
- "CONFIG": {
4
- "modules": "012",
5
- "background": "5",
6
- "tmpColor": "var(--text-color);",
7
- "tmpSize": "16",
8
- "cityColor": "var(--text-color);",
9
- "citySize": "16",
10
- "aqiColor": "FFFFFF",
11
- "aqiSize": "16",
12
- "weatherIconSize": "24",
13
- "alertIconSize": "18",
14
- "padding": "10px 10px 10px 10px",
15
- "shadow": "0",
16
- "language": "auto",
17
- "borderRadius": "5",
18
- "fixed": "false",
19
- "vertical": "top",
20
- "horizontal": "left",
21
- "key": "#{theme.qweather.key}"
22
- }
23
- }
24
-
25
- script.
26
- (function (d) {
27
- const c = d.createElement('link')
28
- c.rel = 'stylesheet'
29
- c.href = 'https://widget.qweather.net/simple/static/css/he-simple.css?v=1.4.0'
30
- const s = d.createElement('script')
31
- s.src = 'https://widget.qweather.net/simple/static/js/he-simple.js?v=1.4.0'
32
- const sn = d.getElementsByTagName('script')[0]
33
- sn.parentNode.insertBefore(c, sn)
34
- sn.parentNode.insertBefore(s, sn)
35
- })(document)
@@ -1,174 +0,0 @@
1
- .deng-box {
2
- position: fixed;
3
- top: -40px;
4
- right: -20px;
5
- z-index: 99;
6
- }
7
- .deng-box1 {
8
- position: fixed;
9
- top: -30px;
10
- right: 10px;
11
- z-index: 99;
12
- .deng {
13
- position: relative;
14
- width: 120px;
15
- height: 90px;
16
- margin: 50px;
17
- background: #d8000f;
18
- background: rgba(216, 0, 15, 0.8);
19
- border-radius: 50% 50%;
20
- -webkit-transform-origin: 50% -100px;
21
- -webkit-animation: swing 5s infinite ease-in-out;
22
- box-shadow: -5px 5px 30px 4px rgba(252, 144, 61, 1);
23
- }
24
- }
25
- .deng {
26
- position: relative;
27
- width: 120px;
28
- height: 90px;
29
- margin: 50px;
30
- background: #d8000f;
31
- background: rgba(216, 0, 15, 0.8);
32
- border-radius: 50% 50%;
33
- -webkit-transform-origin: 50% -100px;
34
- -webkit-animation: swing 3s infinite ease-in-out;
35
- box-shadow: -5px 5px 50px 4px rgba(250, 108, 0, 1);
36
- &:before {
37
- position: absolute;
38
- top: -7px;
39
- left: 29px;
40
- height: 12px;
41
- width: 60px;
42
- content: " ";
43
- display: block;
44
- z-index: 999;
45
- border-radius: 5px 5px 0 0;
46
- border: solid 1px #dc8f03;
47
- background: #ffa500;
48
- background: linear-gradient(to right, #dc8f03, #ffa500, #dc8f03, #ffa500, #dc8f03);
49
- }
50
- &:after {
51
- position: absolute;
52
- bottom: -7px;
53
- left: 10px;
54
- height: 12px;
55
- width: 60px;
56
- content: " ";
57
- display: block;
58
- margin-left: 20px;
59
- border-radius: 0 0 5px 5px;
60
- border: solid 1px #dc8f03;
61
- background: #ffa500;
62
- background: linear-gradient(to right, #dc8f03, #ffa500, #dc8f03, #ffa500, #dc8f03);
63
- }
64
- }
65
- .deng-a {
66
- width: 100px;
67
- height: 90px;
68
- background: #d8000f;
69
- background: rgba(216, 0, 15, 0.1);
70
- margin: 12px 8px 8px 10px;
71
- border-radius: 50% 50%;
72
- border: 2px solid #dc8f03;
73
- }
74
- .deng-b {
75
- width: 45px;
76
- height: 90px;
77
- background: #d8000f;
78
- background: rgba(216, 0, 15, 0.1);
79
- margin: -4px 8px 8px 26px;
80
- border-radius: 50% 50%;
81
- border: 2px solid #dc8f03;
82
- }
83
- .xian {
84
- position: absolute;
85
- top: -20px;
86
- left: 60px;
87
- width: 2px;
88
- height: 20px;
89
- background: #dc8f03;
90
- }
91
- .shui-a {
92
- position: relative;
93
- width: 5px;
94
- height: 20px;
95
- margin: -5px 0 0 59px;
96
- -webkit-animation: swing 4s infinite ease-in-out;
97
- -webkit-transform-origin: 50% -45px;
98
- background: #ffa500;
99
- border-radius: 0 0 5px 5px;
100
- }
101
- .shui-b {
102
- position: absolute;
103
- top: 14px;
104
- left: -2px;
105
- width: 10px;
106
- height: 10px;
107
- background: #dc8f03;
108
- border-radius: 50%;
109
- }
110
- .shui-c {
111
- position: absolute;
112
- top: 18px;
113
- left: -2px;
114
- width: 10px;
115
- height: 35px;
116
- background: #ffa500;
117
- border-radius: 0 0 0 5px;
118
- }
119
- .deng-t {
120
- font-size: 3.2rem;
121
- color: #dc8f03;
122
- font-weight: bold;
123
- line-height: 85px;
124
- text-align: center;
125
- }
126
- .night .deng-t,
127
- .night .deng-box,
128
- .night .deng-box1 {
129
- background: transparent !important;
130
- }
131
- @-moz-keyframes swing {
132
- 0% {
133
- -moz-transform: rotate(-10deg)
134
- }
135
- 50% {
136
- -moz-transform: rotate(10deg)
137
- }
138
- 100% {
139
- -moz-transform: rotate(-10deg)
140
- }
141
- }
142
-
143
- @-webkit-keyframes swing {
144
- 0% {
145
- -webkit-transform: rotate(-10deg)
146
- }
147
- 50% {
148
- -webkit-transform: rotate(10deg)
149
- }
150
- 100% {
151
- -webkit-transform: rotate(-10deg)
152
- }
153
- }
154
-
155
- @keyframes swing {
156
- 0% {
157
- -webkit-transform: rotate(-10deg)
158
- }
159
- 50% {
160
- -webkit-transform: rotate(10deg)
161
- }
162
- 100% {
163
- -webkit-transform: rotate(-10deg)
164
- }
165
- }
166
-
167
- @media (max-width: 870px){
168
- .s-sticker-tmp ,.s-sticker-city{
169
- display: none !important;
170
- }
171
- .s-sticker {
172
- padding: 0
173
- }
174
- }