function htmlspecialchars(str){ if(str === null){ return "<Empty>"; } var map = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' } return str.replace(/[&<>"']/g, function(m){return map[m];}); } // initialize garbage var list = []; var pinged_list = []; var reqs = 0; var errors = 0; var sort = 0; // lower ping first // check for instance redirect stuff var redir = ""; var target = "/web?"; new URL(window.location.href) .searchParams .forEach( function(value, key){ if(key == "target"){ target = "/" + encodeURIComponent(value) + "?"; return; } if(key == "npt"){ return; } redir += encodeURIComponent(key) + "=" + encodeURIComponent(value) } ); if(redir != ""){ redir = target + redir; } var quote = document.createElement("div"); quote.className = "quote"; quote.innerHTML = 'Pinged 0 servers (0 failed requests)'; var [div_servercount, div_failedreqs] = quote.getElementsByTagName("b"); var noscript = document.getElementsByTagName("noscript")[0]; document.body.insertBefore(quote, noscript.nextSibling); // create table var table = document.createElement("table"); table.innerHTML = '' + '' + '
Ping' + 'Server' + 'Address' + 'Bot protection' + 'Real reqs (?)' + 'Bot reqs (?)' + 'API' + 'Version' + '' + '' + ''; document.body.insertBefore(table, quote.nextSibling); // handle sorting clicks var tbody = table.getElementsByTagName("tbody")[0]; var th = table.getElementsByTagName("th"); for(var i=0; i'; for(var i=0; i<8; i++){ html += ''; break; } if(sorted_list[k].server.ping <= 200){ html += '>' + sorted_list[k].server.ping + ''; break; } html += '>' + number_format(sorted_list[k].server.ping) + ''; break; // server name case 1: html += ' class="extend">' + htmlspecialchars(sorted_list[k].server.name); break; case 2: html += '>' + htmlspecialchars(new URL(sorted_list[k].server.ip).host); break; case 3: // bot protection switch(sorted_list[k].server.bot_protection){ case 0: html += '>Disabled'; break; case 1: html += '>Image captcha'; break; case 2: html += '>Invite only'; break; default: html += '>Unknown'; } break; case 4: // real reqs html += '>' + number_format(sorted_list[k].server.real_requests); break; case 5: // bot reqs html += '>' + number_format(sorted_list[k].server.bot_requests); break; case 6: // api enabled if(sorted_list[k].server.api_enabled){ html += '>Yes'; }else{ html += '>No'; } break; // version case 7: html += ">v" + sorted_list[k].server.version; break; } html += ''; } html += ''; } tbody.innerHTML = html; } var popup_bg = document.getElementById("popup-bg"); var popup_wrapper = document.getElementsByClassName("popup-wrapper")[0]; var popup = popup_wrapper.getElementsByClassName("popup")[0]; var popup_shown = false; popup_bg.addEventListener("click", function(){ popup_wrapper.style.display = "none"; popup_bg.style.display = "none"; }); function show_server(serverid){ var html = '

' + htmlspecialchars(pinged_list[serverid].server.name) + '

' + 'Description' + '
' + htmlspecialchars(pinged_list[serverid].server.description) + '
'; var url_obj = new URL(pinged_list[serverid].server.ip); var url = htmlspecialchars(url_obj.origin); var domain = url_obj.hostname; html += 'URL: ' + url + ' (IP lookup)' + '

Alt addresses:'; var len = pinged_list[serverid].server.alt_addresses.length; if(len === 0){ html += ' <Empty>'; }else{ html += ''; } popup.innerHTML = html; popup_wrapper.style.display = "block"; popup_bg.style.display = "block"; } function hide_server(){ popup_wrapper.style.display = "none"; popup_bg.style.display = "none"; }