Skip to content

Commit

Permalink
bump 10.8.2 (#535)
Browse files Browse the repository at this point in the history
* 弃用翻页评论区

* 无须更新依赖
  • Loading branch information
MotooriKashin authored Aug 11, 2024
1 parent 9db458f commit 5a7ccd0
Show file tree
Hide file tree
Showing 11 changed files with 800 additions and 894 deletions.
14 changes: 0 additions & 14 deletions .github/dependabot.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Manifest V3扩展和Tampermonkey用户脚本,恢复B站旧版网页,包括
- 本地视频文件播放
- 修复/修改
- 全局替换回旧版顶栏
- 评论区翻页支持
- ~~评论区翻页支持~~
- UP主列表支持
- 动态banner支持
- bangumi分集数据
Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
"dependencies": {
"@jsc/chrome": "file:chrome",
"@jsc/tampermonkey": "file:tampermonkey",
"fflate": "^0.8.1",
"md5": "^2.3.0",
"protobufjs": "^7.2.5",
"quill-delta-to-html-cb": "^0.14.0"
"fflate": "*",
"md5": "*",
"protobufjs": "*",
"quill-delta-to-html-cb": "*"
},
"devDependencies": {
"@types/md5": "^2.3.4",
"esbuild": "^0.20.0",
"fs-extra": "^11.1.1",
"navigation-api-types": "^0.5.0",
"typescript": "^5.2.2"
"@types/md5": "*",
"esbuild": "*",
"fs-extra": "*",
"navigation-api-types": "*",
"typescript": "*"
},
"scripts": {
"tsc": "tsc --noEmit -p ./src/tsconfig.json",
"chrome": "node chrome/build.mjs",
"tampermonkey": "node tampermonkey/build.mjs",
"comment": "node tampermonkey/comment/build.mjs"
}
}
}
178 changes: 89 additions & 89 deletions src/core/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ export class Comment {
/** 修补评论组件 */
protected bbCommentModify() {
this.styleFix();
this.initAbtest();
this._renderBottomPagination();
// this.initAbtest();
// this._renderBottomPagination();
this._createListCon();
this._createSubReplyItem();
this._registerEvent();
Expand All @@ -178,104 +178,104 @@ export class Comment {
addCss('.image-exhibition {margin-top: 8px;user-select: none;} .image-exhibition .image-item-wrap {max-width: 240px;display: flex;justify-content: center;position: relative;border-radius: 4px;overflow: hidden;cursor: zoom-in;} .image-exhibition .image-item-wrap.vertical {flex-direction: column} .image-exhibition .image-item-wrap.extra-long {justify-content: start;} .image-exhibition .image-item-wrap img {width: 100%;}', 'image-exhibition');
}
/** 退出abtest,获取翻页评论区 */
protected initAbtest() {
const that = this;
Feedback.prototype.initAbtest = function () {
// protected initAbtest() {
// const that = this;
// Feedback.prototype.initAbtest = function () {

this.abtest = {};
this.abtest.optimize = false; //abtest.web_reply_list
// this.abtest = {};
// this.abtest.optimize = false; //abtest.web_reply_list

if (this.jumpId || this.noPage) {
this.abtest.optimize = false;
} // TODO: 漫画独立处理他们的pc 端内容
// if (this.jumpId || this.noPage) {
// this.abtest.optimize = false;
// } // TODO: 漫画独立处理他们的pc 端内容


if (this.appMode === 'comic') {
this.abtest.optimize = false;
}
// if (this.appMode === 'comic') {
// this.abtest.optimize = false;
// }

// 优先获取评论总数
that.getPageCount(this).finally(() => {
this.init();
if (!document.querySelector('.b-head')) {
// 补充评论总数节点
const div = addElement('div', { class: `b-head` }, undefined, '<span class="b-head-t results"></span><span class="b-head-t">评论</span>');
const com = document.querySelector<HTMLElement>('.bb-comment');
com?.insertAdjacentElement('beforebegin', div);
com?.parentElement?.classList.add('common');
addCss('.b-head {\
font-size: 18px;\
line-height: 24px;\
color: #222;\
margin: 0 0 20px;\
}\
.b-head .results {\
margin-right: 10px;\
}', 'b-head');
}
});
// // 优先获取评论总数
// that.getPageCount(this).finally(() => {
// this.init();
// if (!document.querySelector('.b-head')) {
// // 补充评论总数节点
// const div = addElement('div', { class: `b-head` }, undefined, '<span class="b-head-t results"></span><span class="b-head-t">评论</span>');
// const com = document.querySelector<HTMLElement>('.bb-comment');
// com?.insertAdjacentElement('beforebegin', div);
// com?.parentElement?.classList.add('common');
// addCss('.b-head {\
// font-size: 18px;\
// line-height: 24px;\
// color: #222;\
// margin: 0 0 20px;\
// }\
// .b-head .results {\
// margin-right: 10px;\
// }', 'b-head');
// }
// });

this._registerEvent();
};
}
// this._registerEvent();
// };
// }
/** 添加回小页码区 */
protected _renderBottomPagination() {
Feedback.prototype._renderBottomPagination = function (pageInfo: any) {
if (this.noPage) {
var isLastPage = pageInfo.count <= this.pageSize;
var html = '';
// protected _renderBottomPagination() {
// Feedback.prototype._renderBottomPagination = function (pageInfo: any) {
// if (this.noPage) {
// var isLastPage = pageInfo.count <= this.pageSize;
// var html = '';

if (isLastPage) {
html = '没有更多了~';
} else {
html = '<a class="more-link" href="javascript:">查看更多评论</a>';
}
// if (isLastPage) {
// html = '没有更多了~';
// } else {
// html = '<a class="more-link" href="javascript:">查看更多评论</a>';
// }

this.$root.find('.bottom-page').addClass('center').html(html);
return;
}
// this.$root.find('.bottom-page').addClass('center').html(html);
// return;
// }

const count = Math.ceil(pageInfo.count / pageInfo.size);
// const count = Math.ceil(pageInfo.count / pageInfo.size);

if (count > 1) {
this.$root.find(".header-interaction").addClass("paging-box").paging({
pageCount: count,
current: pageInfo.num,
backFn: (p: any) => {
this.$root.trigger('replyPageChange', {
p: p,
isBottom: true
});
this.trigger('replyPageChange', {
p: p,
isBottom: true
});
this.currentPage = p;
}
})
this.$root.find('.bottom-page').paging({
pageCount: count,
current: pageInfo.num,
jump: true,
smallSize: this.smallPager,
backFn: (p: any) => {
this.$root.trigger('replyPageChange', {
p: p,
isBottom: true
});
this.trigger('replyPageChange', {
p: p,
isBottom: true
});
this.currentPage = p;
}
});
} else {
this.$root.find(".header-page").html("");
this.$root.find('.bottom-page').html('');
}
};
}
// if (count > 1) {
// this.$root.find(".header-interaction").addClass("paging-box").paging({
// pageCount: count,
// current: pageInfo.num,
// backFn: (p: any) => {
// this.$root.trigger('replyPageChange', {
// p: p,
// isBottom: true
// });
// this.trigger('replyPageChange', {
// p: p,
// isBottom: true
// });
// this.currentPage = p;
// }
// })
// this.$root.find('.bottom-page').paging({
// pageCount: count,
// current: pageInfo.num,
// jump: true,
// smallSize: this.smallPager,
// backFn: (p: any) => {
// this.$root.trigger('replyPageChange', {
// p: p,
// isBottom: true
// });
// this.trigger('replyPageChange', {
// p: p,
// isBottom: true
// });
// this.currentPage = p;
// }
// });
// } else {
// this.$root.find(".header-page").html("");
// this.$root.find('.bottom-page').html('');
// }
// };
// }
/** 顶层评论ip属地 */
protected _createListCon() {
Feedback.prototype._createListCon = function (item: any, i: any, pos: any) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export class UI {
protected initSettingStyle() {
this.menuitem.style.addSetting([
this.switch('header', '恢复旧版顶栏', '替换所有B站页面中的顶栏为旧版', undefined, undefined, '除非替换后实在不和谐,一般都会进行替换。'),
this.switch('comment', '恢复评论翻页', '替换瀑布流评论区', undefined, undefined, '评论区版本将被固定,可能享受不到B站后续为评论区推出的新功能。本功能有专门独立为一个脚本,不要重复安装。'),
// this.switch('comment', '恢复评论翻页', '替换瀑布流评论区', undefined, undefined, '评论区版本将被固定,可能享受不到B站后续为评论区推出的新功能。本功能有专门独立为一个脚本,不要重复安装。'),
this.switch('staff', '合作UP主', '联合投稿显示合作UP主', undefined, undefined, '在原av页up主信息处列出所有合作up主。'),
this.switch('bangumiEplist', '保留bangumi分P', '牺牲特殊背景图', undefined, undefined, '旧版bangumi遇到有特殊背景图的视频时,会隐藏播放器下方的分集选择界面,二者不可得兼。'),
this.switch('jointime', '注册时间', '个人空间显示账户注册时间'),
Expand Down
2 changes: 1 addition & 1 deletion tampermonkey/build.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import manifest from './manifest.json' assert { type: 'json' };
import manifest from './manifest.json' with { type: 'json' };
import fs from 'fs-extra';
import esbuild from 'esbuild';
import { exec } from 'child_process';
Expand Down
2 changes: 1 addition & 1 deletion tampermonkey/comment/build.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import manifest from './manifest.json' assert { type: 'json' };
import manifest from './manifest.json' with { type: 'json' };
import esbuild from 'esbuild';

const banner = Object.entries(manifest).reduce((s, d) => {
Expand Down
Loading

0 comments on commit 5a7ccd0

Please sign in to comment.