🐛 修復POST-META關閉閲讀分鐘和訪問量後,評論量前有分割線的bug

🐛 修復canvas_ribbon透明度變為1再變回預設值bug
🐛 修復當default_cover沒設置時,會出現無圖片的bug
🎨 部分js調整
This commit is contained in:
Jerry committed 2020-04-02 22:16:01 +08:00
1 parent 5e37ab641a
commit eb11e4afeb
18 files changed
+433 -315

No files matched your search

+9 -2
View File
@@ -1,8 +1,15 @@
hexo.extend.generator.register('404', function(locals){
/**
* Butterfly
* 404 error page
*/
'use strict'
hexo.extend.generator.register('404', function (locals) {
if (!hexo.theme.config.error_404.enable) return
return {
path: '404.html',
data: locals.posts,
layout: ['404']
}
});
})
+3 -1
View File
@@ -2,6 +2,8 @@
* Note: configs in _data/butterfly.yml will replace configs in hexo.theme.config.
*/
'use strict'
hexo.on('generateBefore', function () {
const rootConfig = hexo.config
if (hexo.locals.get) {
@@ -9,4 +11,4 @@ hexo.on('generateBefore', function () {
data && data.butterfly && (hexo.theme.config = data.butterfly)
}
hexo.theme.config.rootConfig = rootConfig
})
})
+39 -36
View File
@@ -4,60 +4,63 @@
* modify by Jerry
*/
'use strict';
'use strict'
var public_generators = [];
var public_generators = []
hexo.extend.filter.register('before_generate', function () {
this._bindLocals();
this._bindLocals()
const all_posts = this.locals.get('posts');
const all_posts = this.locals.get('posts')
const hidden_posts = all_posts.find({
'hide': true
});
const normal_posts = all_posts.filter(post => !post['hide']);
hide: true
})
const normal_posts = all_posts.filter(post => !post.hide)
this.locals.set('all_posts', all_posts);
this.locals.set('hidden_posts', hidden_posts);
this.locals.set('posts', normal_posts);
});
this.locals.set('all_posts', all_posts)
this.locals.set('hidden_posts', hidden_posts)
this.locals.set('posts', normal_posts)
})
hexo.extend.filter.register('after_init', function () {
const original = {};
const original = {}
for (const name in hexo.extend.generator.list()) {
original[name] = hexo.extend.generator.get(name);
original[name] = hexo.extend.generator.get(name)
}
hexo.extend.generator.register('post', async function (locals) {
const fg = original.post.bind(this);
const fg = original.post.bind(this)
const generated_public = await fg(locals);
const generated_hidden = await fg(Object.assign({}, locals, {
posts: locals.hidden_posts
}));
const generated_public = await fg(locals)
const generated_hidden = await fg(
Object.assign({}, locals, {
posts: locals.hidden_posts
})
)
// Remove post.prev and post.next for hidden posts
generated_hidden.forEach(ele => {
ele.data.prev = ele.data.next = null;
});
ele.data.prev = ele.data.next = null
})
return generated_public.concat(generated_hidden);
});
return generated_public.concat(generated_hidden)
})
// Then we hack into other generators if necessary
public_generators.filter(
name => Object.keys(original).includes(name)
).forEach(name => {
// Overwrite original generator
hexo.extend.generator.register(name, function (locals) {
const fg = original[name].bind(this);
public_generators
.filter(name => Object.keys(original).includes(name))
.forEach(name => {
// Overwrite original generator
hexo.extend.generator.register(name, function (locals) {
const fg = original[name].bind(this)
return fg(Object.assign({}, locals, {
posts: new locals.posts.constructor(
locals.posts.data.concat(locals.hidden_posts.data)
return fg(
Object.assign({}, locals, {
posts: new locals.posts.constructor(
locals.posts.data.concat(locals.hidden_posts.data)
)
})
)
}));
});
});
});
})
})
})
Loaded 3 of 18 files, more files were not shown because too many files have changed in this diff. Show more