hexo-theme-stellar 1.6.1 → 1.9.0
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/_config.yml +145 -34
- package/languages/zh-CN.yml +2 -2
- package/languages/zh-TW.yml +2 -2
- package/layout/404.ejs +1 -1
- package/layout/_partial/cover/index.ejs +12 -0
- package/layout/_partial/cover/post_cover.ejs +41 -0
- package/layout/_partial/{main/article → cover}/wiki_cover.ejs +1 -4
- package/layout/_partial/head.ejs +14 -2
- package/layout/_partial/main/article/article_footer.ejs +4 -4
- package/layout/_partial/main/post_list/paginator.ejs +2 -2
- package/layout/_partial/main/post_list/post_card.ejs +43 -5
- package/layout/_partial/main/post_list/wiki_card.ejs +2 -0
- package/layout/_partial/plugins/comments/giscus/layout.ejs +39 -0
- package/layout/_partial/plugins/comments/giscus/script.ejs +26 -0
- package/layout/_partial/plugins/comments/layout.ejs +1 -1
- package/layout/_partial/plugins/comments/valine/script.ejs +1 -1
- package/layout/_partial/plugins/comments/waline/layout.ejs +19 -0
- package/layout/_partial/plugins/comments/waline/script.ejs +22 -0
- package/layout/_partial/scripts/index.ejs +7 -1
- package/layout/_partial/sidebar/widgets/recent.ejs +5 -13
- package/layout/index.ejs +5 -2
- package/layout/layout.ejs +1 -1
- package/layout/mathjax.ejs +29 -0
- package/layout/page.ejs +1 -1
- package/layout/post.ejs +9 -2
- package/package.json +1 -1
- package/scripts/events/index.js +5 -7
- package/scripts/tags/grid.js +35 -0
- package/scripts/tags/image.js +21 -1
- package/scripts/tags/index.js +3 -0
- package/scripts/tags/lib/users.js +23 -0
- package/scripts/tags/note.js +7 -22
- package/scripts/tags/poetry.js +48 -0
- package/scripts/tags/quot.js +51 -0
- package/scripts/tags/{site.js → sites.js} +3 -0
- package/source/css/_common/base.styl +9 -0
- package/source/css/_common/cap.styl +1 -0
- package/source/css/_common/highlight.styl +15 -4
- package/source/css/_custom.styl +6 -5
- package/source/css/_layout/list.styl +65 -35
- package/source/css/_layout/main.styl +2 -2
- package/source/css/_layout/md.styl +38 -21
- package/source/css/_layout/pages/archives.styl +1 -0
- package/source/css/_layout/partial/article-footer.styl +0 -2
- package/source/css/_layout/partial/cover.styl +50 -10
- package/source/css/_layout/partial/footer.styl +6 -0
- package/source/css/_layout/partial/related.styl +1 -0
- package/source/css/_layout/sidebar/sidebar.styl +21 -6
- package/source/css/_layout/tag-plugins/folding.styl +3 -0
- package/source/css/_layout/tag-plugins/frame.styl +1 -1
- package/source/css/_layout/tag-plugins/image.styl +1 -2
- package/source/css/_layout/tag-plugins/inline-labels.styl +3 -0
- package/source/css/_layout/tag-plugins/poetry.styl +50 -0
- package/source/css/_layout/tag-plugins/quot.styl +82 -0
- package/source/css/_plugins/comments/utterances.styl +3 -0
- package/source/css/_plugins/comments/waline.styl +61 -0
- package/source/css/_plugins/fancybox.styl +5 -0
- package/source/css/_plugins/index.styl +4 -0
- package/source/js/main.js +60 -13
- package/source/js/plugins/friends.js +6 -5
- package/source/js/plugins/sites.js +2 -2
|
@@ -5,6 +5,8 @@ if hexo-config('plugins.swiper.enable')
|
|
|
5
5
|
@import 'swiper'
|
|
6
6
|
if hexo-config('plugins.scrollreveal.enable')
|
|
7
7
|
@import 'scrollreveal'
|
|
8
|
+
if hexo-config('plugins.fancybox.enable')
|
|
9
|
+
@import 'fancybox'
|
|
8
10
|
|
|
9
11
|
// 评论
|
|
10
12
|
if hexo-config('comments.service') == 'beaudar'
|
|
@@ -15,3 +17,5 @@ if hexo-config('comments.service') == 'utterances'
|
|
|
15
17
|
@import 'comments/utterances'
|
|
16
18
|
if hexo-config('comments.service') == 'valine'
|
|
17
19
|
@import 'comments/valine'
|
|
20
|
+
if hexo-config('comments.service') == 'waline'
|
|
21
|
+
@import 'comments/waline'
|
package/source/js/main.js
CHANGED
|
@@ -59,16 +59,16 @@ const util = {
|
|
|
59
59
|
|
|
60
60
|
const hud = {
|
|
61
61
|
toast: (msg, duration) => {
|
|
62
|
-
duration=isNaN(duration)?2000:duration;
|
|
62
|
+
duration = isNaN(duration) ? 2000 : duration;
|
|
63
63
|
var el = document.createElement('div');
|
|
64
64
|
el.classList.add('toast');
|
|
65
65
|
el.innerHTML = msg;
|
|
66
66
|
document.body.appendChild(el);
|
|
67
|
-
setTimeout(function() {
|
|
67
|
+
setTimeout(function () {
|
|
68
68
|
var d = 0.5;
|
|
69
69
|
el.style.webkitTransition = '-webkit-transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
|
|
70
70
|
el.style.opacity = '0';
|
|
71
|
-
setTimeout(function() { document.body.removeChild(el) }, d * 1000);
|
|
71
|
+
setTimeout(function () { document.body.removeChild(el) }, d * 1000);
|
|
72
72
|
}, duration);
|
|
73
73
|
},
|
|
74
74
|
|
|
@@ -96,7 +96,7 @@ const init = {
|
|
|
96
96
|
segs.push(node)
|
|
97
97
|
});
|
|
98
98
|
// 滚动
|
|
99
|
-
$(document, window).scroll(function(e) {
|
|
99
|
+
$(document, window).scroll(function (e) {
|
|
100
100
|
var scrollTop = $(this).scrollTop();
|
|
101
101
|
var topSeg = null
|
|
102
102
|
for (var idx in segs) {
|
|
@@ -124,7 +124,7 @@ const init = {
|
|
|
124
124
|
},
|
|
125
125
|
sidebar: () => {
|
|
126
126
|
stellar.jQuery(() => {
|
|
127
|
-
$("#toc a.toc-link").click(function(e) {
|
|
127
|
+
$("#toc a.toc-link").click(function (e) {
|
|
128
128
|
l_body.classList.remove("sidebar");
|
|
129
129
|
});
|
|
130
130
|
})
|
|
@@ -142,7 +142,7 @@ const init = {
|
|
|
142
142
|
/**
|
|
143
143
|
* Tabs tag listener (without twitter bootstrap).
|
|
144
144
|
*/
|
|
145
|
-
registerTabsTag: function() {
|
|
145
|
+
registerTabsTag: function () {
|
|
146
146
|
// Binding `nav-tabs` & `tab-content` by real time permalink changing.
|
|
147
147
|
document.querySelectorAll('.tabs ul.nav-tabs .tab').forEach(element => {
|
|
148
148
|
element.addEventListener('click', event => {
|
|
@@ -192,7 +192,7 @@ if (stellar.plugins.scrollreveal) {
|
|
|
192
192
|
|
|
193
193
|
// lazyload
|
|
194
194
|
if (stellar.plugins.lazyload) {
|
|
195
|
-
stellar.loadScript(stellar.plugins.lazyload.js, {defer:true})
|
|
195
|
+
stellar.loadScript(stellar.plugins.lazyload.js, { defer: true })
|
|
196
196
|
// https://www.npmjs.com/package/vanilla-lazyload
|
|
197
197
|
// Set the options globally
|
|
198
198
|
// to make LazyLoad self-initialize
|
|
@@ -217,16 +217,16 @@ if (stellar.plugins.lazyload) {
|
|
|
217
217
|
if (stellar.plugins.sitesjs) {
|
|
218
218
|
const issues_api = document.getElementById('sites-api');
|
|
219
219
|
if (issues_api != undefined) {
|
|
220
|
-
stellar.jQuery(
|
|
221
|
-
stellar.loadScript(stellar.plugins.sitesjs, {defer:true})
|
|
220
|
+
stellar.jQuery(() => {
|
|
221
|
+
stellar.loadScript(stellar.plugins.sitesjs, { defer: true })
|
|
222
222
|
})
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
if (stellar.plugins.friendsjs) {
|
|
226
226
|
const issues_api = document.getElementById('friends-api');
|
|
227
227
|
if (issues_api != undefined) {
|
|
228
|
-
stellar.jQuery(
|
|
229
|
-
stellar.loadScript(stellar.plugins.friendsjs, {defer:true})
|
|
228
|
+
stellar.jQuery(() => {
|
|
229
|
+
stellar.loadScript(stellar.plugins.friendsjs, { defer: true })
|
|
230
230
|
})
|
|
231
231
|
}
|
|
232
232
|
}
|
|
@@ -236,7 +236,7 @@ if (stellar.plugins.swiper) {
|
|
|
236
236
|
const swiper_api = document.getElementById('swiper-api');
|
|
237
237
|
if (swiper_api != undefined) {
|
|
238
238
|
stellar.loadCSS(stellar.plugins.swiper.css);
|
|
239
|
-
stellar.loadScript(stellar.plugins.swiper.js, {defer:true}).then(function () {
|
|
239
|
+
stellar.loadScript(stellar.plugins.swiper.js, { defer: true }).then(function () {
|
|
240
240
|
var swiper = new Swiper('.swiper-container', {
|
|
241
241
|
slidesPerView: 'auto',
|
|
242
242
|
spaceBetween: 8,
|
|
@@ -270,6 +270,53 @@ if (stellar.plugins.preload) {
|
|
|
270
270
|
maxRPS: 5,
|
|
271
271
|
hoverDelay: 25
|
|
272
272
|
};
|
|
273
|
-
stellar.loadScript(stellar.plugins.preload.flying_pages, {defer:true})
|
|
273
|
+
stellar.loadScript(stellar.plugins.preload.flying_pages, { defer: true })
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// fancybox
|
|
278
|
+
if (stellar.plugins.fancybox) {
|
|
279
|
+
let selector = 'img[fancybox]:not(.error)';
|
|
280
|
+
if (stellar.plugins.fancybox.selector) {
|
|
281
|
+
selector += `, ${stellar.plugins.fancybox.selector}`
|
|
282
|
+
}
|
|
283
|
+
if (document.querySelectorAll(selector).length !== 0) {
|
|
284
|
+
stellar.loadCSS(stellar.plugins.fancybox.css);
|
|
285
|
+
stellar.loadScript(stellar.plugins.fancybox.js, { defer: true }).then(function () {
|
|
286
|
+
Fancybox.bind(selector, {
|
|
287
|
+
groupAll: true,
|
|
288
|
+
hideScrollbar: false,
|
|
289
|
+
Thumbs: {
|
|
290
|
+
autoStart: false,
|
|
291
|
+
},
|
|
292
|
+
caption: function (fancybox, carousel, slide) {
|
|
293
|
+
return slide.$trigger.alt || null
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
})
|
|
274
297
|
}
|
|
275
298
|
}
|
|
299
|
+
|
|
300
|
+
// heti
|
|
301
|
+
if (stellar.plugins.heti) {
|
|
302
|
+
stellar.loadCSS(stellar.plugins.heti.css);
|
|
303
|
+
stellar.loadScript(stellar.plugins.heti.js, { defer: true }).then(function () {
|
|
304
|
+
const heti = new Heti('.heti');
|
|
305
|
+
|
|
306
|
+
// Copied from heti.autoSpacing() without DOMContentLoaded.
|
|
307
|
+
// https://github.com/sivan/heti/blob/eadee6a3b748b3b7924a9e7d5b395d4bce479c9a/js/heti-addon.js
|
|
308
|
+
//
|
|
309
|
+
// We managed to minimize the code modification to ensure .autoSpacing()
|
|
310
|
+
// is synced with upstream; therefore, we use `.bind()` to emulate the
|
|
311
|
+
// behavior of .autoSpacing() so we can even modify almost no code.
|
|
312
|
+
void (function () {
|
|
313
|
+
const $$rootList = document.querySelectorAll(this.rootSelector)
|
|
314
|
+
|
|
315
|
+
for (let $$root of $$rootList) {
|
|
316
|
+
this.spacingElement($$root)
|
|
317
|
+
}
|
|
318
|
+
}).bind(heti)();
|
|
319
|
+
|
|
320
|
+
stellar.plugins.heti.enable = false;
|
|
321
|
+
});
|
|
322
|
+
}
|
|
@@ -47,13 +47,14 @@ const friendsjs = {
|
|
|
47
47
|
$(el).append('<div class="loading-wrap"><svg class="loading" style="vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2709"><path d="M832 512c0-176-144-320-320-320V128c211.2 0 384 172.8 384 384h-64zM192 512c0 176 144 320 320 320v64C300.8 896 128 723.2 128 512h64z" p-id="2710"></path></svg><p></p></div>');
|
|
48
48
|
friendsjs.requestAPI(cfg.api, function(data) {
|
|
49
49
|
$(el).find('.loading-wrap').remove();
|
|
50
|
-
const arr = data.content;
|
|
50
|
+
const arr = data.content || data;
|
|
51
|
+
console.log(data);
|
|
51
52
|
arr.forEach((item, i) => {
|
|
52
53
|
var user = '<div class="user-card">';
|
|
53
54
|
user += '<a class="card-link" target="_blank" rel="external nofollow noopener noreferrer"';
|
|
54
|
-
user += ' href="' + item.url + '">';
|
|
55
|
-
user += '<img src="' + (item.avatar || cfg.avatar) + '" onerror="javascript:this.src=\'' + cfg.avatar + '\';">';
|
|
56
|
-
user += '<div class="name"><span>' + item.title + '</span></div>';
|
|
55
|
+
user += ' href="' + (item.html_url || item.url) + '">';
|
|
56
|
+
user += '<img src="' + (item.avatar_url || item.avatar || cfg.avatar) + '" onerror="javascript:this.src=\'' + cfg.avatar + '\';">';
|
|
57
|
+
user += '<div class="name"><span>' + (item.title || item.login) + '</span></div>';
|
|
57
58
|
user += '</a>';
|
|
58
59
|
user += '</div>';
|
|
59
60
|
$(el).find('.group-body').append(user);
|
|
@@ -77,7 +78,7 @@ $(function () {
|
|
|
77
78
|
cfg.el = el;
|
|
78
79
|
cfg.api = api;
|
|
79
80
|
cfg.class = el.getAttribute('class');
|
|
80
|
-
cfg.avatar = 'https://
|
|
81
|
+
cfg.avatar = 'https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/avatar/round/3442075.svg';
|
|
81
82
|
friendsjs.layout(cfg);
|
|
82
83
|
}
|
|
83
84
|
});
|
|
@@ -80,8 +80,8 @@ $(function () {
|
|
|
80
80
|
cfg.class = el.getAttribute('class');
|
|
81
81
|
cfg.el = el;
|
|
82
82
|
cfg.api = api;
|
|
83
|
-
cfg.avatar = 'https://
|
|
84
|
-
cfg.screenshot = 'https://
|
|
83
|
+
cfg.avatar = 'https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/link/8f277b4ee0ecd.svg';
|
|
84
|
+
cfg.screenshot = 'https://fastly.jsdelivr.net/gh/cdn-x/placeholder@1.0.1/cover/76b86c0226ffd.svg';
|
|
85
85
|
sitesjs.layout(cfg);
|
|
86
86
|
}
|
|
87
87
|
});
|