mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-14 15:37:12 +03:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9f86aa6740 | ||
|
|
466573e2a4 | ||
|
|
4c417b10fe | ||
|
|
36549e7898 | ||
|
|
0d2d5f2eb0 | ||
|
|
e089b83797 | ||
|
|
dbd0d157a8 | ||
|
|
aef2b113f8 | ||
|
|
e610e03e46 | ||
|
|
17cbd068b9 | ||
|
|
7064d3fe82 | ||
|
|
abfe0b3f38 |
@@ -2,7 +2,7 @@
|
|||||||
"browser_specific_settings": {
|
"browser_specific_settings": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
"id": "sponsorBlocker@ajay.app",
|
"id": "sponsorBlocker@ajay.app",
|
||||||
"strict_min_version": "56.0"
|
"strict_min_version": "102.0"
|
||||||
},
|
},
|
||||||
"gecko_android": {
|
"gecko_android": {
|
||||||
"strict_min_version": "113.0"
|
"strict_min_version": "113.0"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "__MSG_fullName__",
|
"name": "__MSG_fullName__",
|
||||||
"short_name": "SponsorBlock",
|
"short_name": "SponsorBlock",
|
||||||
"version": "5.8",
|
"version": "5.9",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"description": "__MSG_Description__",
|
"description": "__MSG_Description__",
|
||||||
"homepage_url": "https://sponsor.ajay.app",
|
"homepage_url": "https://sponsor.ajay.app",
|
||||||
|
|||||||
Submodule maze-utils updated: e9523b0c5d...0dfe77cfe6
Submodule public/_locales updated: 3c5a80ca9c...6abf21bf47
@@ -75,7 +75,6 @@ let sponsorTimes: SponsorTime[] = [];
|
|||||||
let existingChaptersImported = false;
|
let existingChaptersImported = false;
|
||||||
let importingChaptersWaitingForFocus = false;
|
let importingChaptersWaitingForFocus = false;
|
||||||
let importingChaptersWaiting = false;
|
let importingChaptersWaiting = false;
|
||||||
let triedImportingChapters = false;
|
|
||||||
// List of open skip notices
|
// List of open skip notices
|
||||||
const skipNotices: SkipNotice[] = [];
|
const skipNotices: SkipNotice[] = [];
|
||||||
let activeSkipKeybindElement: ToggleSkippable = null;
|
let activeSkipKeybindElement: ToggleSkippable = null;
|
||||||
@@ -395,7 +394,6 @@ function resetValues() {
|
|||||||
|
|
||||||
sponsorTimes = [];
|
sponsorTimes = [];
|
||||||
existingChaptersImported = false;
|
existingChaptersImported = false;
|
||||||
triedImportingChapters = false;
|
|
||||||
sponsorSkipped = [];
|
sponsorSkipped = [];
|
||||||
lastResponseStatus = 0;
|
lastResponseStatus = 0;
|
||||||
shownSegmentFailedToFetchWarning = false;
|
shownSegmentFailedToFetchWarning = false;
|
||||||
@@ -512,12 +510,8 @@ function handleMobileControlsMutations(): void {
|
|||||||
|
|
||||||
function getPreviewBarAttachElement(): HTMLElement | null {
|
function getPreviewBarAttachElement(): HTMLElement | null {
|
||||||
const progressElementOptions = [{
|
const progressElementOptions = [{
|
||||||
// For new mobile YouTube (#1287)
|
// For newer mobile YouTube (Sept 2024)
|
||||||
selector: ".progress-bar-line",
|
selector: ".YtChapteredProgressBarHost",
|
||||||
isVisibleCheck: true
|
|
||||||
}, {
|
|
||||||
// For newer mobile YouTube (Jan 2024)
|
|
||||||
selector: ".YtProgressBarProgressBarLine",
|
|
||||||
isVisibleCheck: true
|
isVisibleCheck: true
|
||||||
}, {
|
}, {
|
||||||
// For newer mobile YouTube (May 2024)
|
// For newer mobile YouTube (May 2024)
|
||||||
@@ -1139,7 +1133,7 @@ function setupCategoryPill() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function sponsorsLookup(keepOldSubmissions = true, ignoreCache = false) {
|
async function sponsorsLookup(keepOldSubmissions = true, ignoreCache = false) {
|
||||||
const videoID = getVideoID()
|
const videoID = getVideoID();
|
||||||
if (!videoID) {
|
if (!videoID) {
|
||||||
console.error("[SponsorBlock] Attempted to fetch segments with a null/undefined videoID.");
|
console.error("[SponsorBlock] Attempted to fetch segments with a null/undefined videoID.");
|
||||||
return;
|
return;
|
||||||
@@ -1147,6 +1141,9 @@ async function sponsorsLookup(keepOldSubmissions = true, ignoreCache = false) {
|
|||||||
|
|
||||||
const segmentData = await getSegmentsForVideo(videoID, ignoreCache);
|
const segmentData = await getSegmentsForVideo(videoID, ignoreCache);
|
||||||
|
|
||||||
|
// Make sure an old pending request doesn't get used.
|
||||||
|
if (videoID !== getVideoID()) return;
|
||||||
|
|
||||||
// store last response status
|
// store last response status
|
||||||
lastResponseStatus = segmentData.status;
|
lastResponseStatus = segmentData.status;
|
||||||
if (segmentData.status === 200) {
|
if (segmentData.status === 200) {
|
||||||
@@ -1238,7 +1235,7 @@ async function sponsorsLookup(keepOldSubmissions = true, ignoreCache = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function importExistingChapters(wait: boolean) {
|
function importExistingChapters(wait: boolean) {
|
||||||
if (!existingChaptersImported && !importingChaptersWaiting && !triedImportingChapters && onVideoPage() && !isOnMobileYouTube()) {
|
if (!existingChaptersImported && !importingChaptersWaiting && onVideoPage() && !isOnMobileYouTube()) {
|
||||||
const waitCondition = () => getVideoDuration() && getExistingChapters(getVideoID(), getVideoDuration());
|
const waitCondition = () => getVideoDuration() && getExistingChapters(getVideoID(), getVideoDuration());
|
||||||
|
|
||||||
if (wait && !document.hasFocus() && !importingChaptersWaitingForFocus && !waitCondition()) {
|
if (wait && !document.hasFocus() && !importingChaptersWaitingForFocus && !waitCondition()) {
|
||||||
@@ -1259,7 +1256,7 @@ function importExistingChapters(wait: boolean) {
|
|||||||
existingChaptersImported = true;
|
existingChaptersImported = true;
|
||||||
updatePreviewBar();
|
updatePreviewBar();
|
||||||
}
|
}
|
||||||
}).catch(() => { importingChaptersWaiting = false; triedImportingChapters = true; }); // eslint-disable-line @typescript-eslint/no-empty-function
|
}).catch(() => { importingChaptersWaiting = false; }); // eslint-disable-line @typescript-eslint/no-empty-function
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2571,6 +2568,8 @@ function hotkeyListener(e: KeyboardEvent): void {
|
|||||||
submitSegments();
|
submitSegments();
|
||||||
return;
|
return;
|
||||||
} else if (keybindEquals(key, openSubmissionMenuKey)) {
|
} else if (keybindEquals(key, openSubmissionMenuKey)) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
openSubmissionMenu();
|
openSubmissionMenu();
|
||||||
return;
|
return;
|
||||||
} else if (keybindEquals(key, previewKey)) {
|
} else if (keybindEquals(key, previewKey)) {
|
||||||
@@ -2585,16 +2584,6 @@ function hotkeyListener(e: KeyboardEvent): void {
|
|||||||
previousChapter();
|
previousChapter();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//legacy - to preserve keybinds for skipKey, startSponsorKey and submitKey for people who set it before the update. (shouldn't be changed for future keybind options)
|
|
||||||
if (key.key == skipKey?.key && skipKey.code == null && !keybindEquals(Config.syncDefaults.skipKeybind, skipKey)) {
|
|
||||||
if (activeSkipKeybindElement)
|
|
||||||
activeSkipKeybindElement.toggleSkip.call(activeSkipKeybindElement);
|
|
||||||
} else if (key.key == startSponsorKey?.key && startSponsorKey.code == null && !keybindEquals(Config.syncDefaults.startSponsorKeybind, startSponsorKey)) {
|
|
||||||
startOrEndTimingNewSegment();
|
|
||||||
} else if (key.key == submitKey?.key && submitKey.code == null && !keybindEquals(Config.syncDefaults.submitKeybind, submitKey)) {
|
|
||||||
openSubmissionMenu();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -197,7 +197,6 @@ class PreviewBar {
|
|||||||
|
|
||||||
if (this.onMobileYouTube) {
|
if (this.onMobileYouTube) {
|
||||||
this.container.style.transform = "none";
|
this.container.style.transform = "none";
|
||||||
this.container.style.height = "var(--yt-progress-bar-height)";
|
|
||||||
} else if (!this.onInvidious) {
|
} else if (!this.onInvidious) {
|
||||||
this.container.classList.add("sbNotInvidious");
|
this.container.classList.add("sbNotInvidious");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export function getHashParams(): Record<string, unknown> {
|
|||||||
|
|
||||||
export function getExistingChapters(currentVideoID: VideoID, duration: number): SponsorTime[] {
|
export function getExistingChapters(currentVideoID: VideoID, duration: number): SponsorTime[] {
|
||||||
const chaptersBox = document.querySelector("ytd-macro-markers-list-renderer");
|
const chaptersBox = document.querySelector("ytd-macro-markers-list-renderer");
|
||||||
const title = document.querySelector("[target-id=engagement-panel-macro-markers-auto-chapters] #title-text");
|
const title = chaptersBox?.closest("ytd-engagement-panel-section-list-renderer")?.querySelector("#title-text.ytd-engagement-panel-title-header-renderer");
|
||||||
if (title?.textContent?.includes("Key moment")) return [];
|
if (title?.textContent?.includes("Key moment")) return [];
|
||||||
|
|
||||||
const chapters: SponsorTime[] = [];
|
const chapters: SponsorTime[] = [];
|
||||||
@@ -92,6 +92,8 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(chapters)
|
||||||
|
|
||||||
return chapters;
|
return chapters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,13 @@ module.exports = env => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (env.browser.toLowerCase() === "edge") {
|
||||||
|
parsed.Description.message = parsed.Description.message.match(/^.+(?=\. )/)?.[0] || parsed.Description.message;
|
||||||
|
if (parsed.Description.message.length > 132) {
|
||||||
|
parsed.Description.message = parsed.Description.message.slice(0, 129) + "...";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Buffer.from(JSON.stringify(parsed));
|
return Buffer.from(JSON.stringify(parsed));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user