mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
Fixed more merging issues.
This commit is contained in:
@@ -41,7 +41,7 @@ async function init() {
|
||||
|
||||
// Add click listener
|
||||
checkbox.addEventListener("click", () => {
|
||||
setOptionValue(option, reverse ? !checkbox.checked : checkbox.checked);
|
||||
SB.config[option] = reverse ? !checkbox.checked : checkbox.checked;
|
||||
|
||||
// See if anything extra must be run
|
||||
switch (option) {
|
||||
@@ -83,7 +83,7 @@ function invidiousInit(checkbox, option) {
|
||||
permissions: permissions
|
||||
}, function (result) {
|
||||
if (result != checkbox.checked) {
|
||||
setOptionValue(option, result);
|
||||
SB.config[option] = result;
|
||||
|
||||
checkbox.checked = result;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ function invidiousOnClick(checkbox, option) {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
setOptionValue(option, false);
|
||||
SB.config[option] = false;
|
||||
checkbox.checked = false;
|
||||
|
||||
chrome.declarativeContent.onPageChanged.removeRules(["invidious"]);
|
||||
@@ -262,17 +262,11 @@ function activateTextChange(element) {
|
||||
// Add this
|
||||
//TODO Make the call to invidiousOnClick support passing the straight extra values, plus make the get not needed
|
||||
//OR merge the config PR and use that
|
||||
let result = await new Promise((resolve, reject) => {
|
||||
chrome.storage.sync.get([option], resolve);
|
||||
});
|
||||
if (!SB.config[option]) SB.config[option] = [];
|
||||
|
||||
if (!result[option]) result[option] = [];
|
||||
SB.config[option].push(textBox.value);
|
||||
|
||||
result[option].push(textBox.value);
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
setOptionValue(option, result[option], resolve);
|
||||
});
|
||||
SB.config[option] = SB.config[option];
|
||||
|
||||
let checkbox = document.querySelector("#support-invidious input");
|
||||
checkbox.checked = true;
|
||||
@@ -290,7 +284,7 @@ function activateTextChange(element) {
|
||||
let resetButton = element.querySelector(".invidious-instance-reset");
|
||||
resetButton.addEventListener("click", function(e) {
|
||||
if (confirm(chrome.i18n.getMessage("resetInvidiousInstanceAlert"))) {
|
||||
setOptionValue(option, []);
|
||||
SB.config[option] = [];
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user