add update instance button
This commit is contained in:
parent
0d39f871c1
commit
cf68ac848f
@ -235,6 +235,9 @@
|
||||
<section class="settings-block"></section>
|
||||
|
||||
<footer>
|
||||
<a class="button" id="update-instances">
|
||||
<span data-localise="__MSG_updateInstances__">Update Instances </span>
|
||||
</a>
|
||||
<a class="button" id="more-options">
|
||||
<span data-localise="__MSG_moreOptions__">More Options </span>
|
||||
<svg
|
||||
|
@ -78,6 +78,20 @@ disableScribe.addEventListener("change", (event) => {
|
||||
browser.storage.sync.set({ disableScribe: !event.target.checked });
|
||||
});
|
||||
|
||||
const apiEndpoint = 'https://raw.githubusercontent.com/libredirect/instances/main/data.json';
|
||||
|
||||
document.querySelector("#update-instances").addEventListener("click", () => {
|
||||
let request = new XMLHttpRequest();
|
||||
request.open('GET', apiEndpoint, false);
|
||||
request.send(null);
|
||||
|
||||
if (request.status === 200) {
|
||||
document.querySelector("#update-instances").innerHTML = 'gav';
|
||||
const instances = JSON.parse(request.responseText);
|
||||
document.querySelector("#update-instances").innerHTML = instances.twitter.length;
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector("#more-options").addEventListener("click", () => {
|
||||
browser.runtime.openOptionsPage();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user