mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 05:27:03 +03:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec12c1d324 | ||
|
|
4447ff3142 | ||
|
|
00ef3856ca | ||
|
|
cd7d74fb33 | ||
|
|
ce3f77ed20 |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "__MSG_fullName__",
|
||||
"short_name": "SponsorBlock",
|
||||
"version": "5.1.6",
|
||||
"version": "5.1.7",
|
||||
"default_locale": "en",
|
||||
"description": "__MSG_Description__",
|
||||
"homepage_url": "https://sponsor.ajay.app",
|
||||
|
||||
@@ -140,16 +140,17 @@ class CategoryPillComponent extends React.Component<CategoryPillProps, CategoryP
|
||||
}
|
||||
|
||||
private openTooltip(): void {
|
||||
const tooltipMount = document.querySelector("ytd-video-primary-info-renderer > #container") as HTMLElement;
|
||||
const tooltipMount = document.querySelector("#above-the-fold") as HTMLElement;
|
||||
if (tooltipMount) {
|
||||
this.tooltip = new Tooltip({
|
||||
text: this.getTitleText(),
|
||||
referenceNode: tooltipMount,
|
||||
bottomOffset: "70px",
|
||||
bottomOffset: "0px",
|
||||
opacity: 0.95,
|
||||
displayTriangle: false,
|
||||
showLogo: false,
|
||||
showGotIt: false
|
||||
showGotIt: false,
|
||||
prependElement: tooltipMount.firstElementChild as HTMLElement
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1567,6 +1567,13 @@ function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments:
|
||||
const includedTimes: ScheduledTime[] = [];
|
||||
const scheduledTimes: number[] = [];
|
||||
|
||||
const shouldIncludeTime = (segment: ScheduledTime ) => (minimum === undefined
|
||||
|| ((includeNonIntersectingSegments && segment.scheduledTime >= minimum)
|
||||
|| (includeIntersectingSegments && segment.scheduledTime < minimum && segment.segment[1] > minimum)))
|
||||
&& (!hideHiddenSponsors || segment.hidden === SponsorHideType.Visible)
|
||||
&& segment.segment.length === 2
|
||||
&& segment.actionType !== ActionType.Poi;
|
||||
|
||||
const possibleTimes = sponsorTimes.map((sponsorTime) => ({
|
||||
...sponsorTime,
|
||||
scheduledTime: sponsorTime.segment[0]
|
||||
@@ -1574,7 +1581,7 @@ function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments:
|
||||
|
||||
// Schedule at the end time to know when to unmute and remove title from seek bar
|
||||
sponsorTimes.forEach(sponsorTime => {
|
||||
if (!possibleTimes.some((time) => sponsorTime.segment[1] === time.scheduledTime)
|
||||
if (!possibleTimes.some((time) => sponsorTime.segment[1] === time.scheduledTime && shouldIncludeTime(time))
|
||||
&& (minimum === undefined || sponsorTime.segment[1] > minimum)) {
|
||||
possibleTimes.push({
|
||||
...sponsorTime,
|
||||
@@ -1584,13 +1591,7 @@ function getStartTimes(sponsorTimes: SponsorTime[], includeIntersectingSegments:
|
||||
});
|
||||
|
||||
for (let i = 0; i < possibleTimes.length; i++) {
|
||||
if ((minimum === undefined
|
||||
|| ((includeNonIntersectingSegments && possibleTimes[i].scheduledTime >= minimum)
|
||||
|| (includeIntersectingSegments && possibleTimes[i].scheduledTime < minimum && possibleTimes[i].segment[1] > minimum)))
|
||||
&& (!hideHiddenSponsors || possibleTimes[i].hidden === SponsorHideType.Visible)
|
||||
&& possibleTimes[i].segment.length === 2
|
||||
&& possibleTimes[i].actionType !== ActionType.Poi) {
|
||||
|
||||
if (shouldIncludeTime(possibleTimes[i])) {
|
||||
scheduledTimes.push(possibleTimes[i].scheduledTime);
|
||||
includedTimes.push(possibleTimes[i]);
|
||||
}
|
||||
|
||||
@@ -43,8 +43,10 @@ export class CategoryPill {
|
||||
this.root.render(<CategoryPillComponent ref={this.ref} vote={vote} />);
|
||||
|
||||
if (this.unsavedState) {
|
||||
this.ref.current?.setState(this.unsavedState);
|
||||
this.unsavedState = null;
|
||||
GenericUtils.wait(() => this.ref.current).then(() => {
|
||||
this.ref.current?.setState(this.unsavedState);
|
||||
this.unsavedState = null;
|
||||
});
|
||||
}
|
||||
|
||||
if (onMobileYouTube) {
|
||||
|
||||
@@ -71,8 +71,7 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number):
|
||||
|
||||
const chapters: SponsorTime[] = [];
|
||||
// .ytp-timed-markers-container indicates that key-moments are present, which should not be divided
|
||||
if (chaptersBox && !(getControls()?.parentElement?.parentElement
|
||||
?.querySelector(".ytp-timed-markers-container")?.childElementCount > 0)) {
|
||||
if (chaptersBox) {
|
||||
let lastSegment: SponsorTime = null;
|
||||
const links = chaptersBox.querySelectorAll("ytd-macro-markers-list-item-renderer > a");
|
||||
for (const link of links) {
|
||||
@@ -104,6 +103,11 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number):
|
||||
}
|
||||
}
|
||||
|
||||
if (chapters[0] && chapters[0].segment[0] !== 0) {
|
||||
// This is key moments instead of chapters, don't import as they are not full sections
|
||||
return [];
|
||||
}
|
||||
|
||||
return chapters;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user