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": { "muteSegments": {
"message": "Allow segments that mute audio instead of skip" "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": { "colorFormatIncorrect": {
"message": "Your color is formatted incorrectly. It should be a 3 or 6 digit hex code with a number sign at the beginning." "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/> <br/>
</div> </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/>
<br/> <br/>

View file

@ -21,6 +21,7 @@ interface SBConfig {
showTimeWithSkips: boolean, showTimeWithSkips: boolean,
disableSkipping: boolean, disableSkipping: boolean,
muteSegments: boolean, muteSegments: boolean,
fullVideoSegments: boolean,
trackViewCount: boolean, trackViewCount: boolean,
trackViewCountInPrivate: boolean, trackViewCountInPrivate: boolean,
dontShowNotice: boolean, dontShowNotice: boolean,
@ -177,6 +178,7 @@ const Config: SBObject = {
showTimeWithSkips: true, showTimeWithSkips: true,
disableSkipping: false, disableSkipping: false,
muteSegments: true, muteSegments: true,
fullVideoSegments: true,
trackViewCount: true, trackViewCount: true,
trackViewCountInPrivate: true, trackViewCountInPrivate: true,
dontShowNotice: false, 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 hashPrefix = (await utils.getHash(id, 1)).substr(0, 4);
const response = await utils.asyncRequestToServer('GET', "/api/skipSegments/" + hashPrefix, { const response = await utils.asyncRequestToServer('GET', "/api/skipSegments/" + hashPrefix, {
categories, categories,
actionTypes: Config.config.muteSegments ? [ActionType.Skip, ActionType.Mute, ActionType.Full] : [ActionType.Skip, ActionType.Full], actionTypes: getEnabledActionTypes(),
userAgent: `${chrome.runtime.id}`, userAgent: `${chrome.runtime.id}`,
...extraRequestData ...extraRequestData
}); });
@ -768,6 +768,18 @@ async function sponsorsLookup(id: string, keepOldSubmissions = true) {
lookupVipInformation(id); 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 { function lookupVipInformation(id: string): void {
updateVipInfo().then((isVip) => { updateVipInfo().then((isVip) => {
if (isVip) { if (isVip) {