mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-13 02:14:23 +01:00
Don't show harmful vote option for non chapters
This commit is contained in:
parent
052a805a98
commit
d3fa735481
1 changed files with 34 additions and 30 deletions
|
@ -1,6 +1,6 @@
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import Config from "../config";
|
import Config from "../config";
|
||||||
import { Category, SegmentUUID, SponsorTime } from "../types";
|
import { ActionType, Category, SegmentUUID, SponsorTime } from "../types";
|
||||||
|
|
||||||
import ThumbsUpSvg from "../svg-icons/thumbs_up_svg";
|
import ThumbsUpSvg from "../svg-icons/thumbs_up_svg";
|
||||||
import ThumbsDownSvg from "../svg-icons/thumbs_down_svg";
|
import ThumbsDownSvg from "../svg-icons/thumbs_down_svg";
|
||||||
|
@ -65,35 +65,39 @@ class ChapterVoteComponent extends React.Component<ChapterVoteProps, ChapterVote
|
||||||
this.tooltip.close();
|
this.tooltip.close();
|
||||||
this.tooltip = null;
|
this.tooltip = null;
|
||||||
} else {
|
} else {
|
||||||
const referenceNode = chapterNode?.parentElement?.parentElement;
|
if (this.state.segment?.actionType === ActionType.Chapter) {
|
||||||
if (referenceNode) {
|
const referenceNode = chapterNode?.parentElement?.parentElement;
|
||||||
const outerBounding = referenceNode.getBoundingClientRect();
|
if (referenceNode) {
|
||||||
const buttonBounding = (e.target as HTMLElement)?.parentElement?.getBoundingClientRect();
|
const outerBounding = referenceNode.getBoundingClientRect();
|
||||||
|
const buttonBounding = (e.target as HTMLElement)?.parentElement?.getBoundingClientRect();
|
||||||
this.tooltip = new Tooltip({
|
|
||||||
referenceNode: chapterNode?.parentElement?.parentElement,
|
this.tooltip = new Tooltip({
|
||||||
prependElement: chapterNode?.parentElement,
|
referenceNode: chapterNode?.parentElement?.parentElement,
|
||||||
showLogo: false,
|
prependElement: chapterNode?.parentElement,
|
||||||
showGotIt: false,
|
showLogo: false,
|
||||||
bottomOffset: `${outerBounding.height + 25}px`,
|
showGotIt: false,
|
||||||
leftOffset: `${buttonBounding.x - outerBounding.x}px`,
|
bottomOffset: `${outerBounding.height + 25}px`,
|
||||||
extraClass: "centeredSBTriangle",
|
leftOffset: `${buttonBounding.x - outerBounding.x}px`,
|
||||||
buttons: [
|
extraClass: "centeredSBTriangle",
|
||||||
{
|
buttons: [
|
||||||
name: chrome.i18n.getMessage("incorrectVote"),
|
{
|
||||||
listener: (event) => this.vote(event, 0, e.target as HTMLElement).then(() => {
|
name: chrome.i18n.getMessage("incorrectVote"),
|
||||||
this.tooltip?.close();
|
listener: (event) => this.vote(event, 0, e.target as HTMLElement).then(() => {
|
||||||
this.tooltip = null;
|
this.tooltip?.close();
|
||||||
})
|
this.tooltip = null;
|
||||||
}, {
|
})
|
||||||
name: chrome.i18n.getMessage("harmfulVote"),
|
}, {
|
||||||
listener: (event) => this.vote(event, 30, e.target as HTMLElement).then(() => {
|
name: chrome.i18n.getMessage("harmfulVote"),
|
||||||
this.tooltip?.close();
|
listener: (event) => this.vote(event, 30, e.target as HTMLElement).then(() => {
|
||||||
this.tooltip = null;
|
this.tooltip?.close();
|
||||||
})
|
this.tooltip = null;
|
||||||
}
|
})
|
||||||
]
|
}
|
||||||
});
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.vote(e, 0, e.target as HTMLElement)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
|
|
Loading…
Reference in a new issue