diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json
index a1beb859..44897364 100644
--- a/public/_locales/en/messages.json
+++ b/public/_locales/en/messages.json
@@ -289,6 +289,12 @@
"audioNotificationDescription": {
"message": "Audio notification on skip will play a sound whenever a sponsor is skipped. If disabled (or auto skip is disabled), no sound will be played."
},
+ "showTimeWithSkips": {
+ "message": "Show Time With Skips Removed"
+ },
+ "showTimeWithSkipsDescription": {
+ "message": "This time appears in brackets next to the current time on below the seekbar. This shows the total video duration minus any segments. This includes segments marked as only \"Show In Seekbar\"."
+ },
"youHaveSkipped": {
"message": "You have skipped "
},
diff --git a/public/options/options.html b/public/options/options.html
index 51001ee6..5a5e6caa 100644
--- a/public/options/options.html
+++ b/public/options/options.html
@@ -268,6 +268,23 @@
__MSG_audioNotificationDescription__
+
+
+
+
+
+
+
+
+
+
__MSG_showTimeWithSkipsDescription__
+
+
diff --git a/src/config.ts b/src/config.ts
index 634947a9..31880f48 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -15,6 +15,7 @@ interface SBConfig {
skipCount: number,
sponsorTimesContributed: number,
submissionCountSinceCategories: number, // New count used to show the "Read The Guidelines!!" message
+ showTimeWithSkips: boolean,
unsubmittedWarning: boolean,
disableSkipping: boolean,
trackViewCount: boolean,
@@ -133,6 +134,7 @@ var Config: SBObject = {
skipCount: 0,
sponsorTimesContributed: 0,
submissionCountSinceCategories: 0,
+ showTimeWithSkips: true,
unsubmittedWarning: true,
disableSkipping: false,
trackViewCount: true,
@@ -406,4 +408,4 @@ function addDefaults() {
// Sync config
setupConfig();
-export default Config;
\ No newline at end of file
+export default Config;
diff --git a/src/content.ts b/src/content.ts
index 86ae8342..0feb3e61 100644
--- a/src/content.ts
+++ b/src/content.ts
@@ -801,7 +801,7 @@ function updatePreviewBar() {
if (localSponsorTimes == null) localSponsorTimes = [];
let allSponsorTimes = localSponsorTimes.concat(sponsorTimesSubmitting);
-
+
//create an array of the sponsor types
let types = [];
for (let i = 0; i < localSponsorTimes.length; i++) {
@@ -818,6 +818,10 @@ function updatePreviewBar() {
previewBar.set(utils.getSegmentsFromSponsorTimes(allSponsorTimes), types, video.duration)
+ if (Config.config.showTimeWithSkips) {
+ showTimeWithoutSkips(allSponsorTimes);
+ }
+
//update last video id
lastPreviewBarUpdate = sponsorVideoID;
}
@@ -1593,3 +1597,36 @@ function updateAdFlag() {
updateVisibilityOfPlayerControlsButton();
}
}
+
+function showTimeWithoutSkips(allSponsorTimes): void {
+ let skipDuration = 0;
+
+ // Calculate skipDuration based from the segments in the preview bar
+ for (let i = 0; i < allSponsorTimes.length; i++) {
+ // If an end time exists
+ if (allSponsorTimes[i].segment[1]) {
+ skipDuration += allSponsorTimes[i].segment[1] - allSponsorTimes[i].segment[0];
+ }
+
+ }
+
+ // YouTube player time display
+ let display = document.getElementsByClassName("ytp-time-display notranslate")[0];
+ if (display === undefined) return
+
+ let formatedTime = utils.getFormattedTime(video.duration - skipDuration);
+
+ const durationID = "sponsorBlockDurationAfterSkips";
+ let duration = document.getElementById(durationID);
+
+ // Create span if needed
+ if(duration === null) {
+ duration = document.createElement('span');
+ duration.id = durationID;
+ duration.classList.add("ytp-time-duration");
+
+ display.appendChild(duration);
+ }
+
+ duration.innerText = (skipDuration <= 0 || isNaN(skipDuration)) ? "" : " ("+formatedTime+")";
+}
diff --git a/src/utils.ts b/src/utils.ts
index 6e12a0e5..db766772 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -338,7 +338,7 @@ class Utils {
secondsNum = Math.floor(secondsNum);
}
- let secondsDisplay: string = String(secondsNum.toFixed(3));
+ let secondsDisplay: string = String(precise ? secondsNum.toFixed(3) : secondsNum);
if (secondsNum < 10) {
//add a zero