aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/render
diff options
context:
space:
mode:
authorAjay <[email protected]>2022-09-18 03:15:20 -0400
committerAjay <[email protected]>2022-09-18 03:15:20 -0400
commit6d757857cb6af4255470ddb442138fed9e85675a (patch)
tree4bd23e3befd49ca1a4f0cf2a3a3126782a748bcb /src/render
parent4804c7f43974087e42d61913222d5ef9711b087d (diff)
downloadSponsorBlock-6d757857cb6af4255470ddb442138fed9e85675a.tar.gz
SponsorBlock-6d757857cb6af4255470ddb442138fed9e85675a.zip
Add tooltip about chapters feature
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Tooltip.tsx12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/render/Tooltip.tsx b/src/render/Tooltip.tsx
index d59728fe..dd9a26cc 100644
--- a/src/render/Tooltip.tsx
+++ b/src/render/Tooltip.tsx
@@ -5,6 +5,7 @@ import { ButtonListener } from "../types";
export interface TooltipProps {
text?: string;
link?: string;
+ linkOnClick?: () => void;
referenceNode: HTMLElement;
prependElement?: HTMLElement; // Element to append before
bottomOffset?: string;
@@ -16,6 +17,7 @@ export interface TooltipProps {
extraClass?: string;
showLogo?: boolean;
showGotIt?: boolean;
+ positionRealtive?: boolean;
buttons?: ButtonListener[];
}
@@ -34,11 +36,12 @@ export class Tooltip {
props.extraClass ??= "";
props.showLogo ??= true;
props.showGotIt ??= true;
+ props.positionRealtive ??= true;
this.text = props.text;
this.container = document.createElement('div');
this.container.id = "sponsorTooltip" + props.text;
- this.container.style.position = "relative";
+ if (props.positionRealtive) this.container.style.position = "relative";
if (props.prependElement) {
props.referenceNode.insertBefore(this.container, props.prependElement);
@@ -71,7 +74,12 @@ export class Tooltip {
href={props.link}>
{chrome.i18n.getMessage("LearnMore")}
</a>
- : null}
+ : (props.linkOnClick ?
+ <a style={{textDecoration: "underline", marginLeft: "5px", cursor: "pointer"}}
+ onClick={props.linkOnClick}>
+ {chrome.i18n.getMessage("LearnMore")}
+ </a>
+ : null)}
</span>
: null}