mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 20:47:11 +03:00
Added reset button to text change.
This commit is contained in:
@@ -402,10 +402,16 @@
|
|||||||
"customServerAddressDescription": {
|
"customServerAddressDescription": {
|
||||||
"message": "The address SponsorBlock uses to make calls to the server.\nUnless you have your own server instance, this should not be changed."
|
"message": "The address SponsorBlock uses to make calls to the server.\nUnless you have your own server instance, this should not be changed."
|
||||||
},
|
},
|
||||||
"saveCustomServerAddress": {
|
"save": {
|
||||||
"message": "Save"
|
"message": "Save"
|
||||||
},
|
},
|
||||||
|
"reset": {
|
||||||
|
"message": "Reset"
|
||||||
|
},
|
||||||
"customAddressError": {
|
"customAddressError": {
|
||||||
"message": "This address is not in the right form. Make sure you have http:// or https:// at the begining and no slashes or sub-folders at the end."
|
"message": "This address is not in the right form. Make sure you have http:// or https:// at the begining and no slashes or sub-folders at the end."
|
||||||
|
},
|
||||||
|
"areYouSureReset": {
|
||||||
|
"message": "Are you sure you would like to reset this?"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -282,7 +282,11 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="option-button text-change-set inline">
|
<div class="option-button text-change-set inline">
|
||||||
__MSG_saveCustomServerAddress__
|
__MSG_save__
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="option-button text-change-reset inline">
|
||||||
|
__MSG_reset__
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|||||||
@@ -56,20 +56,20 @@ async function init() {
|
|||||||
break;
|
break;
|
||||||
case "text-change":
|
case "text-change":
|
||||||
let textChangeOption = optionsElements[i].getAttribute("sync-option");
|
let textChangeOption = optionsElements[i].getAttribute("sync-option");
|
||||||
let textInput = <HTMLInputElement> optionsElements[i].querySelector(".option-text-box");
|
let textChangeInput = <HTMLInputElement> optionsElements[i].querySelector(".option-text-box");
|
||||||
|
|
||||||
let setButton = <HTMLElement> optionsElements[i].querySelector(".text-change-set");
|
let textChangeSetButton = <HTMLElement> optionsElements[i].querySelector(".text-change-set");
|
||||||
|
|
||||||
textInput.value = Config.config[textChangeOption];
|
textChangeInput.value = Config.config[textChangeOption];
|
||||||
|
|
||||||
setButton.addEventListener("click", () => {
|
textChangeSetButton.addEventListener("click", () => {
|
||||||
// See if anything extra must be done
|
// See if anything extra must be done
|
||||||
switch (textChangeOption) {
|
switch (textChangeOption) {
|
||||||
case "serverAddress":
|
case "serverAddress":
|
||||||
let result = validateServerAddress(textInput.value);
|
let result = validateServerAddress(textChangeInput.value);
|
||||||
|
|
||||||
if (result !== null) {
|
if (result !== null) {
|
||||||
textInput.value = result;
|
textChangeInput.value = result;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -77,9 +77,19 @@ async function init() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Config.config[textChangeOption] = textInput.value;
|
Config.config[textChangeOption] = textChangeInput.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Reset to the default if needed
|
||||||
|
let textChangeResetButton = <HTMLElement> optionsElements[i].querySelector(".text-change-reset");
|
||||||
|
textChangeResetButton.addEventListener("click", () => {
|
||||||
|
if (!confirm(chrome.i18n.getMessage("areYouSureReset"))) return;
|
||||||
|
|
||||||
|
Config.config[textChangeOption] = Config.defaults[textChangeOption];
|
||||||
|
|
||||||
|
textChangeInput.value = Config.config[textChangeOption];
|
||||||
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "private-text-change":
|
case "private-text-change":
|
||||||
let button = optionsElements[i].querySelector(".trigger-button");
|
let button = optionsElements[i].querySelector(".trigger-button");
|
||||||
|
|||||||
Reference in New Issue
Block a user