Skip to content

Commit 1775835

Browse files
committed
Add hiding skip to highlight
Fix #1530
1 parent 2c5db67 commit 1775835

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/content.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ function messageListener(request: Message, sender: unknown, sendResponse: (respo
259259
utils.getSponsorTimeFromUUID(sponsorTimes, request.UUID).hidden = request.type;
260260
utils.addHiddenSegment(sponsorVideoID, request.UUID, request.type);
261261
updatePreviewBar();
262+
263+
if (skipButtonControlBar?.isEnabled()
264+
&& sponsorTimesSubmitting.every((s) => s.hidden !== SponsorHideType.Visible || s.actionType !== ActionType.Poi)) {
265+
skipButtonControlBar.disable();
266+
}
262267
break;
263268
case "closePopup":
264269
closeInfoMenu();
@@ -1229,7 +1234,8 @@ function startSkipScheduleCheckingForStartSponsors() {
12291234

12301235
// For highlight category
12311236
const poiSegments = sponsorTimes
1232-
.filter((time) => time.segment[1] > video.currentTime && time.actionType === ActionType.Poi)
1237+
.filter((time) => time.segment[1] > video.currentTime
1238+
&& time.actionType === ActionType.Poi && time.hidden === SponsorHideType.Visible)
12331239
.sort((a, b) => b.segment[0] - a.segment[0]);
12341240
for (const time of poiSegments) {
12351241
const skipOption = utils.getCategorySelection(time.category)?.option;

src/js-components/skipButtonControlBar.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ export class SkipButtonControlBar {
142142
this.enabled = false;
143143
}
144144

145+
isEnabled(): boolean {
146+
return this.enabled;
147+
}
148+
145149
toggleSkip(): void {
146150
this.skip(this.segment);
147151
this.disableText();

src/popup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
698698
voteButtonsContainer.appendChild(downvoteButton);
699699
voteButtonsContainer.appendChild(uuidButton);
700700
if (downloadedTimes[i].actionType === ActionType.Skip || downloadedTimes[i].actionType === ActionType.Mute
701+
|| downloadedTimes[i].actionType === ActionType.Poi
701702
&& [SponsorHideType.Visible, SponsorHideType.Hidden].includes(downloadedTimes[i].hidden)) {
702703
voteButtonsContainer.appendChild(hideButton);
703704
}

0 commit comments

Comments
 (0)