mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 12:07:11 +03:00
Merge pull request #895 from ajayyy/improvements
Highlight category improvements
This commit is contained in:
@@ -224,6 +224,24 @@
|
|||||||
"showNotice": {
|
"showNotice": {
|
||||||
"message": "Show Notice Again"
|
"message": "Show Notice Again"
|
||||||
},
|
},
|
||||||
|
"showSkipNotice": {
|
||||||
|
"message": "Show Notice After A Segment Is Skipped"
|
||||||
|
},
|
||||||
|
"noticeVisibilityMode0": {
|
||||||
|
"message": "Full Size Skip Notices"
|
||||||
|
},
|
||||||
|
"noticeVisibilityMode1": {
|
||||||
|
"message": "Small Skip Notices for Auto Skip"
|
||||||
|
},
|
||||||
|
"noticeVisibilityMode2": {
|
||||||
|
"message": "All Small Skip Notices"
|
||||||
|
},
|
||||||
|
"noticeVisibilityMode3": {
|
||||||
|
"message": "Faded Skip Notices for Auto Skip"
|
||||||
|
},
|
||||||
|
"noticeVisibilityMode4": {
|
||||||
|
"message": "All Faded Skip Notices"
|
||||||
|
},
|
||||||
"longDescription": {
|
"longDescription": {
|
||||||
"message": "SponsorBlock lets you skip over sponsors, intros, outros, subscription reminders, and other annoying parts of YouTube videos. SponsorBlock is a crowdsourced browser extension that let's anyone submit the start and end time's of sponsored segments and other segments of YouTube videos. Once one person submits this information, everyone else with this extension will skip right over the sponsored segment. You can also skip over non music sections of music videos.",
|
"message": "SponsorBlock lets you skip over sponsors, intros, outros, subscription reminders, and other annoying parts of YouTube videos. SponsorBlock is a crowdsourced browser extension that let's anyone submit the start and end time's of sponsored segments and other segments of YouTube videos. Once one person submits this information, everyone else with this extension will skip right over the sponsored segment. You can also skip over non music sections of music videos.",
|
||||||
"description": "Full description of the extension on the store pages."
|
"description": "Full description of the extension on the store pages."
|
||||||
@@ -356,9 +374,6 @@
|
|||||||
"createdBy": {
|
"createdBy": {
|
||||||
"message": "Created By"
|
"message": "Created By"
|
||||||
},
|
},
|
||||||
"showSkipNotice": {
|
|
||||||
"message": "Show Notice After A Segment Is Skipped"
|
|
||||||
},
|
|
||||||
"keybindCurrentlySet": {
|
"keybindCurrentlySet": {
|
||||||
"message": ". It is currently set to:"
|
"message": ". It is currently set to:"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ svg {
|
|||||||
padding-bottom: 15px;
|
padding-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.categoryOptionsSelector {
|
.optionsSelector {
|
||||||
background-color: #c00000;
|
background-color: #c00000;
|
||||||
color: white;
|
color: white;
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,18 @@
|
|||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<div option-type="selector" sync-option="noticeVisibilityMode">
|
||||||
|
<select class="selector-element optionsSelector" >
|
||||||
|
<option value="0">__MSG_noticeVisibilityMode0__</option>
|
||||||
|
<option value="1">__MSG_noticeVisibilityMode1__</option>
|
||||||
|
<option value="2">__MSG_noticeVisibilityMode2__</option>
|
||||||
|
<option value="3">__MSG_noticeVisibilityMode3__</option>
|
||||||
|
<option value="4">__MSG_noticeVisibilityMode4__</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import * as React from "react";
|
|||||||
import Config from "../config"
|
import Config from "../config"
|
||||||
import { Category, CategorySkipOption } from "../types";
|
import { Category, CategorySkipOption } from "../types";
|
||||||
|
|
||||||
import Utils from "../utils";
|
|
||||||
import { getCategoryActionType } from "../utils/categoryUtils";
|
import { getCategoryActionType } from "../utils/categoryUtils";
|
||||||
const utils = new Utils();
|
|
||||||
|
|
||||||
export interface CategorySkipOptionsProps {
|
export interface CategorySkipOptionsProps {
|
||||||
category: Category;
|
category: Category;
|
||||||
@@ -63,7 +61,7 @@ class CategorySkipOptionsComponent extends React.Component<CategorySkipOptionsPr
|
|||||||
<td id={this.props.category + "SkipOption"}
|
<td id={this.props.category + "SkipOption"}
|
||||||
className="skipOption">
|
className="skipOption">
|
||||||
<select
|
<select
|
||||||
className="categoryOptionsSelector"
|
className="optionsSelector"
|
||||||
defaultValue={defaultOption}
|
defaultValue={defaultOption}
|
||||||
onChange={this.skipOptionSelected.bind(this)}>
|
onChange={this.skipOptionSelected.bind(this)}>
|
||||||
{this.getCategorySkipOptions()}
|
{this.getCategorySkipOptions()}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import * as CompileConfig from "../../config.json";
|
import * as CompileConfig from "../../config.json";
|
||||||
import Config from "../config"
|
import Config from "../config"
|
||||||
import { Category, ContentContainer, CategoryActionType, SponsorHideType, SponsorTime } from "../types";
|
import { Category, ContentContainer, CategoryActionType, SponsorHideType, SponsorTime, NoticeVisbilityMode } from "../types";
|
||||||
import NoticeComponent from "./NoticeComponent";
|
import NoticeComponent from "./NoticeComponent";
|
||||||
import NoticeTextSelectionComponent from "./NoticeTextSectionComponent";
|
import NoticeTextSelectionComponent from "./NoticeTextSectionComponent";
|
||||||
|
|
||||||
@@ -156,7 +156,8 @@ class SkipNoticeComponent extends React.Component<SkipNoticeProps, SkipNoticeSta
|
|||||||
showInSecondSlot={this.showInSecondSlot}
|
showInSecondSlot={this.showInSecondSlot}
|
||||||
idSuffix={this.idSuffix}
|
idSuffix={this.idSuffix}
|
||||||
fadeIn={true}
|
fadeIn={true}
|
||||||
startFaded={false}
|
startFaded={Config.config.noticeVisibilityMode >= NoticeVisbilityMode.FadedForAll
|
||||||
|
|| (Config.config.noticeVisibilityMode >= NoticeVisbilityMode.FadedForAutoSkip && this.autoSkip)}
|
||||||
timed={true}
|
timed={true}
|
||||||
maxCountdownTime={this.state.maxCountdownTime}
|
maxCountdownTime={this.state.maxCountdownTime}
|
||||||
videoSpeed={() => this.contentContainer().v?.playbackRate}
|
videoSpeed={() => this.contentContainer().v?.playbackRate}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as CompileConfig from "../config.json";
|
import * as CompileConfig from "../config.json";
|
||||||
import { Category, CategorySelection, CategorySkipOption, PreviewBarOption, SponsorTime, StorageChangesObject, UnEncodedSegmentTimes as UnencodedSegmentTimes } from "./types";
|
import { Category, CategorySelection, CategorySkipOption, NoticeVisbilityMode, PreviewBarOption, SponsorTime, StorageChangesObject, UnEncodedSegmentTimes as UnencodedSegmentTimes } from "./types";
|
||||||
|
|
||||||
interface SBConfig {
|
interface SBConfig {
|
||||||
userID: string,
|
userID: string,
|
||||||
@@ -20,6 +20,7 @@ interface SBConfig {
|
|||||||
trackViewCount: boolean,
|
trackViewCount: boolean,
|
||||||
trackViewCountInPrivate: boolean,
|
trackViewCountInPrivate: boolean,
|
||||||
dontShowNotice: boolean,
|
dontShowNotice: boolean,
|
||||||
|
noticeVisibilityMode: NoticeVisbilityMode,
|
||||||
hideVideoPlayerControls: boolean,
|
hideVideoPlayerControls: boolean,
|
||||||
hideInfoButtonPlayerControls: boolean,
|
hideInfoButtonPlayerControls: boolean,
|
||||||
hideDeleteButtonPlayerControls: boolean,
|
hideDeleteButtonPlayerControls: boolean,
|
||||||
@@ -162,6 +163,7 @@ const Config: SBObject = {
|
|||||||
trackViewCount: true,
|
trackViewCount: true,
|
||||||
trackViewCountInPrivate: true,
|
trackViewCountInPrivate: true,
|
||||||
dontShowNotice: false,
|
dontShowNotice: false,
|
||||||
|
noticeVisibilityMode: NoticeVisbilityMode.FadedForAutoSkip,
|
||||||
hideVideoPlayerControls: false,
|
hideVideoPlayerControls: false,
|
||||||
hideInfoButtonPlayerControls: false,
|
hideInfoButtonPlayerControls: false,
|
||||||
hideDeleteButtonPlayerControls: false,
|
hideDeleteButtonPlayerControls: false,
|
||||||
|
|||||||
@@ -40,9 +40,10 @@ async function init() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const option = optionsElements[i].getAttribute("sync-option");
|
||||||
|
|
||||||
switch (optionsElements[i].getAttribute("option-type")) {
|
switch (optionsElements[i].getAttribute("option-type")) {
|
||||||
case "toggle": {
|
case "toggle": {
|
||||||
const option = optionsElements[i].getAttribute("sync-option");
|
|
||||||
const optionResult = Config.config[option];
|
const optionResult = Config.config[option];
|
||||||
|
|
||||||
const checkbox = optionsElements[i].querySelector("input");
|
const checkbox = optionsElements[i].querySelector("input");
|
||||||
@@ -95,16 +96,15 @@ async function init() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "text-change": {
|
case "text-change": {
|
||||||
const textChangeOption = optionsElements[i].getAttribute("sync-option");
|
|
||||||
const textChangeInput = <HTMLInputElement> optionsElements[i].querySelector(".option-text-box");
|
const textChangeInput = <HTMLInputElement> optionsElements[i].querySelector(".option-text-box");
|
||||||
|
|
||||||
const textChangeSetButton = <HTMLElement> optionsElements[i].querySelector(".text-change-set");
|
const textChangeSetButton = <HTMLElement> optionsElements[i].querySelector(".text-change-set");
|
||||||
|
|
||||||
textChangeInput.value = Config.config[textChangeOption];
|
textChangeInput.value = Config.config[option];
|
||||||
|
|
||||||
textChangeSetButton.addEventListener("click", async () => {
|
textChangeSetButton.addEventListener("click", async () => {
|
||||||
// See if anything extra must be done
|
// See if anything extra must be done
|
||||||
switch (textChangeOption) {
|
switch (option) {
|
||||||
case "serverAddress": {
|
case "serverAddress": {
|
||||||
const result = validateServerAddress(textChangeInput.value);
|
const result = validateServerAddress(textChangeInput.value);
|
||||||
|
|
||||||
@@ -130,7 +130,7 @@ async function init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.config[textChangeOption] = textChangeInput.value;
|
Config.config[option] = textChangeInput.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Reset to the default if needed
|
// Reset to the default if needed
|
||||||
@@ -138,9 +138,9 @@ async function init() {
|
|||||||
textChangeResetButton.addEventListener("click", () => {
|
textChangeResetButton.addEventListener("click", () => {
|
||||||
if (!confirm(chrome.i18n.getMessage("areYouSureReset"))) return;
|
if (!confirm(chrome.i18n.getMessage("areYouSureReset"))) return;
|
||||||
|
|
||||||
Config.config[textChangeOption] = Config.defaults[textChangeOption];
|
Config.config[option] = Config.defaults[option];
|
||||||
|
|
||||||
textChangeInput.value = Config.config[textChangeOption];
|
textChangeInput.value = Config.config[option];
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -180,22 +180,34 @@ async function init() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "number-change": {
|
case "number-change": {
|
||||||
const numberChangeOption = optionsElements[i].getAttribute("sync-option");
|
const configValue = Config.config[option];
|
||||||
const configValue = Config.config[numberChangeOption];
|
|
||||||
const numberInput = optionsElements[i].querySelector("input");
|
const numberInput = optionsElements[i].querySelector("input");
|
||||||
|
|
||||||
if (isNaN(configValue) || configValue < 0) {
|
if (isNaN(configValue) || configValue < 0) {
|
||||||
numberInput.value = Config.defaults[numberChangeOption];
|
numberInput.value = Config.defaults[option];
|
||||||
} else {
|
} else {
|
||||||
numberInput.value = configValue;
|
numberInput.value = configValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
numberInput.addEventListener("input", () => {
|
numberInput.addEventListener("input", () => {
|
||||||
Config.config[numberChangeOption] = numberInput.value;
|
Config.config[option] = numberInput.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case "selector": {
|
||||||
|
const configValue = Config.config[option];
|
||||||
|
const selectorElement = optionsElements[i].querySelector(".selector-element") as HTMLSelectElement;
|
||||||
|
selectorElement.value = configValue;
|
||||||
|
|
||||||
|
selectorElement.addEventListener("change", () => {
|
||||||
|
let value: string | number = selectorElement.value;
|
||||||
|
if (!isNaN(Number(value))) value = Number(value);
|
||||||
|
|
||||||
|
Config.config[option] = value;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
case "react-CategoryChooserComponent":
|
case "react-CategoryChooserComponent":
|
||||||
new CategoryChooser(optionsElements[i]);
|
new CategoryChooser(optionsElements[i]);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import Utils from "../utils";
|
|||||||
const utils = new Utils();
|
const utils = new Utils();
|
||||||
|
|
||||||
import SkipNoticeComponent, { SkipNoticeAction } from "../components/SkipNoticeComponent";
|
import SkipNoticeComponent, { SkipNoticeAction } from "../components/SkipNoticeComponent";
|
||||||
import { SponsorTime, ContentContainer } from "../types";
|
import { SponsorTime, ContentContainer, NoticeVisbilityMode } from "../types";
|
||||||
|
import Config from "../config";
|
||||||
|
|
||||||
class SkipNotice {
|
class SkipNotice {
|
||||||
segments: SponsorTime[];
|
segments: SponsorTime[];
|
||||||
@@ -45,7 +46,8 @@ class SkipNotice {
|
|||||||
contentContainer={contentContainer}
|
contentContainer={contentContainer}
|
||||||
ref={this.skipNoticeRef}
|
ref={this.skipNoticeRef}
|
||||||
closeListener={() => this.close()}
|
closeListener={() => this.close()}
|
||||||
smaller={true}
|
smaller={Config.config.noticeVisibilityMode >= NoticeVisbilityMode.MiniForAll
|
||||||
|
|| (Config.config.noticeVisibilityMode >= NoticeVisbilityMode.MiniForAutoSkip && autoSkip)}
|
||||||
unskipTime={unskipTime} />,
|
unskipTime={unskipTime} />,
|
||||||
this.noticeElement
|
this.noticeElement
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -200,3 +200,11 @@ export interface ToggleSkippable {
|
|||||||
toggleSkip: () => void;
|
toggleSkip: () => void;
|
||||||
setShowKeybindHint: (show: boolean) => void;
|
setShowKeybindHint: (show: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum NoticeVisbilityMode {
|
||||||
|
FullSize = 0,
|
||||||
|
MiniForAutoSkip = 1,
|
||||||
|
MiniForAll = 2,
|
||||||
|
FadedForAutoSkip = 3,
|
||||||
|
FadedForAll = 4
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user