async function fetchTools() { try { const response = await fetch('tools.json'); if (!response.ok) { throw new Error("VPS response is bad"); } const tools = await response.json(); return tools; } catch (error) { console.error("Failed to fetch tools:", error); return []; }; }; function renderTools(filteredTools) { const toolList = document.getElementById('toolsMain'); toolList.innerHTML = ""; if (filteredTools.length === 0) { toolList.innerHTML = "
No tools match the selected filter.
" return; } filteredTools.sort((a, b) => b.description - a.description); filteredTools.forEach(tool => { const toolItem = document.createElement("div"); toolItem.className = "tool-div"; toolItem.innerHTML = `

↬ ${tool.name} ↫

${tool.subheader}

${tool.description}

${tool.name} Image Visit "${tool.name}"! `; toolList.appendChild(toolItem); }); }; async function filterTools(filterType) { const tools = await fetchTools(); let filteredTools; if (filterType) { filteredTools = tools; } renderTools(filteredTools); } filterTools('all');