Skip to content

Commit

Permalink
Display card on video page
Browse files Browse the repository at this point in the history
  • Loading branch information
gaogaotiantian committed May 1, 2023
1 parent 5e99926 commit e945e44
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 3,
"name": "BiliScope",
"version": "0.2.0",
"version": "0.2.1",
"description": "Bilibili插件,知道TA是个什么UP主",
"icons": {
"128": "img/logo.png"
Expand Down
8 changes: 2 additions & 6 deletions scripts/biliscope.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,8 @@ function getTarget(target) {
}
}
} else {
for (let userLink of [target, target.parentNode]) {
if (userLink.tagName == "A" && userLink.href.startsWith(BILIBILI_SPACE_URL)) {
if (userLink.hasAttribute("report-id")) {
// Video page, the uploader name link, avoid overlap
return null;
}
for (let userLink of [target, target.parentNode, target.parentNode.parentNode]) {
if (userLink && userLink.tagName == "A" && userLink.href.startsWith(BILIBILI_SPACE_URL)) {
return userLink;
}
}
Expand Down
4 changes: 1 addition & 3 deletions scripts/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ function UserProfileCard() {
this.target = null;
this.enabled = false;
this.wordCloud = null;
this.lastDisable = 0;
this.el = document.createElement("div");
this.el.style.position = "absolute";
this.el.style.display = "none";
Expand Down Expand Up @@ -194,7 +193,7 @@ UserProfileCard.prototype.disable = function() {
}

UserProfileCard.prototype.enable = function() {
if (!this.enabled && Date.now() - this.lastDisable > 50) {
if (!this.enabled) {
this.enabled = true;
this.idCardObserver.observe(document.body, {
"childList": true,
Expand Down Expand Up @@ -267,7 +266,6 @@ UserProfileCard.prototype.updateTarget = function(target) {
upc = this
this.target.addEventListener("mouseleave", function leaveHandle(ev) {
upc.disable();
upc.lastDisable = Date.now();
this.removeEventListener("mouseleave", leaveHandle);
})
}
Expand Down

0 comments on commit e945e44

Please sign in to comment.