Compare commits

...

6 Commits
5.1.2 ... 5.1.4

Author SHA1 Message Date
Ajay Ramachandran
8653059b13 bump version 2022-10-30 22:00:35 -04:00
Ajay
b3afd0403e Add configuration for segment failed to fetch warning 2022-10-30 20:38:48 -04:00
Ajay
6db498ccb1 Fix key moments check not working when multiple videos present 2022-10-30 20:36:05 -04:00
Ajay
ef8c5f58c5 Fix scrubbing bar missing when chapter bar using % widths 2022-10-30 14:49:19 -04:00
Ajay
71998831ee bump version 2022-10-30 13:23:12 -04:00
Ajay
8f19d3e83c Fix segment failed to fetch warning appearing for 404 2022-10-30 13:23:02 -04:00
5 changed files with 9 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
{ {
"name": "__MSG_fullName__", "name": "__MSG_fullName__",
"short_name": "SponsorBlock", "short_name": "SponsorBlock",
"version": "5.1.2", "version": "5.1.4",
"default_locale": "en", "default_locale": "en",
"description": "__MSG_Description__", "description": "__MSG_Description__",
"homepage_url": "https://sponsor.ajay.app", "homepage_url": "https://sponsor.ajay.app",

View File

@@ -68,6 +68,7 @@ interface SBConfig {
showCategoryWithoutPermission: boolean; showCategoryWithoutPermission: boolean;
showSegmentNameInChapterBar: boolean; showSegmentNameInChapterBar: boolean;
useVirtualTime: boolean; useVirtualTime: boolean;
showSegmentFailedToFetchWarning: boolean;
// Used to cache calculated text color info // Used to cache calculated text color info
categoryPillColors: { categoryPillColors: {
@@ -202,6 +203,7 @@ const Config: SBObject = {
showCategoryWithoutPermission: false, showCategoryWithoutPermission: false,
showSegmentNameInChapterBar: true, showSegmentNameInChapterBar: true,
useVirtualTime: true, useVirtualTime: true,
showSegmentFailedToFetchWarning: true,
categoryPillColors: {}, categoryPillColors: {},

View File

@@ -1926,7 +1926,8 @@ function startOrEndTimingNewSegment() {
importExistingChapters(false); importExistingChapters(false);
if (lastResponseStatus !== 200 && !shownSegmentFailedToFetchWarning) { if (lastResponseStatus !== 200 && lastResponseStatus !== 404
&& !shownSegmentFailedToFetchWarning && Config.config.showSegmentFailedToFetchWarning) {
alert(chrome.i18n.getMessage("segmentFetchFailureWarning")); alert(chrome.i18n.getMessage("segmentFetchFailureWarning"));
shownSegmentFailedToFetchWarning = true; shownSegmentFailedToFetchWarning = true;

View File

@@ -728,8 +728,8 @@ class PreviewBar {
private getPartialChapterSectionStyle(element: HTMLElement, param: string): number { private getPartialChapterSectionStyle(element: HTMLElement, param: string): number {
const data = element.style[param]; const data = element.style[param];
if (data?.includes("100%")) { if (data?.includes("%")) {
return 0; return this.customChaptersBar.clientWidth * (parseFloat(data.replace("%", "")) / 100);
} else { } else {
return parseInt(element.style[param].match(/\d+/g)?.[0]) || 0; return parseInt(element.style[param].match(/\d+/g)?.[0]) || 0;
} }

View File

@@ -71,7 +71,8 @@ export function getExistingChapters(currentVideoID: VideoID, duration: number):
const chapters: SponsorTime[] = []; const chapters: SponsorTime[] = [];
// .ytp-timed-markers-container indicates that key-moments are present, which should not be divided // .ytp-timed-markers-container indicates that key-moments are present, which should not be divided
if (chaptersBox && !(document.querySelector(".ytp-timed-markers-container")?.childElementCount > 0)) { if (chaptersBox && !(getControls()?.parentElement?.parentElement
?.querySelector(".ytp-timed-markers-container")?.childElementCount > 0)) {
let lastSegment: SponsorTime = null; let lastSegment: SponsorTime = null;
const links = chaptersBox.querySelectorAll("ytd-macro-markers-list-item-renderer > a"); const links = chaptersBox.querySelectorAll("ytd-macro-markers-list-item-renderer > a");
for (const link of links) { for (const link of links) {