mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-13 06:57:09 +03:00
Rename string change option to more fitting name.
This commit is contained in:
@@ -55,28 +55,29 @@ async function init() {
|
||||
});
|
||||
break;
|
||||
case "text-change":
|
||||
let button = optionsElements[i].querySelector(".trigger-button");
|
||||
button.addEventListener("click", () => activateTextChange(<HTMLElement> optionsElements[i]));
|
||||
|
||||
let textChangeOption = optionsElements[i].getAttribute("sync-option");
|
||||
// See if anything extra must be done
|
||||
switch (textChangeOption) {
|
||||
case "invidiousInstances":
|
||||
invidiousInstanceAddInit(<HTMLElement> optionsElements[i], textChangeOption);
|
||||
}
|
||||
let textInput = <HTMLInputElement> optionsElements[i].querySelector(".option-text-box");
|
||||
|
||||
let setButton = <HTMLElement> optionsElements[i].querySelector(".text-change-set");
|
||||
|
||||
break;
|
||||
case "string-change":
|
||||
let stringChangeOption = optionsElements[i].getAttribute("sync-option");
|
||||
let stringInput = <HTMLInputElement> optionsElements[i].querySelector(".string-container").querySelector(".option-text-box");
|
||||
let saveButton = <HTMLElement> optionsElements[i].querySelector(".option-button");
|
||||
textInput.value = Config.config[textChangeOption];
|
||||
|
||||
stringInput.value = Config.config[stringChangeOption];
|
||||
|
||||
saveButton.addEventListener("click", () => {
|
||||
setStringConfigOption(stringInput.value, stringChangeOption);
|
||||
setButton.addEventListener("click", () => {
|
||||
Config.config[textChangeOption] = textInput.value;
|
||||
});
|
||||
|
||||
break;
|
||||
case "private-text-change":
|
||||
let button = optionsElements[i].querySelector(".trigger-button");
|
||||
button.addEventListener("click", () => activatePrivateTextChange(<HTMLElement> optionsElements[i]));
|
||||
|
||||
let privateTextChangeOption = optionsElements[i].getAttribute("sync-option");
|
||||
// See if anything extra must be done
|
||||
switch (privateTextChangeOption) {
|
||||
case "invidiousInstances":
|
||||
invidiousInstanceAddInit(<HTMLElement> optionsElements[i], privateTextChangeOption);
|
||||
}
|
||||
|
||||
break;
|
||||
case "keybind-change":
|
||||
let keybindButton = optionsElements[i].querySelector(".trigger-button");
|
||||
@@ -110,16 +111,6 @@ async function init() {
|
||||
optionsContainer.classList.add("animated");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value in the string input the the defined config option
|
||||
*
|
||||
* @param element
|
||||
* @param option
|
||||
*/
|
||||
function setStringConfigOption(value: string, option: string) {
|
||||
Config.config[option] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the config is updated
|
||||
*
|
||||
@@ -305,7 +296,7 @@ function keybindKeyPressed(element: HTMLElement, e: KeyboardEvent) {
|
||||
*
|
||||
* @param element
|
||||
*/
|
||||
function activateTextChange(element: HTMLElement) {
|
||||
function activatePrivateTextChange(element: HTMLElement) {
|
||||
let button = element.querySelector(".trigger-button");
|
||||
if (button.classList.contains("disabled")) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user