mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 19:47:04 +03:00
Merge branch 'master' into rules-parser
This commit is contained in:
Submodule public/_locales updated: fcee4620b3...32c293e861
@@ -329,6 +329,17 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div data-type="selector" data-sync="segmentListDefaultTab">
|
||||||
|
<label class="optionLabel" for="segmentListDefaultTab">__MSG_segmentListDefaultTab__:</label>
|
||||||
|
|
||||||
|
<select id="segmentListDefaultTab" class="selector-element optionsSelector">
|
||||||
|
<option value="0">__MSG_SegmentsCap__</option>
|
||||||
|
<option value="1">__MSG_Chapters__</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div data-type="toggle" data-sync="darkMode">
|
<div data-type="toggle" data-sync="darkMode">
|
||||||
|
|||||||
@@ -591,6 +591,8 @@
|
|||||||
#sponsorTimesDonateContainer a {
|
#sponsorTimesDonateContainer a {
|
||||||
color: var(--sb-main-fg-color);
|
color: var(--sb-main-fg-color);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
|
||||||
|
padding-left: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
style.marginTop = "15px";
|
style.marginTop = "15px";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const borderColor = this.state.selectedCategory ? Config.config.barTypes[this.state.selectedCategory]?.color : null;
|
||||||
|
|
||||||
// Create time display
|
// Create time display
|
||||||
let timeDisplay: JSX.Element;
|
let timeDisplay: JSX.Element;
|
||||||
const timeDisplayStyle: React.CSSProperties = {};
|
const timeDisplayStyle: React.CSSProperties = {};
|
||||||
@@ -151,7 +153,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
<input id={"submittingTime0" + this.idSuffix}
|
<input id={"submittingTime0" + this.idSuffix}
|
||||||
className="sponsorTimeEdit sponsorTimeEditInput"
|
className="sponsorTimeEdit sponsorTimeEditInput"
|
||||||
type="text"
|
type="text"
|
||||||
style={{color: "inherit", backgroundColor: "inherit"}}
|
style={{color: "inherit", backgroundColor: "inherit", borderColor}}
|
||||||
value={this.state.sponsorTimeEdits[0] ?? ""}
|
value={this.state.sponsorTimeEdits[0] ?? ""}
|
||||||
onKeyDown={(e) => e.stopPropagation()}
|
onKeyDown={(e) => e.stopPropagation()}
|
||||||
onKeyUp={(e) => e.stopPropagation()}
|
onKeyUp={(e) => e.stopPropagation()}
|
||||||
@@ -168,7 +170,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
<input id={"submittingTime1" + this.idSuffix}
|
<input id={"submittingTime1" + this.idSuffix}
|
||||||
className="sponsorTimeEdit sponsorTimeEditInput"
|
className="sponsorTimeEdit sponsorTimeEditInput"
|
||||||
type="text"
|
type="text"
|
||||||
style={{color: "inherit", backgroundColor: "inherit"}}
|
style={{color: "inherit", backgroundColor: "inherit", borderColor}}
|
||||||
value={this.state.sponsorTimeEdits[1] ?? ""}
|
value={this.state.sponsorTimeEdits[1] ?? ""}
|
||||||
onKeyDown={(e) => e.stopPropagation()}
|
onKeyDown={(e) => e.stopPropagation()}
|
||||||
onKeyUp={(e) => e.stopPropagation()}
|
onKeyUp={(e) => e.stopPropagation()}
|
||||||
@@ -215,7 +217,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
<select id={"sponsorTimeCategories" + this.idSuffix}
|
<select id={"sponsorTimeCategories" + this.idSuffix}
|
||||||
className="sponsorTimeEditSelector sponsorTimeCategories"
|
className="sponsorTimeEditSelector sponsorTimeCategories"
|
||||||
ref={this.categoryOptionRef}
|
ref={this.categoryOptionRef}
|
||||||
style={{color: "inherit", backgroundColor: "inherit"}}
|
style={{color: "inherit", backgroundColor: "inherit", borderColor}}
|
||||||
value={this.state.selectedCategory}
|
value={this.state.selectedCategory}
|
||||||
onChange={(event) => this.categorySelectionChange(event)}>
|
onChange={(event) => this.categorySelectionChange(event)}>
|
||||||
{this.getCategoryOptions()}
|
{this.getCategoryOptions()}
|
||||||
@@ -240,7 +242,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
<select id={"sponsorTimeActionTypes" + this.idSuffix}
|
<select id={"sponsorTimeActionTypes" + this.idSuffix}
|
||||||
className="sponsorTimeEditSelector sponsorTimeActionTypes"
|
className="sponsorTimeEditSelector sponsorTimeActionTypes"
|
||||||
value={this.state.selectedActionType}
|
value={this.state.selectedActionType}
|
||||||
style={{color: "inherit", backgroundColor: "inherit"}}
|
style={{color: "inherit", backgroundColor: "inherit", borderColor}}
|
||||||
ref={this.actionTypeOptionRef}
|
ref={this.actionTypeOptionRef}
|
||||||
onChange={(e) => this.actionTypeSelectionChange(e)}>
|
onChange={(e) => this.actionTypeSelectionChange(e)}>
|
||||||
{this.getActionTypeOptions(sponsorTime)}
|
{this.getActionTypeOptions(sponsorTime)}
|
||||||
@@ -269,7 +271,7 @@ class SponsorTimeEditComponent extends React.Component<SponsorTimeEditProps, Spo
|
|||||||
<div onBlur={() => this.setState({chapterNameSelectorOpen: false})}>
|
<div onBlur={() => this.setState({chapterNameSelectorOpen: false})}>
|
||||||
<input id={"chapterName" + this.idSuffix}
|
<input id={"chapterName" + this.idSuffix}
|
||||||
className="sponsorTimeEdit sponsorTimeEditInput sponsorChapterNameInput"
|
className="sponsorTimeEdit sponsorTimeEditInput sponsorChapterNameInput"
|
||||||
style={{color: "inherit", backgroundColor: "inherit"}}
|
style={{color: "inherit", backgroundColor: "inherit", borderColor}}
|
||||||
ref={this.descriptionOptionRef}
|
ref={this.descriptionOptionRef}
|
||||||
type="text"
|
type="text"
|
||||||
value={this.state.description}
|
value={this.state.description}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as CompileConfig from "../config.json";
|
import * as CompileConfig from "../config.json";
|
||||||
import * as invidiousList from "../ci/invidiouslist.json";
|
import * as invidiousList from "../ci/invidiouslist.json";
|
||||||
import { Category, CategorySelection, CategorySkipOption, NoticeVisibilityMode, PreviewBarOption, SponsorHideType, SponsorTime, VideoID } from "./types";
|
import { Category, CategorySelection, CategorySkipOption, NoticeVisibilityMode, PreviewBarOption, SponsorHideType, SponsorTime, VideoID, SegmentListDefaultTab } from "./types";
|
||||||
import { Keybind, keybindEquals, ProtoConfig } from "../maze-utils/src/config";
|
import { Keybind, keybindEquals, ProtoConfig } from "../maze-utils/src/config";
|
||||||
import { HashedValue } from "../maze-utils/src/hash";
|
import { HashedValue } from "../maze-utils/src/hash";
|
||||||
import { AdvancedSkipCheck, AdvancedSkipPredicate, AdvancedSkipRule, Permission, PredicateOperator } from "./utils/skipRule";
|
import { AdvancedSkipCheck, AdvancedSkipPredicate, AdvancedSkipRule, Permission, PredicateOperator } from "./utils/skipRule";
|
||||||
@@ -10,6 +10,7 @@ interface SBConfig {
|
|||||||
isVip: boolean;
|
isVip: boolean;
|
||||||
permissions: Record<Category, Permission>;
|
permissions: Record<Category, Permission>;
|
||||||
defaultCategory: Category;
|
defaultCategory: Category;
|
||||||
|
segmentListDefaultTab: SegmentListDefaultTab;
|
||||||
renderSegmentsAsChapters: boolean;
|
renderSegmentsAsChapters: boolean;
|
||||||
forceChannelCheck: boolean;
|
forceChannelCheck: boolean;
|
||||||
minutesSaved: number;
|
minutesSaved: number;
|
||||||
@@ -374,6 +375,7 @@ const syncDefaults = {
|
|||||||
isVip: false,
|
isVip: false,
|
||||||
permissions: {},
|
permissions: {},
|
||||||
defaultCategory: "chooseACategory" as Category,
|
defaultCategory: "chooseACategory" as Category,
|
||||||
|
segmentListDefaultTab: SegmentListDefaultTab.Segments,
|
||||||
renderSegmentsAsChapters: false,
|
renderSegmentsAsChapters: false,
|
||||||
forceChannelCheck: false,
|
forceChannelCheck: false,
|
||||||
minutesSaved: 0,
|
minutesSaved: 0,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { ActionType, SegmentUUID, SponsorHideType, SponsorTime, VideoID } from "../types";
|
import { ActionType, SegmentListDefaultTab, SegmentUUID, SponsorHideType, SponsorTime, VideoID } from "../types";
|
||||||
import Config from "../config";
|
import Config from "../config";
|
||||||
import { waitFor } from "../../maze-utils/src";
|
import { waitFor } from "../../maze-utils/src";
|
||||||
import { shortCategoryName } from "../utils/categoryUtils";
|
import { shortCategoryName } from "../utils/categoryUtils";
|
||||||
@@ -61,12 +61,21 @@ export const SegmentListComponent = (props: SegmentListComponentProps) => {
|
|||||||
}, [props.segments]);
|
}, [props.segments]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (hasSegments){
|
const setTabBasedOnConfig = () => {
|
||||||
setTab(SegmentListTab.Segments);
|
const preferChapters = Config.config.segmentListDefaultTab === SegmentListDefaultTab.Chapters;
|
||||||
|
if (preferChapters) {
|
||||||
|
setTab(hasChapters ? SegmentListTab.Chapter : SegmentListTab.Segments);
|
||||||
|
} else {
|
||||||
|
setTab(hasSegments ? SegmentListTab.Segments : SegmentListTab.Chapter);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (Config.isReady()) {
|
||||||
|
setTabBasedOnConfig();
|
||||||
} else {
|
} else {
|
||||||
setTab(SegmentListTab.Chapter);
|
waitFor(() => Config.isReady()).then(setTabBasedOnConfig);
|
||||||
}
|
}
|
||||||
}, [props.videoID, hasSegments]);
|
}, [props.videoID, hasSegments, hasChapters]);
|
||||||
|
|
||||||
const segmentsWithNesting = React.useMemo(() => {
|
const segmentsWithNesting = React.useMemo(() => {
|
||||||
const result: SegmentWithNesting[] = [];
|
const result: SegmentWithNesting[] = [];
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ function TimeSavedMessage({ viewCount, minutesSaved }: { viewCount: number; minu
|
|||||||
|
|
||||||
function DonateMessage(props: { onClose: () => void }): JSX.Element {
|
function DonateMessage(props: { onClose: () => void }): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<div id="sponsorTimesDonateContainer" style={{ alignItems: "center", justifyContent: "center" }}>
|
<div id="sponsorTimesDonateContainer" style={{ alignItems: "center", justifyContent: "center", display: "flex" }}>
|
||||||
<img className="sbHeart" src="/icons/heart.svg" alt="Heart icon" />
|
<img className="sbHeart" src="/icons/heart.svg" alt="Heart icon" />
|
||||||
<a id="sbConsiderDonateLink" href="https://sponsor.ajay.app/donate" target="_blank" rel="noreferrer" onClick={() => {
|
<a id="sbConsiderDonateLink" href="https://sponsor.ajay.app/donate" target="_blank" rel="noreferrer" onClick={() => {
|
||||||
Config.config.donateClicked = Config.config.donateClicked + 1;
|
Config.config.donateClicked = Config.config.donateClicked + 1;
|
||||||
|
|||||||
@@ -227,4 +227,9 @@ export enum NoticeVisibilityMode {
|
|||||||
MiniForAll = 2,
|
MiniForAll = 2,
|
||||||
FadedForAutoSkip = 3,
|
FadedForAutoSkip = 3,
|
||||||
FadedForAll = 4
|
FadedForAll = 4
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum SegmentListDefaultTab {
|
||||||
|
Segments,
|
||||||
|
Chapters,
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user