mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
Rename string change option to more fitting name.
This commit is contained in:
@@ -76,7 +76,7 @@ body {
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.string-container {
|
.text-label-container {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -248,7 +248,7 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<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">
|
<div class="option-button trigger-button">
|
||||||
__MSG_changeUserID__
|
__MSG_changeUserID__
|
||||||
</div>
|
</div>
|
||||||
@@ -274,13 +274,15 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<div option-type="string-change" sync-option="serverAddress">
|
<div option-type="text-change" sync-option="serverAddress">
|
||||||
<label class="string-container">
|
<label class="text-label-container">
|
||||||
<div>__MSG_customServerAddress__</div>
|
<div>__MSG_customServerAddress__</div>
|
||||||
<input class="option-text-box" type="text">
|
|
||||||
|
<input class="option-text-box" type="text">
|
||||||
</label>
|
</label>
|
||||||
<div class="option-button custom-server-address-button inline">
|
|
||||||
__MSG_saveCustomServerAddress__
|
<div class="option-button text-change-set inline">
|
||||||
|
__MSG_saveCustomServerAddress__
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|||||||
@@ -55,28 +55,29 @@ async function init() {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "text-change":
|
case "text-change":
|
||||||
let button = optionsElements[i].querySelector(".trigger-button");
|
|
||||||
button.addEventListener("click", () => activateTextChange(<HTMLElement> optionsElements[i]));
|
|
||||||
|
|
||||||
let textChangeOption = optionsElements[i].getAttribute("sync-option");
|
let textChangeOption = optionsElements[i].getAttribute("sync-option");
|
||||||
// See if anything extra must be done
|
let textInput = <HTMLInputElement> optionsElements[i].querySelector(".option-text-box");
|
||||||
switch (textChangeOption) {
|
|
||||||
case "invidiousInstances":
|
let setButton = <HTMLElement> optionsElements[i].querySelector(".text-change-set");
|
||||||
invidiousInstanceAddInit(<HTMLElement> optionsElements[i], textChangeOption);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
textInput.value = Config.config[textChangeOption];
|
||||||
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");
|
|
||||||
|
|
||||||
stringInput.value = Config.config[stringChangeOption];
|
setButton.addEventListener("click", () => {
|
||||||
|
Config.config[textChangeOption] = textInput.value;
|
||||||
saveButton.addEventListener("click", () => {
|
|
||||||
setStringConfigOption(stringInput.value, stringChangeOption);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
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;
|
break;
|
||||||
case "keybind-change":
|
case "keybind-change":
|
||||||
let keybindButton = optionsElements[i].querySelector(".trigger-button");
|
let keybindButton = optionsElements[i].querySelector(".trigger-button");
|
||||||
@@ -110,16 +111,6 @@ async function init() {
|
|||||||
optionsContainer.classList.add("animated");
|
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
|
* Called when the config is updated
|
||||||
*
|
*
|
||||||
@@ -305,7 +296,7 @@ function keybindKeyPressed(element: HTMLElement, e: KeyboardEvent) {
|
|||||||
*
|
*
|
||||||
* @param element
|
* @param element
|
||||||
*/
|
*/
|
||||||
function activateTextChange(element: HTMLElement) {
|
function activatePrivateTextChange(element: HTMLElement) {
|
||||||
let button = element.querySelector(".trigger-button");
|
let button = element.querySelector(".trigger-button");
|
||||||
if (button.classList.contains("disabled")) return;
|
if (button.classList.contains("disabled")) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user