Skip to content

Commit

Permalink
Merge pull request #120 from xiaoxuan010/master
Browse files Browse the repository at this point in the history
Fix some minor errors and styles
  • Loading branch information
hanydd authored Jan 5, 2025
2 parents 8c6d390 + 56b1d5d commit cab71c0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
23 changes: 23 additions & 0 deletions public/content.css
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,29 @@
display: none !important;
}

/* Tooltip 编码灵感源于:the1812/Bilibili-Evolved
* https://github.com/the1812/Bilibili-Evolved
*/
.playerButtonTooltip {
pointer-events: none;
font-size: 12px;
padding: 6px 8px;
line-height: 1.5;
white-space: nowrap;
color: var(--bpx-tooltip-color, #fff);
background-color: var(--bpx-tooltip-bgcolor, #000);
border-radius: 4px;
position: absolute;
transform: translateX(calc(-50% + 20px)) translateY(calc(-100% - 36px));
opacity: 0;
}

.playerButton:hover .playerButtonTooltip {
transition: all 0.2s ease-out 0.1s;
opacity: 1;
transform: translateX(calc(-50% + 20px)) translateY(calc(-100% - 41px));
}

/* Removes auto width from being a ytp-player-button */
.sbPlayerDownvote {
width: auto !important;
Expand Down
2 changes: 1 addition & 1 deletion src/components/playerButtons/PlayerButtonComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const PlayerButtonComponent = forwardRef<HTMLButtonElement, PlayerButtonProps>(f
id={baseID + "Button"}
className="playerButton bpx-player-ctrl-btn"
style={{ maxWidth: "40px", display: show ? "unset" : "none" }}
title={chrome.i18n.getMessage(title)}
draggable={isDraggable}
onClick={onClick}
>
Expand All @@ -31,6 +30,7 @@ const PlayerButtonComponent = forwardRef<HTMLButtonElement, PlayerButtonProps>(f
src={chrome.runtime.getURL("icons/" + getIconLink(imageName))}
draggable={isDraggable}
></img>
<div className="playerButtonTooltip">{chrome.i18n.getMessage(title)}</div>
</button>
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/utils/parseVideoID.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function getBvIDFromURL(url: string): Promise<VideoID | null> {
//Attempt to parse url
let urlObject: URL | null = null;
try {
urlObject = new URL(url);
urlObject = new URL(url, window.location.origin);
} catch (e) {
console.error("[BSB] Unable to parse URL: " + url);
return null;
Expand Down

0 comments on commit cab71c0

Please sign in to comment.