diff --git a/README.md b/README.md
index 207c28a..175a0ea 100644
--- a/README.md
+++ b/README.md
@@ -31,6 +31,7 @@ bangumi: # 追番设置
show: 1
lazyload: true
loading:
+ showMyComment: false
metaColor:
color:
webp:
@@ -76,6 +77,7 @@ cinema: # 追剧设置
- **webp**: 番剧封面使用`webp`格式(此格式在`safari`浏览器下不显示,但是图片大小可以缩小 100 倍左右,仅支持哔哩哔哩源), 默认`true`
- **progress**: 获取番剧数据时是否显示进度条,默认`true`
- **extraOrder**: 手动添加的番剧/追剧数据是否优先显示,`1`为优先,其它为不优先
+- **showMyComment**: 使用`bgm`源时显示自己的评价及评论,默认`false`
- **extra_options**: 此配置会扩展到Hexo`page`变量中
## 使用
diff --git a/lib/bangumi-generator.js b/lib/bangumi-generator.js
index 29da06b..1b07cb9 100644
--- a/lib/bangumi-generator.js
+++ b/lib/bangumi-generator.js
@@ -30,7 +30,7 @@ var log = require('hexo-log')({
module.exports = /*#__PURE__*/function () {
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(locals) {
- var _config$type, _config$type$lazyload, _config$type$source, _config$type2;
+ var _config$type, _config$type$lazyload, _config$type$source, _config$type$showMyCo, _config$type2;
var type,
config,
@@ -125,6 +125,7 @@ module.exports = /*#__PURE__*/function () {
color: config[type].color ? "style=\"color:".concat(config[type].color, "\"") : '',
lazyload: (_config$type$lazyload = config[type].lazyload) !== null && _config$type$lazyload !== void 0 ? _config$type$lazyload : true,
source: (_config$type$source = config[type].source) !== null && _config$type$source !== void 0 ? _config$type$source : 'bili',
+ showMyComment: (_config$type$showMyCo = config[type].showMyComment) !== null && _config$type$showMyCo !== void 0 ? _config$type$showMyCo : false,
wantWatch: wantWatch,
watched: watched,
watching: watching,
diff --git a/lib/get-bgm-data.js b/lib/get-bgm-data.js
index ffe8f3d..615fa72 100644
--- a/lib/get-bgm-data.js
+++ b/lib/get-bgm-data.js
@@ -70,10 +70,14 @@ var getItemsId = /*#__PURE__*/function () {
_context2.t2 = _toConsumableArray2["default"];
_context2.next = 15;
return getBangumiData($('#browserItemList>li').map(function (index, el) {
+ var _$$find$attr, _$$find$attr$match;
+
return {
id: $(el).attr('id').replace('item_', ''),
cover: $(el).find('img').attr('src'),
- name: $(el).find('h3>a').text()
+ name: $(el).find('h3>a').text(),
+ myStars: (_$$find$attr = $(el).find('.starlight').attr('class')) === null || _$$find$attr === void 0 ? void 0 : (_$$find$attr$match = _$$find$attr.match(/stars([\d]+)/)) === null || _$$find$attr$match === void 0 ? void 0 : _$$find$attr$match[1],
+ myComment: $(el).find('#comment_box').text().trim()
};
}).get(), sourceDir, proxy);
@@ -120,10 +124,14 @@ var getItemsId = /*#__PURE__*/function () {
_context.t2 = _toConsumableArray2["default"];
_context.next = 10;
return getBangumiData($('#browserItemList>li').map(function (index, el) {
+ var _$$find$attr2, _$$find$attr2$match;
+
return {
id: $(el).attr('id').replace('item_', ''),
cover: $(el).find('img').attr('src'),
- name: $(el).find('h3>a').text()
+ name: $(el).find('h3>a').text(),
+ myStars: (_$$find$attr2 = $(el).find('.starlight').attr('class')) === null || _$$find$attr2 === void 0 ? void 0 : (_$$find$attr2$match = _$$find$attr2.match(/stars([\d]+)/)) === null || _$$find$attr2$match === void 0 ? void 0 : _$$find$attr2$match[1],
+ myComment: $(el).find('#comment_box').text().trim()
};
}).get(), sourceDir, proxy);
@@ -362,7 +370,9 @@ var getBangumiData = /*#__PURE__*/function () {
wish: wish || '-',
doing: doing || '-',
collect: collect || '-',
- totalCount: totalCount ? "\u5168".concat(totalCount, "\u8BDD") : '-'
+ totalCount: totalCount ? "\u5168".concat(totalCount, "\u8BDD") : '-',
+ myStars: config.itemData.myStars,
+ myComment: config.itemData.myComment
};
}));
diff --git a/lib/img/rate_star_2x.png b/lib/img/rate_star_2x.png
new file mode 100644
index 0000000..65960fc
Binary files /dev/null and b/lib/img/rate_star_2x.png differ
diff --git a/lib/templates/bgm-template.ejs b/lib/templates/bgm-template.ejs
index 223ae27..a43bfc9 100644
--- a/lib/templates/bgm-template.ejs
+++ b/lib/templates/bgm-template.ejs
@@ -30,6 +30,17 @@
-
+
diff --git a/lib/templates/index.css b/lib/templates/index.css
index d30989d..19abd81 100644
--- a/lib/templates/index.css
+++ b/lib/templates/index.css
@@ -1 +1 @@
-.bangumi-tabs{margin-bottom:15px;margin-top:15px}.bangumi-tab{padding:5px}a.bangumi-tab{text-decoration:none}.bangumi-active{background:#657b83;color:#fff}.bangumi-item{position:relative;clear:both;padding:10px 0;border-bottom:1px solid #ddd;min-height:180px}@media screen and (max-width:600px){.bangumi-item{width:100%}}.bangumi-picture{position:absolute;left:0;top:10px;width:110px}.bangumi-picture img{margin:10px 0}.bangumi-info{padding-left:120px;margin-top:10px}.bangumi-meta{font-size:12px;padding-right:10px;height:45px}.bangumi-comments{font-size:12px;margin-top:10px}.bangumi-comments>p{word-break:break-all;text-overflow:ellipsis;overflow:hidden;white-space:normal;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.bangumi-pagination{margin-top:15px;text-align:center;margin-bottom:10px}.bangumi-button{padding:5px}.bangumi-button:hover{background:#657b83;color:#fff}.bangumi-hide{display:none}.bangumi-show{display:block}.bangumi-title{font-size:18px}.bangumi-title a{line-height:1;text-decoration:none}.bangumi-info-items{font-size:12px;color:#2fd8d8;padding-top:10px;line-height:1;float:left;width:100%}.bangumi-info-item{display:inline-block;width:13%;border-right:1px solid #2fd8d8;text-align:center;height:34px}.bangumi-info-label{display:block;line-height:12px}.bangumi-info-item em{display:block;padding-top:6px;line-height:17px;font-style:normal;font-weight:700}.bangumi-info-total{padding-top:11px;display:block;line-height:12px;font-weight:700}.bangumi-info-item-score{border-right:1px solid #0000;width:50px}.bangumi-info-label-em{color:transparent;opacity:0;visibility:hidden;line-height:6px!important;padding:0!important}@media (max-width:650px){.bangumi-coin,.bangumi-type{display:none}.bangumi-info-item{width:16%}}@media (max-width:590px){.bangumi-danmaku,.bangumi-wish{display:none}.bangumi-info-item{width:19%}}@media (max-width:520px){.bangumi-doing,.bangumi-play{display:none}.bangumi-info-item{width:24%}}@media (max-width:480px){.bangumi-collect,.bangumi-follow{display:none}.bangumi-info-item{width:30%}}@media (max-width:400px){.bangumi-area{display:none}.bangumi-info-item{width:45%}}
\ No newline at end of file
+.bangumi-tabs{margin-bottom:15px;margin-top:15px}.bangumi-tab{padding:5px}a.bangumi-tab{text-decoration:none}.bangumi-active{background:#657b83;color:#fff}.bangumi-item{position:relative;clear:both;padding:10px 0;border-bottom:1px solid #ddd;min-height:180px}@media screen and (max-width:600px){.bangumi-item{width:100%}}.bangumi-picture{position:absolute;left:0;top:10px;width:110px}.bangumi-picture img{margin:10px 0}.bangumi-info{padding-left:120px;margin-top:10px}.bangumi-meta{font-size:12px;padding-right:10px;height:45px}.bangumi-comments{font-size:12px;margin-top:10px}.bangumi-comments>p{word-break:break-all;text-overflow:ellipsis;overflow:hidden;white-space:normal;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.bangumi-pagination{margin-top:15px;text-align:center;margin-bottom:10px}.bangumi-button{padding:5px}.bangumi-button:hover{background:#657b83;color:#fff}.bangumi-hide{display:none}.bangumi-show{display:block}.bangumi-title{font-size:18px}.bangumi-title a{line-height:1;text-decoration:none}.bangumi-info-items{font-size:12px;color:#2fd8d8;padding-top:10px;line-height:1;float:left;width:100%}.bangumi-info-item{display:inline-block;width:13%;border-right:1px solid #2fd8d8;text-align:center;height:34px}.bangumi-info-label{display:block;line-height:12px}.bangumi-info-item em{display:block;padding-top:6px;line-height:17px;font-style:normal;font-weight:700}.bangumi-info-total{padding-top:11px;display:block;line-height:12px;font-weight:700}.bangumi-info-item-score{border-right:1px solid #0000;width:50px}.bangumi-info-label-em{color:transparent;opacity:0;visibility:hidden;line-height:6px!important;padding:0!important}@media (max-width:650px){.bangumi-coin,.bangumi-type{display:none}.bangumi-info-item{width:16%}}@media (max-width:590px){.bangumi-danmaku,.bangumi-wish{display:none}.bangumi-info-item{width:19%}}@media (max-width:520px){.bangumi-doing,.bangumi-play{display:none}.bangumi-info-item{width:24%}}@media (max-width:480px){.bangumi-collect,.bangumi-follow{display:none}.bangumi-info-item{width:30%}}@media (max-width:400px){.bangumi-area{display:none}.bangumi-info-item{width:45%}}.bangumi-my-comments{border:1px dashed #8f8f8f;padding:3px;border-radius:5px;margin-left:-120px}.bangumi-starstop{background:url(https://cdn.jsdelivr.net/npm/hexo-bilibili-bangumi@1.7.9/lib/img/rate_star_2x.png) 100% 100%/10px 19.5px repeat-x;height:10px;width:50px;display:inline-block;float:none}.bangumi-starlight{background:url(https://cdn.jsdelivr.net/npm/hexo-bilibili-bangumi@1.7.9/lib/img/rate_star_2x.png) 0 0/10px 19.5px repeat-x;height:10px;display:block;width:100%}.bangumi-starlight.stars1{width:5px}.bangumi-starlight.stars2{width:10px}.bangumi-starlight.stars3{width:15px}.bangumi-starlight.stars4{width:20px}.bangumi-starlight.stars5{width:25px}.bangumi-starlight.stars6{width:30px}.bangumi-starlight.stars7{width:35px}.bangumi-starlight.stars8{width:405px}.bangumi-starlight.stars9{width:45px}.bangumi-starlight.stars10{width:50px}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index ae784ad..bb97ac4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
+ "name": "hexo-bilibili-bangumi",
"version": "1.7.8",
"license": "Apache Licence 2.0",
"dependencies": {
@@ -2327,9 +2328,9 @@
}
},
"node_modules/caniuse-lite": {
- "version": "1.0.30001342",
- "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001342.tgz",
- "integrity": "sha512-bn6sOCu7L7jcbBbyNhLg0qzXdJ/PMbybZTH/BA6Roet9wxYRm6Tr9D0s0uhLkOZ6MSG+QU6txUgdpr3MXIVqjA==",
+ "version": "1.0.30001364",
+ "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001364.tgz",
+ "integrity": "sha512-9O0xzV3wVyX0SlegIQ6knz+okhBB5pE0PC40MNdwcipjwpxoUEHL24uJ+gG42cgklPjfO5ZjZPme9FTSN3QT2Q==",
"dev": true
},
"node_modules/chalk": {
@@ -6369,9 +6370,9 @@
}
},
"caniuse-lite": {
- "version": "1.0.30001342",
- "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001342.tgz",
- "integrity": "sha512-bn6sOCu7L7jcbBbyNhLg0qzXdJ/PMbybZTH/BA6Roet9wxYRm6Tr9D0s0uhLkOZ6MSG+QU6txUgdpr3MXIVqjA==",
+ "version": "1.0.30001364",
+ "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001364.tgz",
+ "integrity": "sha512-9O0xzV3wVyX0SlegIQ6knz+okhBB5pE0PC40MNdwcipjwpxoUEHL24uJ+gG42cgklPjfO5ZjZPme9FTSN3QT2Q==",
"dev": true
},
"chalk": {
diff --git a/package.json b/package.json
index 8eb6322..aa6bc8e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hexo-bilibili-bangumi",
- "version": "1.7.8",
+ "version": "1.7.9",
"description": "hexo bilibili番剧页",
"main": "index.js",
"scripts": {
diff --git a/src/lib/bangumi-generator.js b/src/lib/bangumi-generator.js
index 24ec743..0b83c63 100644
--- a/src/lib/bangumi-generator.js
+++ b/src/lib/bangumi-generator.js
@@ -68,6 +68,7 @@ module.exports = async function (locals, type = 'bangumi') {
color: config[type].color ? `style="color:${config[type].color}"` : '',
lazyload: config[type].lazyload ?? true,
source: config[type].source ?? 'bili',
+ showMyComment: config[type].showMyComment ?? false,
wantWatch,
watched,
watching,
diff --git a/src/lib/get-bgm-data.js b/src/lib/get-bgm-data.js
index e3c46bf..d3b795f 100644
--- a/src/lib/get-bgm-data.js
+++ b/src/lib/get-bgm-data.js
@@ -31,7 +31,13 @@ const getItemsId = async (vmid, status, showProgress, sourceDir, proxy) => {
cover: $(el).find('img')
.attr('src'),
name: $(el).find('h3>a')
+ .text(),
+ myStars: $(el).find('.starlight')
+ .attr('class')
+ ?.match(/stars([\d]+)/)?.[1],
+ myComment: $(el).find('#comment_box')
.text()
+ .trim()
}))
.get(), sourceDir, proxy));
@@ -58,7 +64,13 @@ const getItemsId = async (vmid, status, showProgress, sourceDir, proxy) => {
cover: $(el).find('img')
.attr('src'),
name: $(el).find('h3>a')
+ .text(),
+ myStars: $(el).find('.starlight')
+ .attr('class')
+ ?.match(/stars([\d]+)/)?.[1],
+ myComment: $(el).find('#comment_box')
.text()
+ .trim()
}))
.get(), sourceDir, proxy));
}
@@ -164,7 +176,9 @@ const getBangumiData = async (items, sourceDir, proxy) => (await Promise.allSett
wish: wish || '-',
doing: doing || '-',
collect: collect || '-',
- totalCount: totalCount ? `全${totalCount}话` : '-'
+ totalCount: totalCount ? `全${totalCount}话` : '-',
+ myStars: config.itemData.myStars,
+ myComment: config.itemData.myComment
};
});
diff --git a/src/lib/templates/index.css b/src/lib/templates/index.css
index 5b793e2..6f35c8a 100644
--- a/src/lib/templates/index.css
+++ b/src/lib/templates/index.css
@@ -1,202 +1,279 @@
.bangumi-tabs {
- margin-bottom: 15px;
- margin-top: 15px;
+ margin-bottom: 15px;
+ margin-top: 15px;
}
.bangumi-tab {
- padding: 5px;
+ padding: 5px;
}
a.bangumi-tab {
- text-decoration: none;
+ text-decoration: none;
}
.bangumi-active {
- background: #657b83;
- color: #fff;
+ background: #657b83;
+ color: #fff;
}
.bangumi-item {
- padding-bottom: 10px;
- position: relative;
- clear: both;
- padding: 10px 0;
- border-bottom: 1px #ddd solid;
- min-height: 180px;
+ padding-bottom: 10px;
+ position: relative;
+ clear: both;
+ padding: 10px 0;
+ border-bottom: 1px #ddd solid;
+ min-height: 180px;
}
@media screen and (max-width: 600px) {
- .bangumi-item {
- width: 100%;
- }
+ .bangumi-item {
+ width: 100%;
+ }
}
.bangumi-picture {
- position: absolute;
- left: 0;
- top: 10px;
- width: 110px;
+ position: absolute;
+ left: 0;
+ top: 10px;
+ width: 110px;
}
.bangumi-picture img {
- margin: 10px 0;
+ margin: 10px 0;
}
.bangumi-info {
- padding-left: 120px;
- margin-top: 10px;
+ padding-left: 120px;
+ margin-top: 10px;
}
.bangumi-meta {
- font-size: 12px;
- padding-right: 10px;
- height: 45px;
+ font-size: 12px;
+ padding-right: 10px;
+ height: 45px;
}
.bangumi-comments {
- font-size: 12px;
- margin-top: 10px
+ font-size: 12px;
+ margin-top: 10px
}
-.bangumi-comments > p {
- word-break: break-all;
- text-overflow: ellipsis;
- overflow: hidden;
+.bangumi-comments>p {
+ word-break: break-all;
+ text-overflow: ellipsis;
+ overflow: hidden;
- white-space: normal;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- -webkit-line-clamp: 3;
+ white-space: normal;
+ display: -webkit-box;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp: 3;
}
.bangumi-pagination {
- margin-top: 15px;
- text-align: center;
- margin-bottom: 10px;
+ margin-top: 15px;
+ text-align: center;
+ margin-bottom: 10px;
}
.bangumi-button {
- padding: 5px;
+ padding: 5px;
}
.bangumi-button:hover {
- background: #657b83;
- color: #fff;
+ background: #657b83;
+ color: #fff;
}
.bangumi-hide {
- display: none;
+ display: none;
}
.bangumi-show {
- display: block;
+ display: block;
}
.bangumi-title {
- font-size: 18px;
+ font-size: 18px;
}
.bangumi-title a {
- line-height: 1;
- text-decoration: none;
+ line-height: 1;
+ text-decoration: none;
}
.bangumi-info-items {
- font-size: 12px;
- color: #2fd8d8;
- padding-top: 10px;
- line-height: 1;
- float: left;
- width: 100%;
+ font-size: 12px;
+ color: #2fd8d8;
+ padding-top: 10px;
+ line-height: 1;
+ float: left;
+ width: 100%;
}
.bangumi-info-item {
- display: inline-block;
- width: 13%;
- border-right: 1px solid #2fd8d8;
- text-align: center;
- height: 34px;
+ display: inline-block;
+ width: 13%;
+ border-right: 1px solid #2fd8d8;
+ text-align: center;
+ height: 34px;
}
.bangumi-info-label {
- display: block;
- line-height: 12px;
+ display: block;
+ line-height: 12px;
}
.bangumi-info-item em {
- display: block;
- padding-top: 6px;
- line-height: 17px;
- font-style: normal;
- font-weight: 700;
+ display: block;
+ padding-top: 6px;
+ line-height: 17px;
+ font-style: normal;
+ font-weight: 700;
}
.bangumi-info-total {
- padding-top: 11px;
- display: block;
- line-height: 12px;
- font-weight: bold;
+ padding-top: 11px;
+ display: block;
+ line-height: 12px;
+ font-weight: bold;
}
.bangumi-info-item-score {
- border-right: 1px solid #0000;
- width: 50px;
+ border-right: 1px solid #0000;
+ width: 50px;
}
.bangumi-info-label-em {
- color: rgba(0, 0, 0, 0);
- opacity:0;
- visibility:hidden;
- line-height: 6px !important;
- padding: 0 !important;
+ color: rgba(0, 0, 0, 0);
+ opacity: 0;
+ visibility: hidden;
+ line-height: 6px !important;
+ padding: 0 !important;
}
@media (max-width:650px) {
- .bangumi-coin,
- .bangumi-type {
- display:none;
- }
- .bangumi-info-item{
- width: 16%;
- }
+
+ .bangumi-coin,
+ .bangumi-type {
+ display: none;
+ }
+
+ .bangumi-info-item {
+ width: 16%;
+ }
}
+
@media (max-width:590px) {
- .bangumi-danmaku,
- .bangumi-wish {
- display: none;
- }
- .bangumi-info-item {
- width: 19%;
- }
+
+ .bangumi-danmaku,
+ .bangumi-wish {
+ display: none;
+ }
+
+ .bangumi-info-item {
+ width: 19%;
+ }
}
@media (max-width:520px) {
- .bangumi-play,
- .bangumi-doing {
- display: none;
- }
- .bangumi-info-item {
- width: 24%;
- }
+ .bangumi-play,
+ .bangumi-doing {
+ display: none;
+ }
+
+ .bangumi-info-item {
+ width: 24%;
+ }
}
@media (max-width:480px) {
- .bangumi-follow,
- .bangumi-collect {
- display: none;
- }
- .bangumi-info-item {
- width: 30%;
- }
+ .bangumi-follow,
+ .bangumi-collect {
+ display: none;
+ }
+
+ .bangumi-info-item {
+ width: 30%;
+ }
}
+
@media (max-width:400px) {
- .bangumi-area {
- display: none;
- }
+ .bangumi-area {
+ display: none;
+ }
+
+ .bangumi-info-item {
+ width: 45%;
+ }
+}
+
+.bangumi-my-comments {
+ border: 1px dashed #8f8f8f;
+ padding: 3px;
+ border-radius: 5px;
+ margin-left: -120px;
+}
+
+.bangumi-starstop {
+ background: transparent url(https://cdn.jsdelivr.net/npm/hexo-bilibili-bangumi@1.7.9/lib/img/rate_star_2x.png);
+ height: 10px;
+ background-size: 10px 19.5px;
+ background-position: 100% 100%;
+ background-repeat: repeat-x;
+ width: 50px;
+ display: inline-block;
+ float: none;
+}
+
+.bangumi-starlight {
+ background: transparent url(https://cdn.jsdelivr.net/npm/hexo-bilibili-bangumi@1.7.9/lib/img/rate_star_2x.png);
+ height: 10px;
+ background-size: 10px 19.5px;
+ background-position: 100% 100%;
+ background-repeat: repeat-x;
+ display: block;
+ width: 100%;
+ background-position: 0 0;
+}
+
+.bangumi-starlight.stars1 {
+ width: 5px;
+}
+
+.bangumi-starlight.stars2 {
+ width: 10px;
+}
+
+.bangumi-starlight.stars3 {
+ width: 15px;
+}
+
+.bangumi-starlight.stars4 {
+ width: 20px;
+}
+
+.bangumi-starlight.stars5 {
+ width: 25px;
+}
+
+.bangumi-starlight.stars6 {
+ width: 30px;
+}
+
+.bangumi-starlight.stars7 {
+ width: 35px;
+}
+
+.bangumi-starlight.stars8 {
+ width: 405px;
+}
+
+.bangumi-starlight.stars9 {
+ width: 45px;
+}
- .bangumi-info-item {
- width: 45%;
- }
+.bangumi-starlight.stars10 {
+ width: 50px;
}
简介:<%= item.des || "暂无简介" %>