Aiden Bai
2022-05-03 aaed5dc1f1849a54869743596a6133548e83392d
assets/js/graph.js
@@ -1,5 +1,4 @@
async function drawGraph(
  url,
  baseUrl,
  pathColors,
  depth,
@@ -8,9 +7,13 @@
  enableZoom
) {
  const container = document.getElementById('graph-container')
  const { index, links, content } = await fetchData
  const curPage = url.replace(baseUrl, '')
  const rawUrl = new URL(window.location.href);
  // Use .pathname to remove hashes / searchParams / text fragments
  const cleanUrl = rawUrl.origin + rawUrl.pathname
  const curPage = cleanUrl.replace(/\/$/g, "").replace(baseUrl, "")
  const parseIdsFromLinks = (links) => [
    ...new Set(links.flatMap((link) => [link.source, link.target])),