diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/config.ts | 2 | ||||
-rw-r--r-- | src/content.ts | 4 | ||||
-rw-r--r-- | src/options.ts | 9 |
3 files changed, 13 insertions, 2 deletions
diff --git a/src/config.ts b/src/config.ts index a80d667d..5cb58a2a 100644 --- a/src/config.ts +++ b/src/config.ts @@ -21,6 +21,7 @@ interface SBConfig { showTimeWithSkips: boolean, disableSkipping: boolean, trackViewCount: boolean, + trackViewCountInPrivate: boolean, dontShowNotice: boolean, hideVideoPlayerControls: boolean, hideInfoButtonPlayerControls: boolean, @@ -154,6 +155,7 @@ const Config: SBObject = { showTimeWithSkips: true, disableSkipping: false, trackViewCount: true, + trackViewCountInPrivate: true, dontShowNotice: false, hideVideoPlayerControls: false, hideInfoButtonPlayerControls: false, diff --git a/src/content.ts b/src/content.ts index ac517c72..c65ff20e 100644 --- a/src/content.ts +++ b/src/content.ts @@ -987,8 +987,8 @@ function previewTime(time: number, unpause = true) { //send telemetry and count skip function sendTelemetryAndCount(skippingSegments: SponsorTime[], secondsSkipped: number, fullSkip: boolean) { - if (!Config.config.trackViewCount) return; - + if (!Config.config.trackViewCount || (!Config.config.trackViewCountInPrivate && chrome.extension.inIncognitoContext)) return; + let counted = false; for (const segment of skippingSegments) { const index = sponsorTimes.indexOf(segment); diff --git a/src/options.ts b/src/options.ts index 815aff02..20a5d244 100644 --- a/src/options.ts +++ b/src/options.ts @@ -31,6 +31,11 @@ async function init() { const optionsElements = optionsContainer.querySelectorAll("*"); for (let i = 0; i < optionsElements.length; i++) { + if (optionsElements[i].getAttribute("private-mode-only") === "true" && !(await isIncognitoAllowed())) { + optionsElements[i].classList.add("hidden"); + continue; + } + switch (optionsElements[i].getAttribute("option-type")) { case "toggle": { const option = optionsElements[i].getAttribute("sync-option"); @@ -540,3 +545,7 @@ function copyDebugOutputToClipboard() { alert(chrome.i18n.getMessage("copyDebugInformationFailed")); }); } + +function isIncognitoAllowed(): Promise<boolean> { + return new Promise((resolve) => chrome.extension.isAllowedIncognitoAccess(resolve)); +}
\ No newline at end of file |