mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-24 16:38:47 +03:00
Allow not counting time in private tabs
Closes https://github.com/ajayyy/SponsorBlock/issues/703
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
Reference in New Issue
Block a user