mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 06:27:14 +03:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
88350e3421 | ||
|
|
36d79313de | ||
|
|
a9993d5d80 | ||
|
|
4a6ddf6774 | ||
|
|
b6172c6d9b | ||
|
|
b21a59f4e5 | ||
|
|
78dd44c502 |
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
@@ -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 }}
|
||||
|
||||
|
||||
@@ -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": [{
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user