aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAjay <[email protected]>2022-01-06 16:26:59 -0500
committerAjay <[email protected]>2022-01-06 16:26:59 -0500
commit57de51475f4232731fcfb1001bdb439c7602b917 (patch)
tree352be89b65113010c9d1e280bdfcfac2a7974b57
parentd16a409db27b04feec58de412baa2984f36e3832 (diff)
downloadSponsorBlock-full-video.tar.gz
SponsorBlock-full-video.zip
Add option to disable showing full video segmentsfull-video
-rw-r--r--public/_locales/en/messages.json4
-rw-r--r--public/options/options.html16
-rw-r--r--src/config.ts2
-rw-r--r--src/content.ts14
4 files changed, 35 insertions, 1 deletions
diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json
index d7855a69..ac7cbe09 100644
--- a/public/_locales/en/messages.json
+++ b/public/_locales/en/messages.json
@@ -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."
},
diff --git a/public/options/options.html b/public/options/options.html
index 1fbcf1b1..657b2d4d 100644
--- a/public/options/options.html
+++ b/public/options/options.html
@@ -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/>
diff --git a/src/config.ts b/src/config.ts
index b4a1a9cd..ae6f45aa 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -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,
diff --git a/src/content.ts b/src/content.ts
index 07bf607c..2b719591 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -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) {