`,`{ while(true){ let start = html.indexOf(tag[0]); let end = html.indexOf(tag[1]) + tag[1].length; if( start < 0 || end < 0 || start === end){ break; } html = html.replaceAll( html.substring(start,end), "") } }) return html; } function loadAllContent(links) { // links = [ // "https://www.servbhs.org/programs-services/clifton-community-behavioral-health-center.html", // "https://www.servbhs.org/media-from-serv/covid-19-updates/377-serv-s-covid-19-preparedness-plan.html" // ]; links.forEach((link) => { let url = new URL(link); if(url && url.pathname){ url = url.pathname; }else { url = link; } fetch(url).then((res) => res.text()).then((html) => strToHtml(html, link)).then((content)=>{ addToSearch(content) }) }) } function loadXML() { fetch("/sitemap.xml").then(res => res.text()).then(txt => { const parser = new DOMParser(); const xmlDoc = parser.parseFromString(txt,"text/xml"); const links = Array.from(xmlDoc.querySelectorAll("url")).map(e => e.querySelector("loc").innerHTML).filter(txt => txt.includes('.html')); loadAllContent(links); }) } function createNode(obj) { let html = `
${obj.body.replaceAll(" ", "").slice(0, 500)}
No search results could be found for query: ${searchval}.