mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
Don't use setinterval on safari
This commit is contained in:
@@ -16,7 +16,7 @@ import * as Chat from "./js-components/chat";
|
|||||||
import { SkipButtonControlBar } from "./js-components/skipButtonControlBar";
|
import { SkipButtonControlBar } from "./js-components/skipButtonControlBar";
|
||||||
import { getStartTimeFromUrl } from "./utils/urlParser";
|
import { getStartTimeFromUrl } from "./utils/urlParser";
|
||||||
import { findValidElement, getControls, getHashParams, isVisible } from "./utils/pageUtils";
|
import { findValidElement, getControls, getHashParams, isVisible } from "./utils/pageUtils";
|
||||||
import { keybindEquals } from "./utils/configUtils";
|
import { isSafari, keybindEquals } from "./utils/configUtils";
|
||||||
import { CategoryPill } from "./render/CategoryPill";
|
import { CategoryPill } from "./render/CategoryPill";
|
||||||
import { AnimationUtils } from "./utils/animationUtils";
|
import { AnimationUtils } from "./utils/animationUtils";
|
||||||
import { GenericUtils } from "./utils/genericUtils";
|
import { GenericUtils } from "./utils/genericUtils";
|
||||||
@@ -529,7 +529,7 @@ function startSponsorSchedule(includeIntersectingSegments = false, currentTime?:
|
|||||||
skippingFunction();
|
skippingFunction();
|
||||||
} else {
|
} else {
|
||||||
const delayTime = timeUntilSponsor * 1000 * (1 / video.playbackRate);
|
const delayTime = timeUntilSponsor * 1000 * (1 / video.playbackRate);
|
||||||
if (delayTime < 300 && utils.isFirefox()) {
|
if (delayTime < 300 && utils.isFirefox() && !isSafari()) {
|
||||||
// For Firefox, use interval instead of timeout near the end to combat imprecise video time
|
// For Firefox, use interval instead of timeout near the end to combat imprecise video time
|
||||||
const startIntervalTime = performance.now();
|
const startIntervalTime = performance.now();
|
||||||
const startVideoTime = video.currentTime;
|
const startVideoTime = video.currentTime;
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ export function showDonationLink(): boolean {
|
|||||||
return navigator.vendor !== "Apple Computer, Inc." && Config.config.showDonationLink;
|
return navigator.vendor !== "Apple Computer, Inc." && Config.config.showDonationLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isSafari(): boolean {
|
||||||
|
return navigator.vendor === "Apple Computer, Inc.";
|
||||||
|
}
|
||||||
|
|
||||||
export function keybindEquals(first: Keybind, second: Keybind): boolean {
|
export function keybindEquals(first: Keybind, second: Keybind): boolean {
|
||||||
if (first == null || second == null ||
|
if (first == null || second == null ||
|
||||||
Boolean(first.alt) != Boolean(second.alt) || Boolean(first.ctrl) != Boolean(second.ctrl) || Boolean(first.shift) != Boolean(second.shift) ||
|
Boolean(first.alt) != Boolean(second.alt) || Boolean(first.ctrl) != Boolean(second.ctrl) || Boolean(first.shift) != Boolean(second.shift) ||
|
||||||
|
|||||||
Reference in New Issue
Block a user