mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 04:27:15 +03:00
Add option to disable tracking downvotes and clear when disabled
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user