mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-12 18:04:20 +01:00
Adding option to enable playback rate in the time with skips calculations
This commit is contained in:
parent
e5472eb4c6
commit
4c15c1ca0a
4 changed files with 19 additions and 2 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 5528978f2f608eb84a7f7e9785508b0f70a9e3cc
|
||||
Subproject commit 0a46f4ec38482f511b46da52c26081ee4478518f
|
|
@ -357,6 +357,20 @@
|
|||
<div class="small-description">__MSG_showTimeWithSkipsDescription__</div>
|
||||
</div>
|
||||
|
||||
<div data-type="toggle" data-sync="usePlaybackRate">
|
||||
<div class="switch-container">
|
||||
<label class="switch">
|
||||
<input id="usePlaybackRate" type="checkbox">
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<label class="switch-label" for="usePlaybackRate">
|
||||
__MSG_usePlaybackRate__
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="small-description">__MSG_usePlaybackRateDescription__</div>
|
||||
</div>
|
||||
|
||||
<div data-type="toggle" data-sync="darkMode">
|
||||
<div class="switch-container">
|
||||
<label class="switch">
|
||||
|
|
|
@ -23,6 +23,7 @@ interface SBConfig {
|
|||
sponsorTimesContributed: number;
|
||||
submissionCountSinceCategories: number; // New count used to show the "Read The Guidelines!!" message
|
||||
showTimeWithSkips: boolean;
|
||||
usePlaybackRate: boolean; // used to calculate showTimeWithSkips using the current playback rate
|
||||
disableSkipping: boolean;
|
||||
muteSegments: boolean;
|
||||
fullVideoSegments: boolean;
|
||||
|
@ -269,6 +270,7 @@ const syncDefaults = {
|
|||
sponsorTimesContributed: 0,
|
||||
submissionCountSinceCategories: 0,
|
||||
showTimeWithSkips: true,
|
||||
usePlaybackRate: false,
|
||||
disableSkipping: false,
|
||||
muteSegments: true,
|
||||
fullVideoSegments: true,
|
||||
|
|
|
@ -2526,7 +2526,8 @@ function showTimeWithoutSkips(skippedDuration: number): void {
|
|||
display.appendChild(duration);
|
||||
}
|
||||
|
||||
const durationAfterSkips = getFormattedTime((getVideo()?.duration - skippedDuration)/(getVideo()?.playbackRate ?? 1));
|
||||
const playbackRate = Config.config.usePlaybackRate ? (getVideo()?.playbackRate ?? 1) : 1;
|
||||
const durationAfterSkips = getFormattedTime((getVideo()?.duration - skippedDuration)/playbackRate);
|
||||
|
||||
duration.innerText = (durationAfterSkips == null || skippedDuration <= 0) ? "" : " (" + durationAfterSkips + ")";
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue