mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 03:57:09 +03:00
Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7d85ca3c7 | ||
|
|
56611598b2 | ||
|
|
23e0666569 | ||
|
|
6571bba218 | ||
|
|
51fc6fde22 | ||
|
|
b8d6d4a0b3 | ||
|
|
6381f36a90 | ||
|
|
b9ef35dbbe | ||
|
|
b43e3dab71 | ||
|
|
901dbb1ecf | ||
|
|
68e01fbcc0 | ||
|
|
43d4b7ef18 | ||
|
|
4a00f3398e | ||
|
|
8054e3d8f2 | ||
|
|
b0e1d5e7fa | ||
|
|
d9e723b265 | ||
|
|
9bb8a0986f | ||
|
|
6418d09039 | ||
|
|
afab681a60 | ||
|
|
8db077887d |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "__MSG_fullName__",
|
"name": "__MSG_fullName__",
|
||||||
"short_name": "SponsorBlock",
|
"short_name": "SponsorBlock",
|
||||||
"version": "5.0.1",
|
"version": "5.0.2",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_Description__",
|
"description": "__MSG_Description__",
|
||||||
"homepage_url": "https://sponsor.ajay.app",
|
"homepage_url": "https://sponsor.ajay.app",
|
||||||
|
|||||||
@@ -1107,7 +1107,7 @@
|
|||||||
"message": "Export segments"
|
"message": "Export segments"
|
||||||
},
|
},
|
||||||
"importSegments": {
|
"importSegments": {
|
||||||
"message": "Import chapters"
|
"message": "Import segments"
|
||||||
},
|
},
|
||||||
"Import": {
|
"Import": {
|
||||||
"message": "Import",
|
"message": "Import",
|
||||||
|
|||||||
@@ -26,11 +26,15 @@
|
|||||||
transition: transform .1s cubic-bezier(0,0,0.2,1);
|
transition: transform .1s cubic-bezier(0,0,0.2,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ytp-big-mode #previewbar {
|
||||||
|
transform: scaleY(0.625) translateY(-30%) translateY(1.5px);
|
||||||
|
}
|
||||||
|
|
||||||
.progress-bar-line > #previewbar {
|
.progress-bar-line > #previewbar {
|
||||||
height: 3px;
|
height: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#previewbar.hovered {
|
div:hover > #previewbar.sbNotInvidious {
|
||||||
transform: scaleY(1)
|
transform: scaleY(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +130,7 @@ div:hover > .sponsorBlockChapterBar {
|
|||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
}
|
}
|
||||||
|
|
||||||
.playerButton.hidden {
|
.playerButton.hidden:not(.autoHiding) {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ let lastKnownVideoTime: { videoTime: number, preciseTime: number } = {
|
|||||||
};
|
};
|
||||||
// It resumes with a slightly later time on chromium
|
// It resumes with a slightly later time on chromium
|
||||||
let lastTimeFromWaitingEvent = null;
|
let lastTimeFromWaitingEvent = null;
|
||||||
|
const lastNextChapterKeybind = {
|
||||||
|
time: 0,
|
||||||
|
date: 0
|
||||||
|
};
|
||||||
|
|
||||||
// Skips are scheduled to ensure precision.
|
// Skips are scheduled to ensure precision.
|
||||||
// Skips are rescheduled every seeking event.
|
// Skips are rescheduled every seeking event.
|
||||||
@@ -338,6 +342,7 @@ function resetValues() {
|
|||||||
existingChaptersImported = false;
|
existingChaptersImported = false;
|
||||||
sponsorSkipped = [];
|
sponsorSkipped = [];
|
||||||
|
|
||||||
|
sponsorVideoID = null;
|
||||||
videoInfo = null;
|
videoInfo = null;
|
||||||
pageType = null;
|
pageType = null;
|
||||||
channelWhitelisted = false;
|
channelWhitelisted = false;
|
||||||
@@ -379,10 +384,8 @@ async function videoIDChange(id): Promise<void> {
|
|||||||
//if the id has not changed return unless the video element has changed
|
//if the id has not changed return unless the video element has changed
|
||||||
if (sponsorVideoID === id && (isVisible(video) || !video)) return;
|
if (sponsorVideoID === id && (isVisible(video) || !video)) return;
|
||||||
|
|
||||||
//set the global videoID
|
|
||||||
sponsorVideoID = id;
|
|
||||||
|
|
||||||
resetValues();
|
resetValues();
|
||||||
|
sponsorVideoID = id;
|
||||||
|
|
||||||
//id is not valid
|
//id is not valid
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
@@ -612,7 +615,8 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
|
|||||||
|
|
||||||
for (const segment of skipInfo.array) {
|
for (const segment of skipInfo.array) {
|
||||||
if (shouldAutoSkip(segment) &&
|
if (shouldAutoSkip(segment) &&
|
||||||
segment.segment[0] >= skipTime[0] && segment.segment[1] <= skipTime[1]) {
|
segment.segment[0] >= skipTime[0] && segment.segment[1] <= skipTime[1]
|
||||||
|
&& segment.segment[0] === segment.scheduledTime) { // Don't include artifical scheduled segments (end times for mutes)
|
||||||
skippingSegments.push(segment);
|
skippingSegments.push(segment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -620,9 +624,6 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
|
|||||||
|
|
||||||
logDebug(`Next step in starting skipping: ${!shouldSkip(currentSkip)}, ${!sponsorTimesSubmitting?.some((segment) => segment.segment === currentSkip.segment)}`);
|
logDebug(`Next step in starting skipping: ${!shouldSkip(currentSkip)}, ${!sponsorTimesSubmitting?.some((segment) => segment.segment === currentSkip.segment)}`);
|
||||||
|
|
||||||
// Don't skip if this category should not be skipped
|
|
||||||
if (!shouldSkip(currentSkip) && !sponsorTimesSubmitting?.some((segment) => segment.segment === currentSkip.segment)) return;
|
|
||||||
|
|
||||||
const skippingFunction = (forceVideoTime?: number) => {
|
const skippingFunction = (forceVideoTime?: number) => {
|
||||||
let forcedSkipTime: number = null;
|
let forcedSkipTime: number = null;
|
||||||
let forcedIncludeIntersectingSegments = false;
|
let forcedIncludeIntersectingSegments = false;
|
||||||
@@ -1044,7 +1045,7 @@ async function sponsorsLookup(keepOldSubmissions = true) {
|
|||||||
|
|
||||||
function importExistingChapters(wait: boolean) {
|
function importExistingChapters(wait: boolean) {
|
||||||
if (!existingChaptersImported) {
|
if (!existingChaptersImported) {
|
||||||
GenericUtils.wait(() => video && getExistingChapters(sponsorVideoID, video.duration),
|
GenericUtils.wait(() => video?.duration && getExistingChapters(sponsorVideoID, video.duration),
|
||||||
wait ? 5000 : 0, 100, (c) => c?.length > 0).then((chapters) => {
|
wait ? 5000 : 0, 100, (c) => c?.length > 0).then((chapters) => {
|
||||||
if (!existingChaptersImported && chapters?.length > 0) {
|
if (!existingChaptersImported && chapters?.length > 0) {
|
||||||
sponsorTimes = (sponsorTimes ?? []).concat(...chapters).sort((a, b) => a.segment[0] - b.segment[0]);
|
sponsorTimes = (sponsorTimes ?? []).concat(...chapters).sort((a, b) => a.segment[0] - b.segment[0]);
|
||||||
@@ -2203,8 +2204,7 @@ function windowListenerHandler(event: MessageEvent): void {
|
|||||||
const dataType = data.type;
|
const dataType = data.type;
|
||||||
if (data.source !== "sponsorblock") return;
|
if (data.source !== "sponsorblock") return;
|
||||||
|
|
||||||
if (dataType === "navigation") {
|
if (dataType === "navigation" && data.videoID) {
|
||||||
sponsorVideoID = data.videoID;
|
|
||||||
pageType = data.pageType;
|
pageType = data.pageType;
|
||||||
|
|
||||||
if (data.channelID) {
|
if (data.channelID) {
|
||||||
@@ -2213,17 +2213,17 @@ function windowListenerHandler(event: MessageEvent): void {
|
|||||||
status: ChannelIDStatus.Found
|
status: ChannelIDStatus.Found
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
videoIDChange(data.videoID);
|
||||||
} else if (dataType === "ad") {
|
} else if (dataType === "ad") {
|
||||||
if (isAdPlaying != data.playing) {
|
if (isAdPlaying != data.playing) {
|
||||||
isAdPlaying = data.playing
|
isAdPlaying = data.playing
|
||||||
updatePreviewBar();
|
updatePreviewBar();
|
||||||
updateVisibilityOfPlayerControlsButton();
|
updateVisibilityOfPlayerControlsButton();
|
||||||
}
|
}
|
||||||
} else if (dataType === "data") {
|
} else if (dataType === "data" && data.videoID) {
|
||||||
if (data.video !== sponsorVideoID) {
|
videoIDChange(data.videoID);
|
||||||
sponsorVideoID = data.videoID;
|
|
||||||
videoIDChange(sponsorVideoID);
|
|
||||||
}
|
|
||||||
isLivePremiere = data.isLive || data.isPremiere
|
isLivePremiere = data.isLive || data.isPremiere
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2237,30 +2237,39 @@ function updateActiveSegment(currentTime: number): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function nextChapter(): void {
|
function nextChapter(): void {
|
||||||
const chapters = sponsorTimes.filter((time) => time.actionType === ActionType.Chapter)
|
const chapters = previewBar.unfilteredChapterGroups?.filter((time) => [ActionType.Chapter, null].includes(time.actionType));
|
||||||
.sort((a, b) => a.segment[1] - b.segment[1]);
|
if (!chapters || chapters.length <= 0) return;
|
||||||
if (chapters.length <= 0) return;
|
|
||||||
|
|
||||||
const nextChapter = chapters.findIndex((time) => time.actionType === ActionType.Chapter
|
lastNextChapterKeybind.time = video.currentTime;
|
||||||
&& time.segment[1] > video.currentTime);
|
lastNextChapterKeybind.date = Date.now();
|
||||||
|
|
||||||
|
const nextChapter = chapters.findIndex((time) => time.segment[0] > video.currentTime);
|
||||||
if (nextChapter !== -1) {
|
if (nextChapter !== -1) {
|
||||||
reskipSponsorTime(chapters[nextChapter], true);
|
video.currentTime = chapters[nextChapter].segment[0];
|
||||||
} else {
|
} else {
|
||||||
video.currentTime = video.duration;
|
video.currentTime = video.duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function previousChapter(): void {
|
function previousChapter(): void {
|
||||||
const chapters = sponsorTimes.filter((time) => time.actionType === ActionType.Chapter);
|
if (Date.now() - lastNextChapterKeybind.date < 3000) {
|
||||||
if (chapters.length <= 0) return;
|
video.currentTime = lastNextChapterKeybind.time;
|
||||||
|
lastNextChapterKeybind.date = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const chapters = previewBar.unfilteredChapterGroups?.filter((time) => [ActionType.Chapter, null].includes(time.actionType));
|
||||||
|
if (!chapters || chapters.length <= 0) {
|
||||||
|
video.currentTime = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// subtract 5 seconds to allow skipping back to the previous chapter if close to start of
|
// subtract 5 seconds to allow skipping back to the previous chapter if close to start of
|
||||||
// the current one
|
// the current one
|
||||||
const nextChapter = chapters.findIndex((time) => time.actionType === ActionType.Chapter
|
const nextChapter = chapters.findIndex((time) => time.segment[0] > video.currentTime - Math.min(5, time.segment[1] - time.segment[0]));
|
||||||
&& time.segment[0] > video.currentTime - Math.min(5, time.segment[1] - time.segment[0]));
|
|
||||||
const previousChapter = nextChapter !== -1 ? (nextChapter - 1) : (chapters.length - 1);
|
const previousChapter = nextChapter !== -1 ? (nextChapter - 1) : (chapters.length - 1);
|
||||||
if (previousChapter !== -1) {
|
if (previousChapter !== -1) {
|
||||||
unskipSponsorTime(chapters[previousChapter], null, true);
|
video.currentTime = chapters[previousChapter].segment[0];
|
||||||
} else {
|
} else {
|
||||||
video.currentTime = 0;
|
video.currentTime = 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ export interface PreviewBarSegment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface ChapterGroup extends SegmentContainer {
|
interface ChapterGroup extends SegmentContainer {
|
||||||
originalDuration: number
|
originalDuration: number;
|
||||||
|
actionType: ActionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
class PreviewBar {
|
class PreviewBar {
|
||||||
@@ -53,6 +54,9 @@ class PreviewBar {
|
|||||||
chapterVote: ChapterVote;
|
chapterVote: ChapterVote;
|
||||||
originalChapterBar: HTMLElement;
|
originalChapterBar: HTMLElement;
|
||||||
originalChapterBarBlocks: NodeListOf<HTMLElement>;
|
originalChapterBarBlocks: NodeListOf<HTMLElement>;
|
||||||
|
chapterMargin: number;
|
||||||
|
unfilteredChapterGroups: ChapterGroup[];
|
||||||
|
chapterGroups: ChapterGroup[];
|
||||||
|
|
||||||
constructor(parent: HTMLElement, onMobileYouTube: boolean, onInvidious: boolean, chapterVote: ChapterVote, test=false) {
|
constructor(parent: HTMLElement, onMobileYouTube: boolean, onInvidious: boolean, chapterVote: ChapterVote, test=false) {
|
||||||
if (test) return;
|
if (test) return;
|
||||||
@@ -74,6 +78,10 @@ class PreviewBar {
|
|||||||
setupHoverText(): void {
|
setupHoverText(): void {
|
||||||
if (this.onMobileYouTube || this.onInvidious) return;
|
if (this.onMobileYouTube || this.onInvidious) return;
|
||||||
|
|
||||||
|
// delete old ones
|
||||||
|
document.querySelectorAll(`.sponsorCategoryTooltip`)
|
||||||
|
.forEach((e) => e.remove());
|
||||||
|
|
||||||
// Create label placeholder
|
// Create label placeholder
|
||||||
this.categoryTooltip = document.createElement("div");
|
this.categoryTooltip = document.createElement("div");
|
||||||
this.categoryTooltip.className = "ytp-tooltip-title sponsorCategoryTooltip";
|
this.categoryTooltip.className = "ytp-tooltip-title sponsorCategoryTooltip";
|
||||||
@@ -191,10 +199,7 @@ class PreviewBar {
|
|||||||
|
|
||||||
this.container.style.transform = "none";
|
this.container.style.transform = "none";
|
||||||
} else if (!this.onInvidious) {
|
} else if (!this.onInvidious) {
|
||||||
// Hover listener
|
this.container.classList.add("sbNotInvidious");
|
||||||
this.parent.addEventListener("mouseenter", () => this.container.classList.add("hovered"));
|
|
||||||
|
|
||||||
this.parent.addEventListener("mouseleave", () => this.container.classList.remove("hovered"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// On the seek bar
|
// On the seek bar
|
||||||
@@ -225,16 +230,29 @@ class PreviewBar {
|
|||||||
const allProgressBars = document.querySelectorAll('.ytp-progress-bar') as NodeListOf<HTMLElement>;
|
const allProgressBars = document.querySelectorAll('.ytp-progress-bar') as NodeListOf<HTMLElement>;
|
||||||
this.progressBar = findValidElement(allProgressBars) ?? allProgressBars?.[0];
|
this.progressBar = findValidElement(allProgressBars) ?? allProgressBars?.[0];
|
||||||
|
|
||||||
this.originalChapterBar = this.progressBar.querySelector(".ytp-chapters-container:not(.sponsorBlockChapterBar)") as HTMLElement;
|
const newChapterBar = this.progressBar.querySelector(".ytp-chapters-container:not(.sponsorBlockChapterBar)") as HTMLElement;
|
||||||
|
if (this.originalChapterBar !== newChapterBar) {
|
||||||
|
// Make sure changes are undone on old bar
|
||||||
|
this.originalChapterBar?.style?.removeProperty("display");
|
||||||
|
|
||||||
|
this.originalChapterBar = newChapterBar;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private update(): void {
|
private update(): void {
|
||||||
this.clear();
|
this.clear();
|
||||||
if (!this.segments) return;
|
if (!this.segments) return;
|
||||||
|
|
||||||
|
this.chapterMargin = 2;
|
||||||
if (this.originalChapterBar) {
|
if (this.originalChapterBar) {
|
||||||
this.originalChapterBarBlocks = this.originalChapterBar.querySelectorAll(":scope > div") as NodeListOf<HTMLElement>
|
this.originalChapterBarBlocks = this.originalChapterBar.querySelectorAll(":scope > div") as NodeListOf<HTMLElement>
|
||||||
this.existingChapters = this.segments.filter((s) => s.source === SponsorSourceType.YouTube).sort((a, b) => a.segment[0] - b.segment[0]);
|
this.existingChapters = this.segments.filter((s) => s.source === SponsorSourceType.YouTube).sort((a, b) => a.segment[0] - b.segment[0]);
|
||||||
|
|
||||||
|
if (this.existingChapters?.length > 0) {
|
||||||
|
const margin = parseFloat(this.originalChapterBarBlocks?.[0]?.style?.marginRight?.replace("px", ""));
|
||||||
|
if (margin) this.chapterMargin = margin;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortedSegments = this.segments.sort(({ segment: a }, { segment: b }) => {
|
const sortedSegments = this.segments.sort(({ segment: a }, { segment: b }) => {
|
||||||
@@ -277,7 +295,8 @@ class PreviewBar {
|
|||||||
bar.style.position = "absolute";
|
bar.style.position = "absolute";
|
||||||
const duration = Math.min(segment[1], this.videoDuration) - segment[0];
|
const duration = Math.min(segment[1], this.videoDuration) - segment[0];
|
||||||
if (duration > 0) {
|
if (duration > 0) {
|
||||||
bar.style.width = `calc(${this.intervalToPercentage(segment[0], segment[1])}${this.chapterFilter(barSegment) ? ' - 2px' : ''})`;
|
bar.style.width = `calc(${this.intervalToPercentage(segment[0], segment[1])}${
|
||||||
|
this.chapterFilter(barSegment) && segment[1] < this.videoDuration ? ` - ${this.chapterMargin}px` : ''})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const time = segment[1] ? Math.min(this.videoDuration, segment[0]) : segment[0];
|
const time = segment[1] ? Math.min(this.videoDuration, segment[0]) : segment[0];
|
||||||
@@ -287,25 +306,42 @@ class PreviewBar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createChaptersBar(segments: PreviewBarSegment[]): void {
|
createChaptersBar(segments: PreviewBarSegment[]): void {
|
||||||
if (!this.progressBar || !this.originalChapterBar || this.originalChapterBar.childElementCount <= 0) return;
|
if (!this.progressBar || !this.originalChapterBar || this.originalChapterBar.childElementCount <= 0) {
|
||||||
|
if (this.customChaptersBar) this.customChaptersBar.style.display = "none";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge overlapping chapters
|
||||||
|
this.unfilteredChapterGroups = this.createChapterRenderGroups(segments);
|
||||||
|
|
||||||
if (segments.every((segments) => segments.source === SponsorSourceType.YouTube)
|
if (segments.every((segments) => segments.source === SponsorSourceType.YouTube)
|
||||||
|| (!Config.config.renderSegmentsAsChapters
|
|| (!Config.config.renderSegmentsAsChapters
|
||||||
&& segments.every((segment) => segment.actionType !== ActionType.Chapter
|
&& segments.every((segment) => segment.actionType !== ActionType.Chapter
|
||||||
|| segment.source === SponsorSourceType.YouTube))) {
|
|| segment.source === SponsorSourceType.YouTube))
|
||||||
|
|| this.chapterGroups?.length <= 0) {
|
||||||
if (this.customChaptersBar) this.customChaptersBar.style.display = "none";
|
if (this.customChaptersBar) this.customChaptersBar.style.display = "none";
|
||||||
this.originalChapterBar.style.removeProperty("display");
|
this.originalChapterBar.style.removeProperty("display");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge overlapping chapters
|
|
||||||
const filteredSegments = segments?.filter((segment) => this.chapterFilter(segment));
|
const filteredSegments = segments?.filter((segment) => this.chapterFilter(segment));
|
||||||
const chaptersToRender = this.createChapterRenderGroups(filteredSegments).filter((segment) => this.chapterGroupFilter(segment));
|
if (filteredSegments) {
|
||||||
|
let groups = this.unfilteredChapterGroups;
|
||||||
|
if (filteredSegments.length !== segments.length) {
|
||||||
|
groups = this.createChapterRenderGroups(filteredSegments);
|
||||||
|
}
|
||||||
|
this.chapterGroups = groups.filter((segment) => this.chapterGroupFilter(segment));
|
||||||
|
|
||||||
if (chaptersToRender?.length <= 0) {
|
if (groups.length !== this.chapterGroups.length) {
|
||||||
if (this.customChaptersBar) this.customChaptersBar.style.display = "none";
|
// Fix missing sections due to filtered segments
|
||||||
this.originalChapterBar.style.removeProperty("display");
|
for (let i = 1; i < this.chapterGroups.length; i++) {
|
||||||
return;
|
if (this.chapterGroups[i].segment[0] !== this.chapterGroups[i - 1].segment[1]) {
|
||||||
|
this.chapterGroups[i - 1].segment[1] = this.chapterGroups[i].segment[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.chapterGroups = this.unfilteredChapterGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create it from cloning
|
// Create it from cloning
|
||||||
@@ -324,24 +360,26 @@ class PreviewBar {
|
|||||||
const originalSection = originalSections[0];
|
const originalSection = originalSections[0];
|
||||||
|
|
||||||
// For switching to a video with less chapters
|
// For switching to a video with less chapters
|
||||||
if (originalSections.length > chaptersToRender.length) {
|
if (originalSections.length > this.chapterGroups.length) {
|
||||||
for (let i = originalSections.length - 1; i >= chaptersToRender.length; i--) {
|
for (let i = originalSections.length - 1; i >= this.chapterGroups.length; i--) {
|
||||||
this.customChaptersBar.removeChild(originalSections[i]);
|
this.customChaptersBar.removeChild(originalSections[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Modify it to have sections for each segment
|
// Modify it to have sections for each segment
|
||||||
for (let i = 0; i < chaptersToRender.length; i++) {
|
for (let i = 0; i < this.chapterGroups.length; i++) {
|
||||||
const chapter = chaptersToRender[i].segment;
|
const chapter = this.chapterGroups[i].segment;
|
||||||
let newSection = originalSections[i] as HTMLElement;
|
let newSection = originalSections[i] as HTMLElement;
|
||||||
if (!newSection) {
|
if (!newSection) {
|
||||||
newSection = originalSection.cloneNode(true) as HTMLElement;
|
newSection = originalSection.cloneNode(true) as HTMLElement;
|
||||||
|
|
||||||
this.firstTimeSetupChapterSection(newSection);
|
this.firstTimeSetupChapterSection(newSection);
|
||||||
this.customChaptersBar.appendChild(newSection);
|
this.customChaptersBar.appendChild(newSection);
|
||||||
|
} else if (createFromScratch) {
|
||||||
|
this.firstTimeSetupChapterSection(newSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setupChapterSection(newSection, chapter[0], chapter[1], i !== chaptersToRender.length - 1);
|
this.setupChapterSection(newSection, chapter[0], chapter[1], i !== this.chapterGroups.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide old bar
|
// Hide old bar
|
||||||
@@ -383,15 +421,19 @@ class PreviewBar {
|
|||||||
latestValidChapter = result[result.length - 1];
|
latestValidChapter = result[result.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const priorityActionType = this.getActionTypePrioritized([segment.actionType, latestChapter?.actionType]);
|
||||||
|
|
||||||
// Split the latest chapter if smaller
|
// Split the latest chapter if smaller
|
||||||
result.push({
|
result.push({
|
||||||
segment: [segment.segment[0], segment.segment[1]],
|
segment: [segment.segment[0], segment.segment[1]],
|
||||||
originalDuration: segmentDuration,
|
originalDuration: segmentDuration,
|
||||||
|
actionType: priorityActionType
|
||||||
});
|
});
|
||||||
if (latestValidChapter?.segment[1] > segment.segment[1]) {
|
if (latestValidChapter?.segment[1] > segment.segment[1]) {
|
||||||
result.push({
|
result.push({
|
||||||
segment: [segment.segment[1], latestValidChapter.segment[1]],
|
segment: [segment.segment[1], latestValidChapter.segment[1]],
|
||||||
originalDuration: latestValidChapter.originalDuration
|
originalDuration: latestValidChapter.originalDuration,
|
||||||
|
actionType: latestValidChapter.actionType
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,7 +452,8 @@ class PreviewBar {
|
|||||||
// Start at end of old one otherwise
|
// Start at end of old one otherwise
|
||||||
result.push({
|
result.push({
|
||||||
segment: [latestChapter.segment[1], segment.segment[1]],
|
segment: [latestChapter.segment[1], segment.segment[1]],
|
||||||
originalDuration: segmentDuration
|
originalDuration: segmentDuration,
|
||||||
|
actionType: segment.actionType
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -419,7 +462,8 @@ class PreviewBar {
|
|||||||
if (segment.segment[0] > lastTime) {
|
if (segment.segment[0] > lastTime) {
|
||||||
result.push({
|
result.push({
|
||||||
segment: [lastTime, segment.segment[0]],
|
segment: [lastTime, segment.segment[0]],
|
||||||
originalDuration: 0
|
originalDuration: 0,
|
||||||
|
actionType: null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,7 +471,8 @@ class PreviewBar {
|
|||||||
const endTime = Math.min(segment.segment[1], this.videoDuration);
|
const endTime = Math.min(segment.segment[1], this.videoDuration);
|
||||||
result.push({
|
result.push({
|
||||||
segment: [segment.segment[0], endTime],
|
segment: [segment.segment[0], endTime],
|
||||||
originalDuration: endTime - segment.segment[0]
|
originalDuration: endTime - segment.segment[0],
|
||||||
|
actionType: segment.actionType
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +484,8 @@ class PreviewBar {
|
|||||||
if (this.intervalToDecimal(lastTime, nextTime) > MIN_CHAPTER_SIZE) {
|
if (this.intervalToDecimal(lastTime, nextTime) > MIN_CHAPTER_SIZE) {
|
||||||
result.push({
|
result.push({
|
||||||
segment: [lastTime, nextTime],
|
segment: [lastTime, nextTime],
|
||||||
originalDuration: 0
|
originalDuration: 0,
|
||||||
|
actionType: null
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -448,11 +494,21 @@ class PreviewBar {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getActionTypePrioritized(actionTypes: ActionType[]): ActionType {
|
||||||
|
if (actionTypes.includes(ActionType.Skip)) {
|
||||||
|
return ActionType.Skip;
|
||||||
|
} else if (actionTypes.includes(ActionType.Mute)) {
|
||||||
|
return ActionType.Mute;
|
||||||
|
} else {
|
||||||
|
return actionTypes.find(a => a) ?? actionTypes[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private setupChapterSection(section: HTMLElement, startTime: number, endTime: number, addMargin: boolean): void {
|
private setupChapterSection(section: HTMLElement, startTime: number, endTime: number, addMargin: boolean): void {
|
||||||
const sizePercent = this.intervalToPercentage(startTime, endTime);
|
const sizePercent = this.intervalToPercentage(startTime, endTime);
|
||||||
if (addMargin) {
|
if (addMargin) {
|
||||||
section.style.marginRight = "2px";
|
section.style.marginRight = `${this.chapterMargin}px`;
|
||||||
section.style.width = `calc(${sizePercent} - 2px)`;
|
section.style.width = `calc(${sizePercent} - ${this.chapterMargin}px)`;
|
||||||
} else {
|
} else {
|
||||||
section.style.marginRight = "0";
|
section.style.marginRight = "0";
|
||||||
section.style.width = sizePercent;
|
section.style.width = sizePercent;
|
||||||
@@ -529,7 +585,7 @@ class PreviewBar {
|
|||||||
const section = sections[i];
|
const section = sections[i];
|
||||||
|
|
||||||
const sectionWidthDecimal = parseFloat(section.getAttribute("decimal-width"));
|
const sectionWidthDecimal = parseFloat(section.getAttribute("decimal-width"));
|
||||||
const sectionWidthDecimalNoMargin = sectionWidthDecimal - 2 / progressBar.clientWidth;
|
const sectionWidthDecimalNoMargin = sectionWidthDecimal - this.chapterMargin / progressBar.clientWidth;
|
||||||
|
|
||||||
for (const className in changes) {
|
for (const className in changes) {
|
||||||
const selector = `.${className}`
|
const selector = `.${className}`
|
||||||
@@ -572,6 +628,7 @@ class PreviewBar {
|
|||||||
{ left: number, scale: number } {
|
{ left: number, scale: number } {
|
||||||
const sections = currentElement.parentElement.parentElement.parentElement.children;
|
const sections = currentElement.parentElement.parentElement.parentElement.children;
|
||||||
let currentWidth = 0;
|
let currentWidth = 0;
|
||||||
|
let lastWidth = 0;
|
||||||
|
|
||||||
let left = 0;
|
let left = 0;
|
||||||
let leftPosition = 0;
|
let leftPosition = 0;
|
||||||
@@ -579,6 +636,7 @@ class PreviewBar {
|
|||||||
let scale = null;
|
let scale = null;
|
||||||
let scalePosition = 0;
|
let scalePosition = 0;
|
||||||
let scaleWidth = 0;
|
let scaleWidth = 0;
|
||||||
|
let lastScalePosition = 0;
|
||||||
|
|
||||||
for (let i = 0; i < sections.length; i++) {
|
for (let i = 0; i < sections.length; i++) {
|
||||||
const section = sections[i] as HTMLElement;
|
const section = sections[i] as HTMLElement;
|
||||||
@@ -598,24 +656,33 @@ class PreviewBar {
|
|||||||
const transformMatch = checkElement.style.transform.match(/scaleX\(([0-9.]+?)\)/);
|
const transformMatch = checkElement.style.transform.match(/scaleX\(([0-9.]+?)\)/);
|
||||||
if (transformMatch) {
|
if (transformMatch) {
|
||||||
const transformScale = parseFloat(transformMatch[1]);
|
const transformScale = parseFloat(transformMatch[1]);
|
||||||
if (i === sections.length - 1 || (transformScale < 1 && transformScale + checkLeft / currentSectionWidthNoMargin < 0.99999)) {
|
const endPosition = transformScale + checkLeft / currentSectionWidthNoMargin;
|
||||||
scale = transformScale;
|
|
||||||
scaleWidth = currentSectionWidthNoMargin;
|
|
||||||
|
|
||||||
if (transformScale > 0) {
|
if (lastScalePosition > 0.99999 && endPosition === 0) {
|
||||||
// reached the end of this section for sure, since the scale is now between 0 and 1
|
// Last one was an end section that was fully filled
|
||||||
// if the scale is always zero, then it will go through all sections but still return 0
|
scalePosition = currentWidth - lastWidth;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
scalePosition = currentWidth;
|
lastScalePosition = endPosition;
|
||||||
if (checkLeft !== 0) {
|
|
||||||
scalePosition += left;
|
scale = transformScale;
|
||||||
}
|
scaleWidth = currentSectionWidthNoMargin;
|
||||||
break;
|
|
||||||
|
if ((i === sections.length - 1 || endPosition < 0.99999) && endPosition > 0) {
|
||||||
|
// reached the end of this section for sure
|
||||||
|
// if the scale is always zero, then it will go through all sections but still return 0
|
||||||
|
|
||||||
|
scalePosition = currentWidth;
|
||||||
|
if (checkLeft !== 0) {
|
||||||
|
scalePosition += left;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentWidth += currentSectionWidth;
|
lastWidth = currentSectionWidth;
|
||||||
|
currentWidth += lastWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -653,8 +720,6 @@ class PreviewBar {
|
|||||||
const chaptersContainer = document.querySelector(".ytp-chapter-container") as HTMLDivElement;
|
const chaptersContainer = document.querySelector(".ytp-chapter-container") as HTMLDivElement;
|
||||||
|
|
||||||
if (chaptersContainer) {
|
if (chaptersContainer) {
|
||||||
// TODO: Check if existing chapters exist (if big chapters menu is available?)
|
|
||||||
|
|
||||||
if (segments.length > 0) {
|
if (segments.length > 0) {
|
||||||
chaptersContainer.style.removeProperty("display");
|
chaptersContainer.style.removeProperty("display");
|
||||||
|
|
||||||
@@ -692,7 +757,6 @@ class PreviewBar {
|
|||||||
this.chapterVote.setVisibility(false);
|
this.chapterVote.setVisibility(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Hide chapters menu again
|
|
||||||
chaptersContainer.style.display = "none";
|
chaptersContainer.style.display = "none";
|
||||||
this.chapterVote.setVisibility(false);
|
this.chapterVote.setVisibility(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,12 +11,14 @@ describe("createChapterRenderGroups", () => {
|
|||||||
const groups = previewBar.createChapterRenderGroups([{
|
const groups = previewBar.createChapterRenderGroups([{
|
||||||
segment: [2, 30],
|
segment: [2, 30],
|
||||||
category: "sponsor",
|
category: "sponsor",
|
||||||
|
actionType: "skip",
|
||||||
unsubmitted: false,
|
unsubmitted: false,
|
||||||
showLarger: false,
|
showLarger: false,
|
||||||
description: ""
|
description: ""
|
||||||
}, {
|
}, {
|
||||||
segment: [50, 80],
|
segment: [50, 80],
|
||||||
category: "sponsor",
|
category: "sponsor",
|
||||||
|
actionType: "skip",
|
||||||
unsubmitted: false,
|
unsubmitted: false,
|
||||||
showLarger: false,
|
showLarger: false,
|
||||||
description: ""
|
description: ""
|
||||||
@@ -24,19 +26,24 @@ describe("createChapterRenderGroups", () => {
|
|||||||
|
|
||||||
expect(groups).toStrictEqual([{
|
expect(groups).toStrictEqual([{
|
||||||
segment: [0, 2],
|
segment: [0, 2],
|
||||||
originalDuration: 0
|
originalDuration: 0,
|
||||||
|
actionType: null
|
||||||
}, {
|
}, {
|
||||||
segment: [2, 30],
|
segment: [2, 30],
|
||||||
originalDuration: 30 - 2
|
originalDuration: 30 - 2,
|
||||||
|
actionType: "skip"
|
||||||
}, {
|
}, {
|
||||||
segment: [30, 50],
|
segment: [30, 50],
|
||||||
originalDuration: 0
|
originalDuration: 0,
|
||||||
|
actionType: null
|
||||||
}, {
|
}, {
|
||||||
segment: [50, 80],
|
segment: [50, 80],
|
||||||
originalDuration: 80 - 50
|
originalDuration: 80 - 50,
|
||||||
|
actionType: "skip"
|
||||||
}, {
|
}, {
|
||||||
segment: [80, 315],
|
segment: [80, 315],
|
||||||
originalDuration: 0
|
originalDuration: 0,
|
||||||
|
actionType: null
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -45,12 +52,14 @@ describe("createChapterRenderGroups", () => {
|
|||||||
const groups = previewBar.createChapterRenderGroups([{
|
const groups = previewBar.createChapterRenderGroups([{
|
||||||
segment: [2.52, 30],
|
segment: [2.52, 30],
|
||||||
category: "sponsor",
|
category: "sponsor",
|
||||||
|
actionType: "skip",
|
||||||
unsubmitted: false,
|
unsubmitted: false,
|
||||||
showLarger: false,
|
showLarger: false,
|
||||||
description: ""
|
description: ""
|
||||||
}, {
|
}, {
|
||||||
segment: [20, 25],
|
segment: [20, 25],
|
||||||
category: "sponsor",
|
category: "sponsor",
|
||||||
|
actionType: "skip",
|
||||||
unsubmitted: false,
|
unsubmitted: false,
|
||||||
showLarger: false,
|
showLarger: false,
|
||||||
description: ""
|
description: ""
|
||||||
@@ -58,19 +67,24 @@ describe("createChapterRenderGroups", () => {
|
|||||||
|
|
||||||
expect(groups).toStrictEqual([{
|
expect(groups).toStrictEqual([{
|
||||||
segment: [0, 2.52],
|
segment: [0, 2.52],
|
||||||
originalDuration: 0
|
originalDuration: 0,
|
||||||
|
actionType: null
|
||||||
}, {
|
}, {
|
||||||
segment: [2.52, 20],
|
segment: [2.52, 20],
|
||||||
originalDuration: 30 - 2.52
|
originalDuration: 30 - 2.52,
|
||||||
|
actionType: "skip"
|
||||||
}, {
|
}, {
|
||||||
segment: [20, 25],
|
segment: [20, 25],
|
||||||
originalDuration: 25 - 20
|
originalDuration: 25 - 20,
|
||||||
|
actionType: "skip"
|
||||||
}, {
|
}, {
|
||||||
segment: [25, 30],
|
segment: [25, 30],
|
||||||
originalDuration: 30 - 2.52
|
originalDuration: 30 - 2.52,
|
||||||
|
actionType: "skip"
|
||||||
}, {
|
}, {
|
||||||
segment: [30, 315],
|
segment: [30, 315],
|
||||||
originalDuration: 0
|
originalDuration: 0,
|
||||||
|
actionType: null
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -79,12 +93,14 @@ describe("createChapterRenderGroups", () => {
|
|||||||
const groups = previewBar.createChapterRenderGroups([{
|
const groups = previewBar.createChapterRenderGroups([{
|
||||||
segment: [2.52, 30],
|
segment: [2.52, 30],
|
||||||
category: "sponsor",
|
category: "sponsor",
|
||||||
|
actionType: "skip",
|
||||||
unsubmitted: false,
|
unsubmitted: false,
|
||||||
showLarger: false,
|
showLarger: false,
|
||||||
description: ""
|
description: ""
|
||||||
}, {
|
}, {
|
||||||
segment: [2.52, 40],
|
segment: [2.52, 40],
|
||||||
category: "sponsor",
|
category: "sponsor",
|
||||||
|
actionType: "skip",
|
||||||
unsubmitted: false,
|
unsubmitted: false,
|
||||||
showLarger: false,
|
showLarger: false,
|
||||||
description: ""
|
description: ""
|
||||||
@@ -92,16 +108,20 @@ describe("createChapterRenderGroups", () => {
|
|||||||
|
|
||||||
expect(groups).toStrictEqual([{
|
expect(groups).toStrictEqual([{
|
||||||
segment: [0, 2.52],
|
segment: [0, 2.52],
|
||||||
originalDuration: 0
|
originalDuration: 0,
|
||||||
|
actionType: null
|
||||||
}, {
|
}, {
|
||||||
segment: [2.52, 30],
|
segment: [2.52, 30],
|
||||||
originalDuration: 30 - 2.52
|
originalDuration: 30 - 2.52,
|
||||||
|
actionType: "skip"
|
||||||
}, {
|
}, {
|
||||||
segment: [30, 40],
|
segment: [30, 40],
|
||||||
originalDuration: 40 - 2.52
|
originalDuration: 40 - 2.52,
|
||||||
|
actionType: "skip"
|
||||||
}, {
|
}, {
|
||||||
segment: [40, 315],
|
segment: [40, 315],
|
||||||
originalDuration: 0
|
originalDuration: 0,
|
||||||
|
actionType: null
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -110,6 +130,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
const groups = previewBar.createChapterRenderGroups([
|
const groups = previewBar.createChapterRenderGroups([
|
||||||
{
|
{
|
||||||
"category": "chapter",
|
"category": "chapter",
|
||||||
|
"actionType": "chapter",
|
||||||
"segment": [
|
"segment": [
|
||||||
0,
|
0,
|
||||||
49.977
|
49.977
|
||||||
@@ -122,6 +143,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
2.926,
|
2.926,
|
||||||
5
|
5
|
||||||
@@ -134,6 +156,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "chapter",
|
"category": "chapter",
|
||||||
|
"actionType": "chapter",
|
||||||
"segment": [
|
"segment": [
|
||||||
14.487,
|
14.487,
|
||||||
37.133
|
37.133
|
||||||
@@ -146,6 +169,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
23.450537,
|
23.450537,
|
||||||
34.486084
|
34.486084
|
||||||
@@ -158,6 +182,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "interaction",
|
"category": "interaction",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
50.015343,
|
50.015343,
|
||||||
56.775314
|
56.775314
|
||||||
@@ -170,6 +195,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
62.51888,
|
62.51888,
|
||||||
74.33331
|
74.33331
|
||||||
@@ -182,6 +208,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
88.71328,
|
88.71328,
|
||||||
96.05933
|
96.05933
|
||||||
@@ -194,6 +221,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
101.50703,
|
101.50703,
|
||||||
115.088326
|
115.088326
|
||||||
@@ -205,6 +233,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
122.211845,
|
122.211845,
|
||||||
137.42178
|
137.42178
|
||||||
@@ -217,6 +246,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
144.08913,
|
144.08913,
|
||||||
160.14084
|
160.14084
|
||||||
@@ -229,6 +259,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
164.22084,
|
164.22084,
|
||||||
170.98082
|
170.98082
|
||||||
@@ -241,6 +272,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
180.56674,
|
180.56674,
|
||||||
189.16516
|
189.16516
|
||||||
@@ -253,6 +285,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
204.10468,
|
204.10468,
|
||||||
211.87865
|
211.87865
|
||||||
@@ -265,6 +298,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
214.92064,
|
214.92064,
|
||||||
222.0186
|
222.0186
|
||||||
@@ -277,6 +311,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
233.0754,
|
233.0754,
|
||||||
244.56734
|
244.56734
|
||||||
@@ -289,6 +324,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
260.64053,
|
260.64053,
|
||||||
269.35938
|
269.35938
|
||||||
@@ -301,6 +337,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
288.686,
|
288.686,
|
||||||
301.96
|
301.96
|
||||||
@@ -313,6 +350,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"segment": [
|
"segment": [
|
||||||
288.686,
|
288.686,
|
||||||
295
|
295
|
||||||
@@ -330,245 +368,280 @@ describe("createChapterRenderGroups", () => {
|
|||||||
0,
|
0,
|
||||||
2.926
|
2.926
|
||||||
],
|
],
|
||||||
"originalDuration": 49.977
|
"originalDuration": 49.977,
|
||||||
|
"actionType": "chapter"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
2.926,
|
2.926,
|
||||||
5
|
5
|
||||||
],
|
],
|
||||||
"originalDuration": 2.074
|
"originalDuration": 2.074,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
5,
|
5,
|
||||||
14.487
|
14.487
|
||||||
],
|
],
|
||||||
"originalDuration": 49.977
|
"originalDuration": 49.977,
|
||||||
|
"actionType": "chapter"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
14.487,
|
14.487,
|
||||||
23.450537
|
23.450537
|
||||||
],
|
],
|
||||||
"originalDuration": 22.646
|
"originalDuration": 22.646,
|
||||||
|
"actionType": "chapter"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
23.450537,
|
23.450537,
|
||||||
34.486084
|
34.486084
|
||||||
],
|
],
|
||||||
"originalDuration": 11.035546999999998
|
"originalDuration": 11.035546999999998,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
34.486084,
|
34.486084,
|
||||||
37.133
|
37.133
|
||||||
],
|
],
|
||||||
"originalDuration": 22.646
|
"originalDuration": 22.646,
|
||||||
|
"actionType": "chapter"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
37.133,
|
37.133,
|
||||||
49.977
|
49.977
|
||||||
],
|
],
|
||||||
"originalDuration": 49.977
|
"originalDuration": 49.977,
|
||||||
|
"actionType": "chapter"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
49.977,
|
49.977,
|
||||||
50.015343
|
50.015343
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
50.015343,
|
50.015343,
|
||||||
56.775314
|
56.775314
|
||||||
],
|
],
|
||||||
"originalDuration": 6.759971
|
"originalDuration": 6.759971,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
56.775314,
|
56.775314,
|
||||||
62.51888
|
62.51888
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
62.51888,
|
62.51888,
|
||||||
74.33331
|
74.33331
|
||||||
],
|
],
|
||||||
"originalDuration": 11.814429999999994
|
"originalDuration": 11.814429999999994,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
74.33331,
|
74.33331,
|
||||||
88.71328
|
88.71328
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
88.71328,
|
88.71328,
|
||||||
96.05933
|
96.05933
|
||||||
],
|
],
|
||||||
"originalDuration": 7.346050000000005
|
"originalDuration": 7.346050000000005,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
96.05933,
|
96.05933,
|
||||||
101.50703
|
101.50703
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
101.50703,
|
101.50703,
|
||||||
115.088326
|
115.088326
|
||||||
],
|
],
|
||||||
"originalDuration": 13.581295999999995
|
"originalDuration": 13.581295999999995,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
115.088326,
|
115.088326,
|
||||||
122.211845
|
122.211845
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
122.211845,
|
122.211845,
|
||||||
137.42178
|
137.42178
|
||||||
],
|
],
|
||||||
"originalDuration": 15.209935000000016
|
"originalDuration": 15.209935000000016,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
137.42178,
|
137.42178,
|
||||||
144.08913
|
144.08913
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
144.08913,
|
144.08913,
|
||||||
160.14084
|
160.14084
|
||||||
],
|
],
|
||||||
"originalDuration": 16.051709999999986
|
"originalDuration": 16.051709999999986,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
160.14084,
|
160.14084,
|
||||||
164.22084
|
164.22084
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
164.22084,
|
164.22084,
|
||||||
170.98082
|
170.98082
|
||||||
],
|
],
|
||||||
"originalDuration": 6.759979999999985
|
"originalDuration": 6.759979999999985,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
170.98082,
|
170.98082,
|
||||||
180.56674
|
180.56674
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
180.56674,
|
180.56674,
|
||||||
189.16516
|
189.16516
|
||||||
],
|
],
|
||||||
"originalDuration": 8.598419999999976
|
"originalDuration": 8.598419999999976,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
189.16516,
|
189.16516,
|
||||||
204.10468
|
204.10468
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
204.10468,
|
204.10468,
|
||||||
211.87865
|
211.87865
|
||||||
],
|
],
|
||||||
"originalDuration": 7.773969999999991
|
"originalDuration": 7.773969999999991,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
211.87865,
|
211.87865,
|
||||||
214.92064
|
214.92064
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
214.92064,
|
214.92064,
|
||||||
222.0186
|
222.0186
|
||||||
],
|
],
|
||||||
"originalDuration": 7.0979600000000005
|
"originalDuration": 7.0979600000000005,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
222.0186,
|
222.0186,
|
||||||
233.0754
|
233.0754
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
233.0754,
|
233.0754,
|
||||||
244.56734
|
244.56734
|
||||||
],
|
],
|
||||||
"originalDuration": 11.49194
|
"originalDuration": 11.49194,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
244.56734,
|
244.56734,
|
||||||
260.64053
|
260.64053
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
260.64053,
|
260.64053,
|
||||||
269.35938
|
269.35938
|
||||||
],
|
],
|
||||||
"originalDuration": 8.718849999999975
|
"originalDuration": 8.718849999999975,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
269.35938,
|
269.35938,
|
||||||
288.686
|
288.686
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
288.686,
|
288.686,
|
||||||
295
|
295
|
||||||
],
|
],
|
||||||
"originalDuration": 6.314000000000021
|
"originalDuration": 6.314000000000021,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
295,
|
295,
|
||||||
301.96
|
301.96
|
||||||
],
|
],
|
||||||
"originalDuration": 13.274000000000001
|
"originalDuration": 13.274000000000001,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
301.96,
|
301.96,
|
||||||
315.061
|
315.061
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
})
|
})
|
||||||
@@ -581,6 +654,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
2797.323
|
2797.323
|
||||||
],
|
],
|
||||||
"category": "chooseACategory",
|
"category": "chooseACategory",
|
||||||
|
"actionType": "skip",
|
||||||
"unsubmitted": true,
|
"unsubmitted": true,
|
||||||
"showLarger": false,
|
"showLarger": false,
|
||||||
},{
|
},{
|
||||||
@@ -589,6 +663,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
3432.255
|
3432.255
|
||||||
],
|
],
|
||||||
"category": "chooseACategory",
|
"category": "chooseACategory",
|
||||||
|
"actionType": "skip",
|
||||||
"unsubmitted": true,
|
"unsubmitted": true,
|
||||||
"showLarger": false,
|
"showLarger": false,
|
||||||
},{
|
},{
|
||||||
@@ -597,6 +672,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
3412.413
|
3412.413
|
||||||
],
|
],
|
||||||
"category": "chooseACategory",
|
"category": "chooseACategory",
|
||||||
|
"actionType": "skip",
|
||||||
"unsubmitted": true,
|
"unsubmitted": true,
|
||||||
"showLarger": false,
|
"showLarger": false,
|
||||||
},{
|
},{
|
||||||
@@ -605,6 +681,7 @@ describe("createChapterRenderGroups", () => {
|
|||||||
1674.286
|
1674.286
|
||||||
],
|
],
|
||||||
"category": "sponsor",
|
"category": "sponsor",
|
||||||
|
"actionType": "skip",
|
||||||
"unsubmitted": false,
|
"unsubmitted": false,
|
||||||
"showLarger": false,
|
"showLarger": false,
|
||||||
}
|
}
|
||||||
@@ -616,49 +693,56 @@ describe("createChapterRenderGroups", () => {
|
|||||||
0,
|
0,
|
||||||
160
|
160
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
160,
|
160,
|
||||||
169
|
169
|
||||||
],
|
],
|
||||||
"originalDuration": 2637.323
|
"originalDuration": 2637.323,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
169,
|
169,
|
||||||
1594.92
|
1594.92
|
||||||
],
|
],
|
||||||
"originalDuration": 3243.413
|
"originalDuration": 3243.413,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
1594.92,
|
1594.92,
|
||||||
1674.286
|
1674.286
|
||||||
],
|
],
|
||||||
"originalDuration": 79.36599999999999
|
"originalDuration": 79.36599999999999,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
1674.286,
|
1674.286,
|
||||||
3412.413
|
3412.413
|
||||||
],
|
],
|
||||||
"originalDuration": 3243.413
|
"originalDuration": 3243.413,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
3412.413,
|
3412.413,
|
||||||
3432.255
|
3432.255
|
||||||
],
|
],
|
||||||
"originalDuration": 3263.255
|
"originalDuration": 3263.255,
|
||||||
|
"actionType": "skip"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"segment": [
|
"segment": [
|
||||||
3432.255,
|
3432.255,
|
||||||
3615.161
|
3615.161
|
||||||
],
|
],
|
||||||
"originalDuration": 0
|
"originalDuration": 0,
|
||||||
|
"actionType": null
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user