function render() { const search = document.querySelector("#meshfilter input"); const page = document.getElementById("meshpage"); const help = document.getElementById("meshpage-help"); const etx = mesh.etx; const hosts = mesh.hosts; const services = mesh.services; let filtering; let cfilter; function filter() { clearTimeout(filtering); filtering = setTimeout(function() { const filter = search.value.toLowerCase(); if (filter === cfilter) { return; } cfilter = filter; const filtered = document.querySelectorAll(".valid"); for (let i = 0; i < filtered.length; i++) { filtered[i].classList.remove("valid"); } if (filter === "") { page.classList.remove("filtering"); } else { page.classList.add("filtering"); const targets = document.querySelectorAll("[data-search]"); for (let i = 0; i < targets.length; i++) { const target = targets[i]; if (target.dataset.search.indexOf(filter) !== -1) { target.classList.add("valid"); } } } }, 200); } search.addEventListener("keyup", filter); search.addEventListener("click", filter); search.addEventListener("keypress", event => event.keyCode == 13 && event.preventDefault()); function serv(ip, hostname) { let view = ""; const s = services[ip]; if (s) { const re = new RegExp(`//${hostname}:`, "i"); for (let i = 0; i < s.length; i++) { let name = s[i].n; const url = s[i].u; if (url.match(re)) { const lname = name.toLowerCase(); let type = ""; const nametype = name.match(/^(.*)\[(.*)\]$/); if (nametype) { name = nametype[1]; type = `
`; } const r = url.match(/^(.+:\/\/)([^:]+):(\d+)(.*)$/); switch (r[3]) { case "0": view += `