Compare commits

...

7 Commits

Author SHA1 Message Date
Ajay
7bf17e1746 bump version 2022-12-22 02:20:32 -05:00
Ajay
3f7f671a3b Fix early skips on firefox when seeking while playing 2022-12-22 02:20:19 -05:00
Ajay
f764869cc8 Add another test case 2022-12-19 16:19:01 -05:00
Ajay
2ba5fa6954 bump version 2022-12-19 16:14:41 -05:00
Ajay
35b8a34162 Don't remove trailing end bracket when not starting with bracket 2022-12-19 16:12:51 -05:00
Ajay Ramachandran
3379189ea8 remove serious part of warning message 2022-12-19 13:13:38 -05:00
Ajay Ramachandran
e6be13b583 make warning message nicer 2022-12-19 13:11:03 -05:00
5 changed files with 52 additions and 21 deletions

View File

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

View File

@@ -942,7 +942,7 @@
"message": "Hide forever"
},
"warningChatInfo": {
"message": "We noticed you were making some common mistakes that are not malicious"
"message": "We noticed you were making some common mistakes. We very much appreciate your work so far, but we strive towards perfection here, so even very small mistakes matter :)"
},
"warningTitle": {
"message": "You got a warning"

View File

@@ -964,25 +964,23 @@ function updateVirtualTime() {
if (utils.isFirefox()) {
let count = 0;
let lastTime = lastKnownVideoTime.videoTime;
if (lastKnownVideoTime.fromPause) {
currentVirtualTimeInterval = setInterval(() => {
if (lastTime !== video.currentTime) {
count++;
lastTime = video.currentTime;
}
currentVirtualTimeInterval = setInterval(() => {
if (lastTime !== video.currentTime) {
count++;
lastTime = video.currentTime;
}
if (count > 1) {
const delay = lastKnownVideoTime.fromPause && lastKnownVideoTime.approximateDelay ?
lastKnownVideoTime.approximateDelay : 0;
lastKnownVideoTime.videoTime = video.currentTime + delay;
lastKnownVideoTime.preciseTime = performance.now();
clearInterval(currentVirtualTimeInterval);
currentVirtualTimeInterval = null;
}
}, 1);
}
if (count > 1) {
const delay = lastKnownVideoTime.fromPause && lastKnownVideoTime.approximateDelay ?
lastKnownVideoTime.approximateDelay : 0;
lastKnownVideoTime.videoTime = video.currentTime + delay;
lastKnownVideoTime.preciseTime = performance.now();
clearInterval(currentVirtualTimeInterval);
currentVirtualTimeInterval = null;
}
}, 1);
}
}

View File

@@ -39,7 +39,8 @@ export function importTimes(data: string, videoDuration: number): SponsorTime[]
if (match) {
const startTime = GenericUtils.getFormattedTimeToSeconds(match[0]);
if (startTime !== null) {
const specialCharsMatcher = /^(?:\s+seconds?)?[-:()\s]*|(?:\s+at)?[-:()\s]+$/g
// Remove "seconds", "at", special characters, and ")" if there was a "("
const specialCharsMatcher = /^(?:\s+seconds?)?[-:()\s]*|(?:\s+at)?[-:(\s]+$|(?<=^\s*\(.+)[-:()\s]*$/g
const titleLeft = line.split(match[0])[0].replace(specialCharsMatcher, "");
let titleRight = null;
const split2 = line.split(match[1] || match[0]);

View File

@@ -275,4 +275,36 @@ describe("Import segments", () => {
category: "chapter" as Category
}]);
});
it ("0:00 G¹ (Tangent Continuity)", () => {
const input = ` 0:00 G¹ (Tangent Continuity)
0:01 G² (Tangent Continuity)`;
const result = importTimes(input, 8000);
expect(result).toMatchObject([{
segment: [0, 1],
description: "G¹ (Tangent Continuity)",
category: "chapter" as Category
}, {
segment: [1, 8000],
description: "G² (Tangent Continuity)",
category: "chapter" as Category
}]);
});
it ("((Some name) 1:20)", () => {
const input = ` ((Some name) 1:20)
((Some other name) 1:25)`;
const result = importTimes(input, 8000);
expect(result).toMatchObject([{
segment: [80, 85],
description: "Some name",
category: "chapter" as Category
}, {
segment: [85, 8000],
description: "Some other name",
category: "chapter" as Category
}]);
});
});