mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-13 15:07:02 +03:00
Add option to disable tracking downvotes and clear when disabled
This commit is contained in:
@@ -22,6 +22,7 @@ interface SBConfig {
|
||||
fullVideoSegments: boolean,
|
||||
trackViewCount: boolean,
|
||||
trackViewCountInPrivate: boolean,
|
||||
trackDownvotes: boolean,
|
||||
dontShowNotice: boolean,
|
||||
noticeVisibilityMode: NoticeVisbilityMode,
|
||||
hideVideoPlayerControls: boolean,
|
||||
@@ -138,6 +139,7 @@ const Config: SBObject = {
|
||||
fullVideoSegments: true,
|
||||
trackViewCount: true,
|
||||
trackViewCountInPrivate: true,
|
||||
trackDownvotes: true,
|
||||
dontShowNotice: false,
|
||||
noticeVisibilityMode: NoticeVisbilityMode.FadedForAutoSkip,
|
||||
hideVideoPlayerControls: false,
|
||||
|
||||
@@ -87,6 +87,7 @@ async function init() {
|
||||
const reverse = optionsElements[i].getAttribute("data-toggle-type") === "reverse";
|
||||
|
||||
const confirmMessage = optionsElements[i].getAttribute("data-confirm-message");
|
||||
const confirmOnTrue = optionsElements[i].getAttribute("data-confirm-on") !== "false";
|
||||
|
||||
if (optionResult != undefined)
|
||||
checkbox.checked = reverse ? !optionResult : optionResult;
|
||||
@@ -101,8 +102,9 @@ async function init() {
|
||||
// Add click listener
|
||||
checkbox.addEventListener("click", async () => {
|
||||
// Confirm if required
|
||||
if (checkbox.checked && confirmMessage && !confirm(chrome.i18n.getMessage(confirmMessage))){
|
||||
checkbox.checked = false;
|
||||
if (confirmMessage && ((confirmOnTrue && checkbox.checked) || (!confirmOnTrue && !checkbox.checked))
|
||||
&& !confirm(chrome.i18n.getMessage(confirmMessage))){
|
||||
checkbox.checked = !checkbox.checked;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -135,6 +137,11 @@ async function init() {
|
||||
document.documentElement.setAttribute("data-theme", "light");
|
||||
}
|
||||
break;
|
||||
case "trackDownvotes":
|
||||
if (!checkbox.checked) {
|
||||
Config.local.downvotedSegments = {};
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// If other options depend on this, hide/show them
|
||||
|
||||
@@ -490,8 +490,8 @@ export default class Utils {
|
||||
}
|
||||
|
||||
async addHiddenSegment(videoID: VideoID, segmentUUID: string, hidden: SponsorHideType) {
|
||||
if (chrome.extension.inIncognitoContext) return;
|
||||
|
||||
if (chrome.extension.inIncognitoContext || !Config.config.trackDownvotes) return;
|
||||
|
||||
const hashedVideoID = (await this.getHash(videoID, 1)).slice(0, 4) as VideoID & HashedValue;
|
||||
const UUIDHash = await this.getHash(segmentUUID, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user