mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 20:17:05 +03:00
Sped up zero second sponsors a tiny bit
This commit is contained in:
@@ -70,6 +70,12 @@ utils.wait(() => Config.config !== null, 1000, 1).then(() => videoIDChange(getYo
|
|||||||
//this only happens if there is an error
|
//this only happens if there is an error
|
||||||
var sponsorLookupRetries = 0;
|
var sponsorLookupRetries = 0;
|
||||||
|
|
||||||
|
//the last time in the video a sponsor was skipped
|
||||||
|
//used for the go back button
|
||||||
|
var lastSponsorTimeSkipped = null;
|
||||||
|
//used for ratings
|
||||||
|
var lastSponsorTimeSkippedUUID = null;
|
||||||
|
|
||||||
//if showing the start sponsor button or the end sponsor button on the player
|
//if showing the start sponsor button or the end sponsor button on the player
|
||||||
var showingStartSponsor = true;
|
var showingStartSponsor = true;
|
||||||
|
|
||||||
@@ -229,9 +235,6 @@ document.onkeydown = function(e: KeyboardEvent){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetValues() {
|
function resetValues() {
|
||||||
//reset last sponsor times
|
|
||||||
lastTime = -1;
|
|
||||||
|
|
||||||
//reset sponsor times
|
//reset sponsor times
|
||||||
sponsorTimes = null;
|
sponsorTimes = null;
|
||||||
UUIDs = [];
|
UUIDs = [];
|
||||||
@@ -425,6 +428,8 @@ function durationChangeListener() {
|
|||||||
function cancelSponsorSchedule(): void {
|
function cancelSponsorSchedule(): void {
|
||||||
if (currentSkipSchedule !== null) {
|
if (currentSkipSchedule !== null) {
|
||||||
clearTimeout(currentSkipSchedule);
|
clearTimeout(currentSkipSchedule);
|
||||||
|
|
||||||
|
currentSkipSchedule = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,7 +451,7 @@ function startSponsorSchedule(currentTime?: number): void {
|
|||||||
let skipTime = skipInfo.array[skipInfo.index];
|
let skipTime = skipInfo.array[skipInfo.index];
|
||||||
let timeUntilSponsor = skipTime[0] - currentTime;
|
let timeUntilSponsor = skipTime[0] - currentTime;
|
||||||
|
|
||||||
currentSkipSchedule = setTimeout(() => {
|
let skippingFunction = () => {
|
||||||
if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) {
|
if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) {
|
||||||
skipToTime(video, skipInfo.index, skipInfo.array, skipInfo.openNotice);
|
skipToTime(video, skipInfo.index, skipInfo.array, skipInfo.openNotice);
|
||||||
|
|
||||||
@@ -454,7 +459,13 @@ function startSponsorSchedule(currentTime?: number): void {
|
|||||||
} else {
|
} else {
|
||||||
startSponsorSchedule();
|
startSponsorSchedule();
|
||||||
}
|
}
|
||||||
}, timeUntilSponsor * 1000 * (1 / video.playbackRate));
|
};
|
||||||
|
|
||||||
|
if (timeUntilSponsor <= 0) {
|
||||||
|
skippingFunction();
|
||||||
|
} else {
|
||||||
|
currentSkipSchedule = setTimeout(skippingFunction, timeUntilSponsor * 1000 * (1 / video.playbackRate));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sponsorsLookup(id: string, channelIDPromise?) {
|
function sponsorsLookup(id: string, channelIDPromise?) {
|
||||||
|
|||||||
Reference in New Issue
Block a user