Files
I2P_in_Private_Browsing_Mod…/proxyinfo.js

58 lines
1.8 KiB
JavaScript
Raw Normal View History

2022-10-07 19:32:52 -04:00
fetch('http://proxy.i2p').then(
2022-10-16 14:49:32 -04:00
(myJson) => {
console.warn('(proxyinfo)', myJson);
contentUpdateById('proxy-check', 'proxySuccessStatus');
let readyness = document.querySelectorAll('.readyness');
if (readyness !== null) {
unhide(readyness);
}
},
(error) => {
console.error("(proxyinfo)", error);
contentUpdateById("proxy-check", "proxyFailedStatus");
let readyness = document.querySelectorAll(".readyness");
if (readyness !== null) {
hide(readyness);
}
2022-10-07 11:01:16 -04:00
}
);
function hide(elements) {
2022-10-16 14:49:32 -04:00
elements = elements.length ? elements : [elements];
for (var index = 0; index < elements.length; index++) {
if (elements[index].style !== undefined) {
elements[index].style.display = "none";
}
2022-10-07 11:01:16 -04:00
}
}
function unhide(elements) {
2022-10-16 14:49:32 -04:00
elements = elements.length ? elements : [elements];
for (var index = 0; index < elements.length; index++) {
if (elements[index].style !== undefined) {
elements[index].style.display = "inline-block";
}
2022-10-07 11:01:16 -04:00
}
}
//TODO: Don't hard-code this.
fetch("http://127.0.0.1:7657/themes/console/light/images/i2plogo.png")
2022-10-16 14:49:32 -04:00
.then((myJson) => {
var consoleLinks = document.querySelectorAll(".application-info");
unhide(consoleLinks);
})
.catch((error) => {
var consoleLinks = document.querySelectorAll(".application-info");
hide(consoleLinks);
});
2022-10-07 11:01:16 -04:00
fetch("http://127.0.0.1:7657/jsonrpc/")
2022-10-16 14:49:32 -04:00
.then((myJson) => {
var toopieLinks = document.querySelectorAll(".window-visit-toopie");
unhide(toopieLinks);
})
.catch((error) => {
var toopieLinks = document.querySelectorAll(".window-visit-toopie");
hide(toopieLinks);
});