mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 14:37:23 +03:00
Rename string change option to more fitting name.
This commit is contained in:
@@ -76,7 +76,7 @@ body {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.string-container {
|
||||
.text-label-container {
|
||||
font-size: 14px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div option-type="text-change" sync-option="userID" confirm-message="userIDChangeWarning">
|
||||
<div option-type="private-text-change" sync-option="userID" confirm-message="userIDChangeWarning">
|
||||
<div class="option-button trigger-button">
|
||||
__MSG_changeUserID__
|
||||
</div>
|
||||
@@ -274,12 +274,14 @@
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<div option-type="string-change" sync-option="serverAddress">
|
||||
<label class="string-container">
|
||||
<div option-type="text-change" sync-option="serverAddress">
|
||||
<label class="text-label-container">
|
||||
<div>__MSG_customServerAddress__</div>
|
||||
|
||||
<input class="option-text-box" type="text">
|
||||
</label>
|
||||
<div class="option-button custom-server-address-button inline">
|
||||
|
||||
<div class="option-button text-change-set inline">
|
||||
__MSG_saveCustomServerAddress__
|
||||
</div>
|
||||
|
||||
|
||||
@@ -55,27 +55,28 @@ 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");
|
||||
|
||||
textInput.value = Config.config[textChangeOption];
|
||||
|
||||
setButton.addEventListener("click", () => {
|
||||
Config.config[textChangeOption] = textInput.value;
|
||||
});
|
||||
|
||||
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");
|
||||
case "private-text-change":
|
||||
let button = optionsElements[i].querySelector(".trigger-button");
|
||||
button.addEventListener("click", () => activatePrivateTextChange(<HTMLElement> optionsElements[i]));
|
||||
|
||||
stringInput.value = Config.config[stringChangeOption];
|
||||
|
||||
saveButton.addEventListener("click", () => {
|
||||
setStringConfigOption(stringInput.value, stringChangeOption);
|
||||
});
|
||||
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":
|
||||
@@ -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