mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
Added instance display
This commit is contained in:
@@ -371,5 +371,11 @@
|
|||||||
},
|
},
|
||||||
"resetInvidiousInstanceAlert": {
|
"resetInvidiousInstanceAlert": {
|
||||||
"message": "You are about to reset the Invidious instance list?"
|
"message": "You are about to reset the Invidious instance list?"
|
||||||
|
},
|
||||||
|
"noInstancesAdded": {
|
||||||
|
"message": "No extra instances added yet"
|
||||||
|
},
|
||||||
|
"currentInstances": {
|
||||||
|
"message": "Current Instances:"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,12 @@
|
|||||||
<div class="option-button invidious-instance-reset inline">
|
<div class="option-button invidious-instance-reset inline">
|
||||||
__MSG_resetInvidiousInstance__
|
__MSG_resetInvidiousInstance__
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<span class="small-description">__MSG_currentInstances__</span>
|
||||||
|
<span class="small-description" option-type="display" sync-option="invidiousInstances"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ async function init() {
|
|||||||
|
|
||||||
// Set all of the toggle options to the correct option
|
// Set all of the toggle options to the correct option
|
||||||
let optionsContainer = document.getElementById("options");
|
let optionsContainer = document.getElementById("options");
|
||||||
let optionsElements = optionsContainer.children;
|
let optionsElements = optionsContainer.querySelectorAll("*");
|
||||||
|
|
||||||
for (let i = 0; i < optionsElements.length; i++) {
|
for (let i = 0; i < optionsElements.length; i++) {
|
||||||
switch (optionsElements[i].getAttribute("option-type")) {
|
switch (optionsElements[i].getAttribute("option-type")) {
|
||||||
@@ -60,6 +60,23 @@ async function init() {
|
|||||||
let keybindButton = optionsElements[i].querySelector(".trigger-button");
|
let keybindButton = optionsElements[i].querySelector(".trigger-button");
|
||||||
keybindButton.addEventListener("click", () => activateKeybindChange(optionsElements[i]));
|
keybindButton.addEventListener("click", () => activateKeybindChange(optionsElements[i]));
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "display":
|
||||||
|
let displayOption = optionsElements[i].getAttribute("sync-option")
|
||||||
|
let displayText = SB.config[displayOption];
|
||||||
|
optionsElements[i].innerText = displayText;
|
||||||
|
|
||||||
|
// See if anything extra must be run
|
||||||
|
switch (displayOption) {
|
||||||
|
case "invidiousInstances":
|
||||||
|
if (!displayText || displayText.length == 0) {
|
||||||
|
optionsElements[i].innerText = chrome.i18n.getMessage("noInstancesAdded");
|
||||||
|
} else {
|
||||||
|
optionsElements[i].innerText = displayText.join(', ');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -266,8 +283,6 @@ function activateTextChange(element) {
|
|||||||
|
|
||||||
SB.config[option].push(textBox.value);
|
SB.config[option].push(textBox.value);
|
||||||
|
|
||||||
SB.config[option] = SB.config[option];
|
|
||||||
|
|
||||||
let checkbox = document.querySelector("#support-invidious input");
|
let checkbox = document.querySelector("#support-invidious input");
|
||||||
checkbox.checked = true;
|
checkbox.checked = true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user