Compare commits

...

7 Commits

Author SHA1 Message Date
Ajay Ramachandran
88350e3421 Merge pull request #308 from ajayyy/experimental
Skipping Fixes
2020-03-30 20:11:33 -04:00
Ajay Ramachandran
36d79313de Increase version number 2020-03-30 20:10:32 -04:00
Ajay Ramachandran
a9993d5d80 Added check for videoID change not being called 2020-03-30 20:08:00 -04:00
Ajay Ramachandran
4a6ddf6774 Remove mobile support announcement 2020-03-30 19:15:25 -04:00
Ajay Ramachandran
b6172c6d9b Fixed sponsor skipping after quickly playing and pausing. 2020-03-30 19:07:59 -04:00
Ajay Ramachandran
b21a59f4e5 Fixed looping sometimes not skipping beginning sponsors.
Resolves https://github.com/ajayyy/SponsorBlock/issues/306
2020-03-30 15:33:03 -04:00
Ajay Ramachandran
78dd44c502 Fixed missing name in release workflow 2020-03-30 14:44:26 -04:00
4 changed files with 42 additions and 21 deletions

View File

@@ -67,10 +67,12 @@ jobs:
uses: Shopify/upload-to-release@master
with:
args: builds/ChromeExtension.zip
name: ChromeExtension.zip
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload to release
uses: Shopify/upload-to-release@master
with:
args: builds/FirefoxExtension.zip
name: FirefoxExtension.zip
repo-token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,7 +1,7 @@
{
"name": "__MSG_fullName__",
"short_name": "__MSG_Name__",
"version": "1.2.23",
"version": "1.2.24",
"default_locale": "en",
"description": "__MSG_Description__",
"content_scripts": [{

View File

@@ -88,10 +88,6 @@ chrome.runtime.onInstalled.addListener(function (object) {
const newUserID = utils.generateUserID();
//save this UUID
Config.config.userID = newUserID;
//TODO: Remove when mobile support is old
// Don't show this to new users
// Config.config.mobileUpdateShowCount = 1;
}
}, 1500);
});

View File

@@ -21,7 +21,7 @@ var UUIDs = [];
var sponsorVideoID = null;
// Skips are scheduled to ensure precision.
// Skips are rescheduled every seeked event.
// Skips are rescheduled every seeking event.
// Skips are canceled every seeking event
var currentSkipSchedule: NodeJS.Timeout = null;
var seekListenerSetUp = false
@@ -35,6 +35,9 @@ var sponsorSkipped = [];
//the video
var video: HTMLVideoElement;
/** The last time this video was seeking to */
var lastVideoTime: number = null;
var onInvidious;
var onMobileYouTube;
@@ -476,12 +479,24 @@ function startSponsorSchedule(currentTime?: number): void {
let forcedSkipTime: number = null;
if (video.currentTime >= skipTime[0] && video.currentTime < skipTime[1]) {
skipToTime(video, skipInfo.index, skipInfo.array, skipInfo.openNotice);
// Double check that the videoID is correct
// TODO: Remove this bug catching if statement when the bug is found
let currentVideoID = getYouTubeVideoID(document.URL);
if (currentVideoID == sponsorVideoID) {
skipToTime(video, skipInfo.index, skipInfo.array, skipInfo.openNotice);
if (Config.config.disableAutoSkip) {
forcedSkipTime = skipTime[0] + 0.001;
if (Config.config.disableAutoSkip) {
forcedSkipTime = skipTime[0] + 0.001;
} else {
forcedSkipTime = skipTime[1];
}
} else {
forcedSkipTime = skipTime[1];
// Something has really gone wrong
console.error("[SponsorBlock] The videoID recorded when trying to skip is different than what it should be.");
console.error("[SponsorBlock] VideoID recorded: " + sponsorVideoID + ". Actual VideoID: " + currentVideoID);
// Video ID change occured
videoIDChange(currentVideoID);
}
}
@@ -533,12 +548,27 @@ function sponsorsLookup(id: string, channelIDPromise?) {
startSponsorSchedule();
}
});
video.addEventListener('seeked', () => {
if (!video.paused) startSponsorSchedule();
video.addEventListener('seeking', () => {
// Reset lastCheckVideoTime
lastCheckVideoTime = -1
lastCheckTime = 0;
lastVideoTime = video.currentTime;
if (!video.paused){
startSponsorSchedule();
}
});
video.addEventListener('ratechange', () => startSponsorSchedule());
video.addEventListener('seeking', cancelSponsorSchedule);
video.addEventListener('pause', cancelSponsorSchedule);
video.addEventListener('pause', () => {
// Reset lastCheckVideoTime
lastCheckVideoTime = -1;
lastCheckTime = 0;
lastVideoTime = video.currentTime;
cancelSponsorSchedule();
});
startSponsorSchedule();
}
@@ -872,13 +902,6 @@ function skipToTime(v, index, sponsorTimes, openNotice) {
let skipNotice = new SkipNotice(this, currentUUID, Config.config.disableAutoSkip, skipNoticeContentContainer);
//TODO: Remove this when Mobile support is old
if (Config.config.mobileUpdateShowCount < 1) {
skipNotice.addNoticeInfoMessage(chrome.i18n.getMessage("mobileUpdateInfo"));
Config.config.mobileUpdateShowCount += 1;
}
//auto-upvote this sponsor
if (Config.config.trackViewCount && !Config.config.disableAutoSkip && Config.config.autoUpvote) {
vote(1, currentUUID, null);