forked from I2P_Developers/i2p.i2p
Sidebar: - Adjust vertical spacing of general section - Rename 'General' section to 'Router Info' and move ident info to h3 tooltip (ticket #1996) - Replace 'Short Router Info' with a new 'Advanced Router Info' section in default advanced sidebar (adds memory usage and clock skew) - Add optional embedded bandwidth graph (experimental) - Add optional memory usage bar - Add optional Advanced Peers section (adds failing and banned peers) - Add Help link to 'I2P Internals' section - Add help page anchored links and troubleshooting to 'Help & FAQ' section - Add download progress bar for router and plugin updates - Add 'Advanced Minimal' sidebar configuration - Add Jobs and Events links to Advanced section - Add additional reachability states for clockskew and vmcomm (with icons) Homepage: Add 'Customize Sidebar' link to signpost the feature now that there are more optional sections available (ticket #1996)
51 lines
1.6 KiB
JavaScript
51 lines
1.6 KiB
JavaScript
var fails = 0;
|
|
|
|
function ajax(url, target, refresh) {
|
|
// native XMLHttpRequest object
|
|
if (window.XMLHttpRequest) {
|
|
req = new XMLHttpRequest();
|
|
req.onreadystatechange = function() {ajaxDone(url, target, refresh);};
|
|
req.open("GET", url, true);
|
|
req.send(null);
|
|
// IE/Windows ActiveX version
|
|
} else if (window.ActiveXObject) {
|
|
req = new ActiveXObject("Microsoft.XMLDOM");
|
|
if (req) {
|
|
req.onreadystatechange = function() {ajaxDone(target);};
|
|
req.open("GET", url, true);
|
|
req.send(null);
|
|
}
|
|
}
|
|
}
|
|
|
|
function ajaxDone(url, target, refresh) {
|
|
// only if req is "loaded"
|
|
if (req.readyState == 4) {
|
|
// only if "OK"
|
|
if (req.status == 200) {
|
|
fails = 0;
|
|
results = req.responseText;
|
|
document.getElementById(target).innerHTML = results;
|
|
//document.getElementsbyClassName("hideifdown").style.display="block";
|
|
} else if (fails == 0) {
|
|
// avoid spurious message if cancelled by user action
|
|
fails++;
|
|
} else {
|
|
document.getElementById(target).innerHTML = failMessage;
|
|
//document.getElementByClassName("hideifdown").style.display="none";
|
|
}
|
|
|
|
// conditionally load sidebar refreshGraph script
|
|
var graph = document.getElementById('sb_graphcontainer');
|
|
if (graph) {
|
|
var js_refreshGraph = document.createElement('script');
|
|
js_refreshGraph.type = "text/javascript";
|
|
js_refreshGraph.src = "/js/refreshGraph.js";
|
|
js_refreshGraph.async = true;
|
|
document.getElementsByTagName('head')[0].appendChild(js_refreshGraph);
|
|
}
|
|
|
|
setTimeout(function() {ajax(url, target, refresh);}, refresh);
|
|
}
|
|
}
|