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

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

View File

@@ -1,23 +1,34 @@
hexo.extend.filter.register("before_post_render", function(data) {
if (data.cover == false) {
data.randomcover = random_cover();
return data;
}
data.cover = data.cover || random_cover();
return data;
});
/**
* Butterfly
* ramdom cover
*/
var random_cover = function() {
var cover;
var num;
if (!Array.isArray(hexo.theme.config.cover.default_cover)) {
cover = hexo.theme.config.cover.default_cover;
return cover;
} else {
num = Math.floor(
Math.random() * hexo.theme.config.cover.default_cover.length
);
cover = hexo.theme.config.cover.default_cover[num];
return cover;
'use strict'
hexo.extend.filter.register('before_post_render', function (data) {
if (data.cover === false) {
data.randomcover = randomCover()
return data
}
};
data.cover = data.cover || randomCover()
return data
})
var randomCover = function () {
var theme = hexo.theme.config
var cover
var num
if (theme.cover.default_cover) {
if (!Array.isArray(theme.cover.default_cover)) {
cover = theme.cover.default_cover
return cover
} else {
num = Math.floor(Math.random() * theme.cover.default_cover.length)
cover = theme.cover.default_cover[num]
return cover
}
} else {
return theme.default_top_img
}
}