Add option to disable showing full video segments

This commit is contained in:
Ajay 2022-01-06 16:26:59 -05:00
parent d16a409db2
commit 57de51475f
4 changed files with 35 additions and 1 deletions

View file

@ -624,6 +624,10 @@
"muteSegments": {
"message": "Allow segments that mute audio instead of skip"
},
"fullVideoSegments": {
"message": "Show an icon when a video is entirely an advertisement",
"description": "Referring to the category pill that is now shown on videos that are entirely sponsor or entirely selfpromo"
},
"colorFormatIncorrect": {
"message": "Your color is formatted incorrectly. It should be a 3 or 6 digit hex code with a number sign at the beginning."
},

View file

@ -66,6 +66,22 @@
<br/>
</div>
<div option-type="toggle" sync-option="fullVideoSegments">
<label class="switch-container">
<label class="switch">
<input type="checkbox" checked>
<span class="slider round"></span>
</label>
<div class="switch-label">
__MSG_fullVideoSegments__
</div>
</label>
<br/>
<br/>
<br/>
</div>
<br/>
<br/>

View file

@ -21,6 +21,7 @@ interface SBConfig {
showTimeWithSkips: boolean,
disableSkipping: boolean,
muteSegments: boolean,
fullVideoSegments: boolean,
trackViewCount: boolean,
trackViewCountInPrivate: boolean,
dontShowNotice: boolean,
@ -177,6 +178,7 @@ const Config: SBObject = {
showTimeWithSkips: true,
disableSkipping: false,
muteSegments: true,
fullVideoSegments: true,
trackViewCount: true,
trackViewCountInPrivate: true,
dontShowNotice: false,

View file

@ -687,7 +687,7 @@ async function sponsorsLookup(id: string, keepOldSubmissions = true) {
const hashPrefix = (await utils.getHash(id, 1)).substr(0, 4);
const response = await utils.asyncRequestToServer('GET', "/api/skipSegments/" + hashPrefix, {
categories,
actionTypes: Config.config.muteSegments ? [ActionType.Skip, ActionType.Mute, ActionType.Full] : [ActionType.Skip, ActionType.Full],
actionTypes: getEnabledActionTypes(),
userAgent: `${chrome.runtime.id}`,
...extraRequestData
});
@ -768,6 +768,18 @@ async function sponsorsLookup(id: string, keepOldSubmissions = true) {
lookupVipInformation(id);
}
function getEnabledActionTypes(): ActionType[] {
const actionTypes = [ActionType.Skip];
if (Config.config.muteSegments) {
actionTypes.push(ActionType.Mute);
}
if (Config.config.fullVideoSegments) {
actionTypes.push(ActionType.Full);
}
return actionTypes;
}
function lookupVipInformation(id: string): void {
updateVipInfo().then((isVip) => {
if (isVip) {