Skip to content

Commit

Permalink
BiliComments 支持刷新 (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
MotooriKashin authored Sep 7, 2024
1 parent 24dcbfd commit df7fa73
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 5 deletions.
16 changes: 16 additions & 0 deletions src/core/comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,16 @@ export class Comment {
set: v => true,
get: () => {
return class extends EventTarget {

$parent?: HTMLElement;

constructor(private arg: IBiliComments) {
super();
}

mount(parent: HTMLElement) {
if (load) {
this.$parent = parent;
const [type, oid] = this.arg.params.split(",");
new Feedback(parent, oid, type, undefined, this.arg.seekId);
setTimeout(() => {
Expand All @@ -137,6 +141,18 @@ export class Comment {
}
return this;
}

dispatchAction({ type, args, callback }: any) {
switch (type) {
case 'reload': {
const [type, oid] = args[0].params.split(",");
this.$parent?.replaceChildren();
new Feedback(this.$parent, oid, type, undefined, this.arg.seekId);
callback?.();
break;
}
}
}
}
}
});
Expand Down
18 changes: 16 additions & 2 deletions tampermonkey/comment/main.user.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tampermonkey/comment/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Bilibili 翻页评论区",
"namespace": "MotooriKashin",
"version": "2.2.8",
"version": "2.2.9",
"description": "恢复评论区翻页功能。",
"author": "MotooriKashin",
"homepage": "https://github.com/MotooriKashin/Bilibili-Old",
Expand Down
16 changes: 15 additions & 1 deletion tampermonkey/main.user.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tampermonkey/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Bilibili 旧播放页",
"namespace": "MotooriKashin",
"version": "10.8.4",
"version": "10.8.5",
"description": "恢复Bilibili旧版页面,为了那些念旧的人。",
"author": "MotooriKashin, wly5556",
"homepage": "https://github.com/MotooriKashin/Bilibili-Old",
Expand Down

0 comments on commit df7fa73

Please sign in to comment.