mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
Forced auto skip if previewing sponsor.
Resolves https://github.com/ajayyy/SponsorBlock/issues/222
This commit is contained in:
@@ -49,6 +49,10 @@ var channelWhitelisted = false;
|
||||
// create preview bar
|
||||
var previewBar = null;
|
||||
|
||||
// When not null, a sponsor is currently being previewed and auto skip should be enabled.
|
||||
// This is set to a timeout function when that happens that will reset it after 3 seconds.
|
||||
var previewResetter: NodeJS.Timeout = null;
|
||||
|
||||
//the player controls on the YouTube player
|
||||
var controls = null;
|
||||
|
||||
@@ -144,6 +148,13 @@ function messageListener(request: any, sender: any, sendResponse: (response: any
|
||||
video.play();
|
||||
}
|
||||
|
||||
// Start preview resetter
|
||||
if (previewResetter !== null){
|
||||
clearTimeout(previewResetter);
|
||||
}
|
||||
|
||||
previewResetter = setTimeout(() => previewResetter = null, 4000);
|
||||
|
||||
return
|
||||
case "getCurrentTime":
|
||||
sendResponse({
|
||||
@@ -658,7 +669,7 @@ function checkIfTimeToSkip(currentVideoTime, startTime, endTime) {
|
||||
|
||||
//skip fromt he start time to the end time for a certain index sponsor time
|
||||
function skipToTime(v, index, sponsorTimes, openNotice) {
|
||||
if (!Config.config.disableAutoSkip) {
|
||||
if (!Config.config.disableAutoSkip || previewResetter !== null) {
|
||||
v.currentTime = sponsorTimes[index][1];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user