mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 21:17:20 +03:00
Allow not counting time in private tabs
Closes https://github.com/ajayyy/SponsorBlock/issues/703
This commit is contained in:
@@ -200,6 +200,9 @@
|
|||||||
"whatViewTracking": {
|
"whatViewTracking": {
|
||||||
"message": "This feature tracks which segments you have skipped to let users know how much their submission has helped others and used as a metric along with upvotes to ensure that spam doesn't get into the database. The extension sends a message to the server each time you skip a segment. Hopefully most people don't change this setting so that the view numbers are accurate. :)"
|
"message": "This feature tracks which segments you have skipped to let users know how much their submission has helped others and used as a metric along with upvotes to ensure that spam doesn't get into the database. The extension sends a message to the server each time you skip a segment. Hopefully most people don't change this setting so that the view numbers are accurate. :)"
|
||||||
},
|
},
|
||||||
|
"enableViewTrackingInPrivate": {
|
||||||
|
"message": "Enable Skip Count Tracking In Private/Incognito tabs"
|
||||||
|
},
|
||||||
"enableQueryByHashPrefix": {
|
"enableQueryByHashPrefix": {
|
||||||
"message": "Query By Hash Prefix"
|
"message": "Query By Hash Prefix"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -310,6 +310,19 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
<div option-type="toggle" sync-option="trackViewCountInPrivate" private-mode-only="true">
|
||||||
|
<label class="switch-container" label-name="__MSG_enableViewTrackingInPrivate__">
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" checked>
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div option-type="toggle" sync-option="refetchWhenNotFound">
|
<div option-type="toggle" sync-option="refetchWhenNotFound">
|
||||||
<label class="switch-container" label-name="__MSG_enableRefetchWhenNotFound__">
|
<label class="switch-container" label-name="__MSG_enableRefetchWhenNotFound__">
|
||||||
<label class="switch">
|
<label class="switch">
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ interface SBConfig {
|
|||||||
showTimeWithSkips: boolean,
|
showTimeWithSkips: boolean,
|
||||||
disableSkipping: boolean,
|
disableSkipping: boolean,
|
||||||
trackViewCount: boolean,
|
trackViewCount: boolean,
|
||||||
|
trackViewCountInPrivate: boolean,
|
||||||
dontShowNotice: boolean,
|
dontShowNotice: boolean,
|
||||||
hideVideoPlayerControls: boolean,
|
hideVideoPlayerControls: boolean,
|
||||||
hideInfoButtonPlayerControls: boolean,
|
hideInfoButtonPlayerControls: boolean,
|
||||||
@@ -154,6 +155,7 @@ const Config: SBObject = {
|
|||||||
showTimeWithSkips: true,
|
showTimeWithSkips: true,
|
||||||
disableSkipping: false,
|
disableSkipping: false,
|
||||||
trackViewCount: true,
|
trackViewCount: true,
|
||||||
|
trackViewCountInPrivate: true,
|
||||||
dontShowNotice: false,
|
dontShowNotice: false,
|
||||||
hideVideoPlayerControls: false,
|
hideVideoPlayerControls: false,
|
||||||
hideInfoButtonPlayerControls: false,
|
hideInfoButtonPlayerControls: false,
|
||||||
|
|||||||
@@ -987,8 +987,8 @@ function previewTime(time: number, unpause = true) {
|
|||||||
|
|
||||||
//send telemetry and count skip
|
//send telemetry and count skip
|
||||||
function sendTelemetryAndCount(skippingSegments: SponsorTime[], secondsSkipped: number, fullSkip: boolean) {
|
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;
|
let counted = false;
|
||||||
for (const segment of skippingSegments) {
|
for (const segment of skippingSegments) {
|
||||||
const index = sponsorTimes.indexOf(segment);
|
const index = sponsorTimes.indexOf(segment);
|
||||||
|
|||||||
@@ -31,6 +31,11 @@ async function init() {
|
|||||||
const optionsElements = optionsContainer.querySelectorAll("*");
|
const optionsElements = optionsContainer.querySelectorAll("*");
|
||||||
|
|
||||||
for (let i = 0; i < optionsElements.length; i++) {
|
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")) {
|
switch (optionsElements[i].getAttribute("option-type")) {
|
||||||
case "toggle": {
|
case "toggle": {
|
||||||
const option = optionsElements[i].getAttribute("sync-option");
|
const option = optionsElements[i].getAttribute("sync-option");
|
||||||
@@ -540,3 +545,7 @@ function copyDebugOutputToClipboard() {
|
|||||||
alert(chrome.i18n.getMessage("copyDebugInformationFailed"));
|
alert(chrome.i18n.getMessage("copyDebugInformationFailed"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isIncognitoAllowed(): Promise<boolean> {
|
||||||
|
return new Promise((resolve) => chrome.extension.isAllowedIncognitoAccess(resolve));
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user