mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 05:27:03 +03:00
Support older browsers
This commit is contained in:
@@ -11,13 +11,13 @@ export function urlTimeToSeconds(time: string): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const re = /(?:(?<hours>\d{1,3})h)?(?:(?<minutes>\d{1,2})m)?(?<seconds>\d+)s?/;
|
||||
const re = /(?:(\d{1,3})h)?(?:(\d{1,2})m)?(\d+)s?/;
|
||||
const match = re.exec(time);
|
||||
|
||||
if (match) {
|
||||
const hours = parseInt(match.groups.hours ?? '0', 10);
|
||||
const minutes = parseInt(match.groups.minutes ?? '0', 10);
|
||||
const seconds = parseInt(match.groups.seconds ?? '0', 10);
|
||||
const hours = parseInt(match[1] ?? '0', 10);
|
||||
const minutes = parseInt(match[2] ?? '0', 10);
|
||||
const seconds = parseInt(match[3] ?? '0', 10);
|
||||
|
||||
return hours * 3600 + minutes * 60 + seconds;
|
||||
} else if (/\d+/.test(time)) {
|
||||
|
||||
Reference in New Issue
Block a user