mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 12:37:05 +03:00
Made preview button functional
This commit is contained in:
@@ -116,7 +116,8 @@ var skipNoticeContentContainer: ContentContainer = () => ({
|
||||
onMobileYouTube,
|
||||
sponsorSubmissionNotice: submissionNotice,
|
||||
resetSponsorSubmissionNotice,
|
||||
changeStartSponsorButton
|
||||
changeStartSponsorButton,
|
||||
previewTime
|
||||
});
|
||||
|
||||
//get messages from the background script and the popup
|
||||
@@ -861,6 +862,27 @@ function getStartTimes(sponsorTimes: number[][], minimum?: number, hideHiddenSpo
|
||||
return startTimes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Skip to exact time in a video and autoskips
|
||||
*
|
||||
* @param time
|
||||
*/
|
||||
function previewTime(time: number) {
|
||||
video.currentTime = time;
|
||||
|
||||
// Unpause the video if needed
|
||||
if (video.paused){
|
||||
video.play();
|
||||
}
|
||||
|
||||
// Start preview resetter
|
||||
if (previewResetter !== null){
|
||||
clearTimeout(previewResetter);
|
||||
}
|
||||
|
||||
previewResetter = setTimeout(() => previewResetter = null, 4000);
|
||||
}
|
||||
|
||||
//skip from the start time to the end time for a certain index sponsor time
|
||||
function skipToTime(v, index, sponsorTimes, openNotice) {
|
||||
if (!Config.config.disableAutoSkip || previewResetter !== null) {
|
||||
|
||||
Reference in New Issue
Block a user