hexo-theme-solitude 2.0.4 → 2.0.6
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/.editorconfig +9 -0
- package/README.md +2 -2
- package/README_zh-Hans.md +1 -1
- package/README_zh-Hant.md +2 -2
- package/_config.yml +17 -16
- package/languages/default.yml +8 -3
- package/languages/en.yml +8 -3
- package/languages/zh-CN.yml +8 -3
- package/languages/zh-TW.yml +8 -3
- package/layout/includes/inject/body.pug +4 -4
- package/layout/includes/inject/head.pug +2 -2
- package/layout/includes/loading.pug +14 -2
- package/layout/includes/page/says.pug +5 -5
- package/layout/includes/widgets/home/bbTimeList.pug +3 -3
- package/package.json +8 -5
- package/scripts/event/merge_config.js +4 -4
- package/scripts/event/welcome.js +2 -2
- package/scripts/helper/stylus.js +1 -1
- package/scripts/tags/mermaid.js +1 -1
- package/scripts/tags/tabs.js +11 -15
- package/source/css/_comments/twikoo.styl +7 -58
- package/source/css/_global/index.styl +1 -1
- package/source/css/_layout/header.styl +3 -2
- package/source/css/_page/_home/home-top.styl +1 -2
- package/source/css/_page/links.styl +102 -100
- package/source/css/_page/other.styl +6 -1
- package/source/css/_page/says.styl +3 -2
- package/source/css/_post/copyright.styl +7 -2
- package/source/css/_tags/mermaid.styl +1 -1
- package/source/css/_tags/tabs.styl +1 -1
- package/source/js/main.js +2 -2
- package/source/js/third_party/waterfall.min.js +5 -1
- package/scripts/tags/btns.js +0 -35
- package/scripts/tags/button.js +0 -21
- package/scripts/tags/bvideo.js +0 -7
- package/scripts/tags/checkbox.js +0 -51
- package/scripts/tags/fold.js +0 -13
- package/scripts/tags/image.js +0 -75
- package/scripts/tags/inline-image.js +0 -12
- package/scripts/tags/label.js +0 -10
- package/scripts/tags/link.js +0 -50
- package/scripts/tags/media.js +0 -29
- package/scripts/tags/note.js +0 -13
- package/scripts/tags/span.js +0 -17
- package/scripts/tags/timeline.js +0 -22
- package/source/css/_tags/btns.styl +0 -212
- package/source/css/_tags/button.styl +0 -40
- package/source/css/_tags/checkbox.styl +0 -204
- package/source/css/_tags/fold.styl +0 -65
- package/source/css/_tags/image.styl +0 -4
- package/source/css/_tags/index.styl +0 -63
- package/source/css/_tags/label.styl +0 -4
- package/source/css/_tags/link.styl +0 -59
- package/source/css/_tags/media.styl +0 -57
- package/source/css/_tags/note.styl +0 -104
- package/source/css/_tags/span.styl +0 -34
- package/source/css/_tags/timeline.styl +0 -82
@@ -148,9 +148,10 @@
|
|
148
148
|
|
149
149
|
div
|
150
150
|
padding 0
|
151
|
+
margin-left .5rem
|
151
152
|
|
152
153
|
.nav-button
|
153
|
-
margin-left
|
154
|
+
margin-left .5rem
|
154
155
|
cursor pointer
|
155
156
|
|
156
157
|
a
|
@@ -953,4 +954,4 @@ if hexo-config('nav.group')
|
|
953
954
|
if hexo-config('console.enable')
|
954
955
|
#nav-console
|
955
956
|
+maxWidth768()
|
956
|
-
display none
|
957
|
+
display none
|
@@ -270,7 +270,6 @@
|
|
270
270
|
border-radius 60px
|
271
271
|
margin-bottom 12px
|
272
272
|
color var(--efu-white)
|
273
|
-
width 100px
|
274
273
|
position relative
|
275
274
|
background-size 200%
|
276
275
|
|
@@ -281,4 +280,4 @@
|
|
281
280
|
background-position 100% 0
|
282
281
|
|
283
282
|
.banners-link-title
|
284
|
-
margin
|
283
|
+
margin 0 .1rem 0 .5rem
|
@@ -22,6 +22,8 @@
|
|
22
22
|
.flink#article-container
|
23
23
|
margin-top 1rem
|
24
24
|
|
25
|
+
#article-container
|
26
|
+
|
25
27
|
.flink-desc
|
26
28
|
margin 0
|
27
29
|
color var(--efu-secondtext)
|
@@ -226,122 +228,122 @@
|
|
226
228
|
.flink-item-desc
|
227
229
|
display none
|
228
230
|
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
231
|
+
.flink-list-item
|
232
|
+
margin 6px 6px
|
233
|
+
transition .3s
|
234
|
+
border-radius 12px
|
235
|
+
transition-timing-function ease-in-out
|
236
|
+
position relative
|
237
|
+
width calc(20% - 12px)
|
238
|
+
border var(--style-border-always)
|
239
|
+
box-shadow var(--efu-shadow-border)
|
240
|
+
background var(--efu-card-bg)
|
241
|
+
display flex
|
242
|
+
float left
|
243
|
+
overflow hidden
|
244
|
+
height 90px
|
245
|
+
line-height 17px
|
246
|
+
transform translateZ(0)
|
245
247
|
|
246
|
-
|
247
|
-
|
248
|
+
+maxWidth1200()
|
249
|
+
width calc(25% - 12px)
|
248
250
|
|
249
|
-
|
250
|
-
|
251
|
+
+maxWidth1024()
|
252
|
+
width calc(33.3333% - 12px)
|
251
253
|
|
252
|
-
|
253
|
-
|
254
|
+
+maxWidth768()
|
255
|
+
width calc(50% - 12px)
|
254
256
|
|
255
|
-
|
256
|
-
|
257
|
+
+maxWidth600()
|
258
|
+
width calc(100% - 12px)
|
257
259
|
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
260
|
+
a
|
261
|
+
display flex
|
262
|
+
width 100%
|
263
|
+
height 100%
|
264
|
+
border none
|
265
|
+
align-items center
|
264
266
|
|
265
|
-
|
266
|
-
|
267
|
+
.img-alt
|
268
|
+
display none
|
267
269
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
.flink-item-info
|
280
|
-
display flex
|
281
|
-
flex-direction column
|
282
|
-
justify-content center
|
283
|
-
width calc(100% - 90px)
|
284
|
-
height fit-content
|
285
|
-
padding 0 4px
|
270
|
+
img
|
271
|
+
border-radius 32px
|
272
|
+
margin 15px 20px 15px 15px
|
273
|
+
transition .3s
|
274
|
+
background var(--efu-background)
|
275
|
+
min-width 60px
|
276
|
+
min-height 60px
|
277
|
+
float left
|
278
|
+
width 60px
|
279
|
+
height 60px
|
286
280
|
|
287
|
-
|
288
|
-
|
281
|
+
.flink-item-info
|
282
|
+
display flex
|
283
|
+
flex-direction column
|
284
|
+
justify-content center
|
285
|
+
width calc(100% - 90px)
|
286
|
+
height fit-content
|
287
|
+
padding 0 4px
|
289
288
|
|
290
|
-
|
291
|
-
|
292
|
-
font-size 19px
|
293
|
-
line-height 20px
|
294
|
-
color var(--efu-fontcolor)
|
295
|
-
display block
|
296
|
-
padding 0 10px 0 0
|
297
|
-
font-weight 700
|
298
|
-
max-width calc(100% - 12px)
|
299
|
-
overflow hidden
|
300
|
-
text-overflow ellipsis
|
301
|
-
white-space nowrap
|
289
|
+
span
|
290
|
+
transition .3s
|
302
291
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
292
|
+
.flink-item-name
|
293
|
+
text-align left
|
294
|
+
font-size 19px
|
295
|
+
line-height 20px
|
296
|
+
color var(--efu-fontcolor)
|
297
|
+
display block
|
298
|
+
padding 0 10px 0 0
|
299
|
+
font-weight 700
|
300
|
+
max-width calc(100% - 12px)
|
301
|
+
overflow hidden
|
302
|
+
text-overflow ellipsis
|
303
|
+
white-space nowrap
|
304
|
+
|
305
|
+
.flink-item-desc
|
306
|
+
white-space normal
|
307
|
+
padding 5px 10px 16px 0
|
308
|
+
color var(--efu-fontcolor)
|
309
|
+
text-align left
|
310
|
+
height 40px
|
311
|
+
text-overflow ellipsis
|
312
|
+
opacity .7
|
313
|
+
display -webkit-box
|
314
|
+
overflow hidden
|
315
|
+
-webkit-box-orient vertical
|
316
|
+
-webkit-line-clamp 2
|
317
|
+
font-size .93em
|
316
318
|
|
317
|
-
|
318
|
-
|
319
|
+
&:hover
|
320
|
+
background var(--efu-theme)
|
319
321
|
|
320
|
-
|
321
|
-
|
322
|
+
.site-card-tag
|
323
|
+
left: -50px
|
322
324
|
|
323
|
-
|
324
|
-
|
325
|
+
a
|
326
|
+
background 0 0
|
325
327
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
328
|
+
img
|
329
|
+
transition .6s
|
330
|
+
width 0
|
331
|
+
height 0
|
332
|
+
opacity 0
|
333
|
+
margin 5px
|
334
|
+
min-width 0
|
335
|
+
min-height 0
|
334
336
|
|
335
|
-
|
336
|
-
|
337
|
+
.flink-item-info
|
338
|
+
min-width calc(100% - 20px)
|
337
339
|
|
338
|
-
|
339
|
-
|
340
|
+
.flink-item-name
|
341
|
+
color var(--efu-card-bg)
|
340
342
|
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
343
|
+
.flink-item-desc
|
344
|
+
color var(--efu-card-bg)
|
345
|
+
overflow hidden
|
346
|
+
width 100%
|
345
347
|
|
346
348
|
@keyframes light_tag
|
347
349
|
0%
|
@@ -349,4 +351,4 @@
|
|
349
351
|
left -150px
|
350
352
|
99%
|
351
353
|
transform skewx(-25deg)
|
352
|
-
left 50px
|
354
|
+
left 50px
|
@@ -135,6 +135,11 @@ div#banners
|
|
135
135
|
font-weight 700
|
136
136
|
box-shadow var(--efu-shadow-blackdeep)
|
137
137
|
|
138
|
+
+maxWidth768()
|
139
|
+
.flink &
|
140
|
+
width 70px
|
141
|
+
height 70px
|
142
|
+
|
138
143
|
&:nth-child(even)
|
139
144
|
margin-top 1rem
|
140
145
|
transform translate(-60px)
|
@@ -269,4 +274,4 @@ div#banners
|
|
269
274
|
font-size 1.5rem
|
270
275
|
|
271
276
|
.banner-button-text
|
272
|
-
display none
|
277
|
+
display none
|
@@ -28,6 +28,7 @@ if hexo-config('says.home_mini')
|
|
28
28
|
margin 0
|
29
29
|
background var(--efu-background)
|
30
30
|
border none
|
31
|
+
padding 0 .2rem
|
31
32
|
i.bber-logo,
|
32
33
|
i.bber-gotobb
|
33
34
|
transition .3s
|
@@ -38,7 +39,7 @@ if hexo-config('says.home_mini')
|
|
38
39
|
color var(--efu-theme)
|
39
40
|
|
40
41
|
i.bber-logo
|
41
|
-
font-size 2rem
|
42
|
+
font-size 1.2rem
|
42
43
|
margin-right 1rem
|
43
44
|
|
44
45
|
i.bber-gotobb
|
@@ -367,4 +368,4 @@ if hexo-config('says.enable')
|
|
367
368
|
.li-style
|
368
369
|
&:hover
|
369
370
|
color var(--efu-theme)
|
370
|
-
transition .3s
|
371
|
+
transition .3s
|
@@ -85,6 +85,7 @@
|
|
85
85
|
color var(--efu-white)
|
86
86
|
cursor pointer
|
87
87
|
border-radius 4px
|
88
|
+
|
88
89
|
.social-share
|
89
90
|
display flex
|
90
91
|
justify-content center
|
@@ -114,6 +115,7 @@
|
|
114
115
|
.icon-qq
|
115
116
|
color #56b6e7
|
116
117
|
border-color #56b6e7
|
118
|
+
|
117
119
|
&:hover
|
118
120
|
background-color #56b6e7
|
119
121
|
|
@@ -151,18 +153,21 @@
|
|
151
153
|
|
152
154
|
&:hover
|
153
155
|
background-color #0077b5
|
156
|
+
|
154
157
|
.icon-whatsapp
|
155
158
|
color #25d366
|
156
159
|
border-color #25d366
|
157
160
|
|
158
161
|
&:hover
|
159
162
|
background-color #25d366
|
163
|
+
|
160
164
|
.icon-link
|
161
165
|
color #425AEF
|
162
166
|
border-color #425AEF
|
163
167
|
|
164
168
|
&:hover
|
165
169
|
background-color #425AEF
|
170
|
+
|
166
171
|
.icon-qrcode
|
167
172
|
position relative
|
168
173
|
color #000
|
@@ -194,7 +199,7 @@
|
|
194
199
|
|
195
200
|
.reward-dec
|
196
201
|
font-size 0.6rem
|
197
|
-
color var(--efu-fontcolor)!important
|
202
|
+
color var(--efu-fontcolor) !important
|
198
203
|
text-align center
|
199
204
|
|
200
205
|
#qrcode
|
@@ -210,4 +215,4 @@
|
|
210
215
|
|
211
216
|
img
|
212
217
|
width 132px
|
213
|
-
height 132px
|
218
|
+
height 132px
|
package/source/js/main.js
CHANGED
@@ -465,7 +465,7 @@ const addHighlight = () => {
|
|
465
465
|
const expandClass = !expand === true ? 'closed' : ''
|
466
466
|
const $syntaxHighlight = syntax === 'highlight.js' ? document.querySelectorAll('figure.highlight') : document.querySelectorAll('pre[class*="language-"]')
|
467
467
|
if (!(($isShowTool || limit) && $syntaxHighlight.length)) return
|
468
|
-
const copyEle = copy ? `<i class="solitude
|
468
|
+
const copyEle = copy ? `<i class="solitude fas fa-copy copy-button"></i>` : '<i></i>';
|
469
469
|
const expandEle = `<i class="solitude fas fa-angle-down expand"></i>`;
|
470
470
|
const limitEle = limit ? `<i class="solitude fas fa-angles-down"></i>` : '<i></i>';
|
471
471
|
const alertInfo = (ele, text) => utils.snackbarShow(text, false, 2000)
|
@@ -713,4 +713,4 @@ window.onkeydown = e => {
|
|
713
713
|
};
|
714
714
|
document.addEventListener('copy', () => {
|
715
715
|
utils.snackbarShow(GLOBAL_CONFIG.lang.copy.success, false, 3000);
|
716
|
-
});
|
716
|
+
});
|
@@ -1 +1,5 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* @license Copyright 2024 Ever Funnel. All rights reserved.
|
3
|
+
* Licensed under the MIT License.
|
4
|
+
*/
|
5
|
+
function waterfall(t){function e(t,e){var n=window.getComputedStyle(t);return parseFloat(n["margin"+e])||0}function n(t){return t+"px"}function r(t){return parseFloat(t.style.top)||0}function o(t){return parseFloat(t.style.left)||0}function i(t){return t.clientWidth}function l(t){return t.clientHeight}function u(t){return r(t)+l(t)+e(t,"Bottom")}function a(t){return o(t)+i(t)+e(t,"Right")}function s(t){t.sort(function(t,e){var n=u(t),r=u(e);return n===r?o(e)-o(t):r-n})}function f(e){i(t)!==containerWidth&&(window.removeEventListener(e.type,f),waterfall(t))}"string"==typeof t&&(t=document.querySelector(t));var c=Array.from(t.children).map(function(t){return t.style.position="absolute",t});t.style.position="relative";var p=Array.from(t.querySelectorAll("img")),y=p.map(function(t){return new Promise(function(e){t.complete?e():(t.addEventListener("load",e),t.addEventListener("error",e))})});Promise.all(y).then(function(){var r=[];c.length&&(c[0].style.top="0px",c[0].style.left=n(e(c[0],"Left")),r.push(c[0]));for(var l=1;l<c.length;l++){var p=c[l-1],y=c[l];if(!(a(p)+i(y)<=i(t)))break;y.style.top=p.style.top,y.style.left=n(a(p)),r.push(y)}for(var v=r.length;v<c.length;v++){s(r);var d=c[v],h=r.pop();d.style.top=n(u(h)+e(d,"Top")),d.style.left=n(o(h)),r.push(d)}s(r);var m=r[0];t.style.height=n(u(m)+e(m,"Bottom"));i(t);window.addEventListener("resize",f)})}
|
package/scripts/tags/btns.js
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
function postBtns(args, content) {
|
4
|
-
return `<div class="btns ${args.join(" ")}">
|
5
|
-
${content}
|
6
|
-
</div>`;
|
7
|
-
}
|
8
|
-
|
9
|
-
function postCell(args, content) {
|
10
|
-
args = args.join(" ").split(",");
|
11
|
-
let text = args[0] || "";
|
12
|
-
let url = args[1] || "";
|
13
|
-
text = text.trim();
|
14
|
-
url = url.trim();
|
15
|
-
if (url.length > 0) {
|
16
|
-
url = "href='" + url + "'";
|
17
|
-
}
|
18
|
-
let icon = "";
|
19
|
-
let img = "https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus/lib/assets/default.svg";
|
20
|
-
if (args.length > 2) {
|
21
|
-
if (args[2].indexOf(" solitude") > -1) {
|
22
|
-
icon = args[2].trim();
|
23
|
-
} else {
|
24
|
-
img = args[2].trim();
|
25
|
-
}
|
26
|
-
}
|
27
|
-
if (icon.length > 0) {
|
28
|
-
return `<a class="button no-text-decoration" ${url} title='${text}'><i class='${icon}'></i>${text}</a>`;
|
29
|
-
} else {
|
30
|
-
return `<a class="button no-text-decoration" ${url} title='${text}'><img src='${img}'>${text}</a>`;
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
hexo.extend.tag.register("btns", postBtns, { ends: true });
|
35
|
-
hexo.extend.tag.register("cell", postCell);
|
package/scripts/tags/button.js
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
const urlFor = require("hexo-util").url_for.bind(hexo);
|
4
|
-
|
5
|
-
function btn(args) {
|
6
|
-
args = args.join(" ").split(",");
|
7
|
-
let url = args[0] || "";
|
8
|
-
let text = args[1] || "";
|
9
|
-
let icon = args[2] || "";
|
10
|
-
let option = args[3] || "";
|
11
|
-
|
12
|
-
url = url.trim();
|
13
|
-
text = text.trim();
|
14
|
-
icon = icon.trim();
|
15
|
-
option = option.trim();
|
16
|
-
|
17
|
-
return `<button class="btn-sco ${option}" onclick="${url.startsWith("http") ? `window.open('${url}')` : `pjax.loadUrl('${urlFor(url)}')`}"
|
18
|
-
title="${text}">${icon.length ? `<i class="solitude ${icon}"></i>` : ""}${text.length ? `<span>${text}</span>` : ""}</button>`;
|
19
|
-
}
|
20
|
-
|
21
|
-
hexo.extend.tag.register("btn", btn, { ends: false });
|
package/scripts/tags/bvideo.js
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
'use strict'
|
2
|
-
|
3
|
-
function bilibili(args) {
|
4
|
-
return `<iframe class="bvideo" width="100%" height="600" src="//player.bilibili.com/player.html?autoplay=0&bvid=${args}" border="0" frameBorder="no" framespacing="0" allowFullScreen="true"></iframe>`
|
5
|
-
}
|
6
|
-
|
7
|
-
hexo.extend.tag.register('bvideo', bilibili, {ends: false})
|
package/scripts/tags/checkbox.js
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
function postCheckbox(args) {
|
4
|
-
args = args.join(' ').split(',')
|
5
|
-
var cls = ''
|
6
|
-
var text = ''
|
7
|
-
var checked = false
|
8
|
-
if (args.length > 1) {
|
9
|
-
cls = (args[0] || '').trim()
|
10
|
-
if (cls.length > 0) {
|
11
|
-
cls = ' ' + cls
|
12
|
-
}
|
13
|
-
if (cls.indexOf('checked') > -1) {
|
14
|
-
checked = true
|
15
|
-
}
|
16
|
-
text = (args[1] || '').trim()
|
17
|
-
} else if (args.length > 0) {
|
18
|
-
text = (args[0] || '').trim()
|
19
|
-
}
|
20
|
-
if (text.length > 0) {
|
21
|
-
return `<div class='checkbox${cls}'><input type="checkbox" ${ checked ? 'checked="checked"' : '' }/>
|
22
|
-
${hexo.render.renderSync({text: text, engine: 'markdown'}).split('\n').join('')}
|
23
|
-
</div>`
|
24
|
-
}
|
25
|
-
}
|
26
|
-
function postRadio(args) {
|
27
|
-
args = args.join(' ').split(',')
|
28
|
-
var cls = ''
|
29
|
-
var text = ''
|
30
|
-
var checked = false
|
31
|
-
if (args.length > 1) {
|
32
|
-
cls = (args[0] || '').trim()
|
33
|
-
if (cls.length > 0) {
|
34
|
-
cls = ' ' + cls
|
35
|
-
}
|
36
|
-
if (cls.indexOf('checked') > -1) {
|
37
|
-
checked = true
|
38
|
-
}
|
39
|
-
text = (args[1] || '').trim()
|
40
|
-
} else if (args.length > 0) {
|
41
|
-
text = (args[0] || '').trim()
|
42
|
-
}
|
43
|
-
if (text.length > 0) {
|
44
|
-
return `<div class='checkbox${cls}'><input type="radio" ${ checked ? 'checked="checked"' : '' }/>
|
45
|
-
${hexo.render.renderSync({text: text, engine: 'markdown'}).split('\n').join('')}
|
46
|
-
</div>`
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
hexo.extend.tag.register('checkbox', postCheckbox);
|
51
|
-
hexo.extend.tag.register('radio', postRadio);
|
package/scripts/tags/fold.js
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
'use strict'
|
2
|
-
|
3
|
-
function postTabs(args, content) {
|
4
|
-
const title = args[0] ? args[0] : ""
|
5
|
-
const open = args[1] ? args[1] : ""
|
6
|
-
|
7
|
-
return `<details ${open}><summary>${title}</summary><div class="content">${hexo.render.renderSync({
|
8
|
-
text: content,
|
9
|
-
engine: 'markdown'
|
10
|
-
})}</div></details>`
|
11
|
-
}
|
12
|
-
|
13
|
-
hexo.extend.tag.register('fold', postTabs, {ends: true})
|
package/scripts/tags/image.js
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
hexo.extend.tag.register('image', function(args) {
|
4
|
-
args = args.join(' ').split(',');
|
5
|
-
let url = args[0].trim();
|
6
|
-
let alt = '';
|
7
|
-
let bg = '';
|
8
|
-
let style = '';
|
9
|
-
if (args.length > 1) {
|
10
|
-
for (let i = 1; i < args.length; i++) {
|
11
|
-
let tmp = args[i].trim();
|
12
|
-
if (tmp.includes('alt=')) {
|
13
|
-
alt = tmp.substring(4, tmp.length);
|
14
|
-
} else if (tmp.includes('width=')) {
|
15
|
-
style += 'width:' + tmp.substring(6, tmp.length) + ';';
|
16
|
-
} else if (tmp.includes('height=')) {
|
17
|
-
style += 'height:' + tmp.substring(7, tmp.length) + ';';
|
18
|
-
} else if (tmp.includes('bg=')) {
|
19
|
-
bg = tmp.substring(3, tmp.length);
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|
23
|
-
function img(url, alt, style) {
|
24
|
-
let img = '';
|
25
|
-
img += '<img class="img" src="' + url + '"';
|
26
|
-
if (alt.length > 0) {
|
27
|
-
img += ' alt="' + alt + '"';
|
28
|
-
}
|
29
|
-
if (style.length > 0) {
|
30
|
-
img += ' style="' + style + '"';
|
31
|
-
}
|
32
|
-
img += '/>';
|
33
|
-
return img;
|
34
|
-
}
|
35
|
-
|
36
|
-
let ret = '';
|
37
|
-
ret += '<div class="img-wrap">';
|
38
|
-
ret += '<div class="img-bg"';
|
39
|
-
if (bg.length > 0) {
|
40
|
-
ret += ' style="background:' + bg + '"';
|
41
|
-
}
|
42
|
-
ret += '>';
|
43
|
-
ret += img(url, alt, style);
|
44
|
-
ret += '</div>';
|
45
|
-
|
46
|
-
if (alt.length > 0) {
|
47
|
-
ret += '<span class="image-caption">' + alt + '</span>';
|
48
|
-
}
|
49
|
-
|
50
|
-
ret += '</div>';
|
51
|
-
return ret;
|
52
|
-
});
|
53
|
-
|
54
|
-
hexo.extend.tag.register('inlineimage', function(args) {
|
55
|
-
args = args.join(' ').split(', ');
|
56
|
-
let url = args[0].trim();
|
57
|
-
let ret = '';
|
58
|
-
ret += '<img no-lazy class="inline" src="' + url + '"';
|
59
|
-
let style = '';
|
60
|
-
if (args.length > 1) {
|
61
|
-
for (let i = 1; i < args.length; i++) {
|
62
|
-
let tmp = args[i].trim();
|
63
|
-
if (tmp.includes('height=')) {
|
64
|
-
style += 'height:' + tmp.substring(7, tmp.length) + ';';
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}
|
68
|
-
if (style.length > 0) {
|
69
|
-
ret += ' style="' + style + '"';
|
70
|
-
} else {
|
71
|
-
ret += ' style="height:1.5em"';
|
72
|
-
}
|
73
|
-
ret += '/>';
|
74
|
-
return ret;
|
75
|
-
});
|
@@ -1,12 +0,0 @@
|
|
1
|
-
'use strict'
|
2
|
-
|
3
|
-
const urlFor = require('hexo-util').url_for.bind(hexo)
|
4
|
-
|
5
|
-
function inlineImg (args) {
|
6
|
-
const img = args[0]
|
7
|
-
const height = args[1] ? `style="height:${args[1]}"` : ''
|
8
|
-
|
9
|
-
return `<img class="inline-img" src="${urlFor(img)}" ${height}/>`
|
10
|
-
}
|
11
|
-
|
12
|
-
hexo.extend.tag.register('inlineimage', inlineImg, { ends: false })
|
package/scripts/tags/label.js
DELETED