mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 20:30:53 +08:00
🐛 修復POST-META關閉閲讀分鐘和訪問量後,評論量前有分割線的bug
🐛 修復canvas_ribbon透明度變為1再變回預設值bug 🐛 修復當default_cover沒設置時,會出現無圖片的bug 🎨 部分js調整
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user