Jacky Zhao
2022-04-28 c8d390dbc5a749af533f1ec05de2d5b6f37fa156
assets/js/graph.js
@@ -127,9 +127,9 @@
    .attr("fill", color)
    .style("cursor", "pointer")
    .on("click", (_, d) => {
      window.location.href = baseUrl + '/' + decodeURI(d.id).replace(/\s+/g, '-')
      window.location.href = `${baseUrl}/${decodeURI(d.id).replace(/\s+/g, '-')}/`
    })
    .on("mouseover", function (_, d) {
    .on("mouseover", function(_, d) {
      d3.selectAll(".node")
        .transition()
        .duration(100)
@@ -159,7 +159,7 @@
        .transition()
        .duration(200)
        .style("opacity", 1)
    }).on("mouseleave", function (_, d) {
    }).on("mouseleave", function(_, d) {
      d3.selectAll(".node")
        .transition()
        .duration(200)
@@ -185,7 +185,7 @@
  const labels = graphNode.append("text")
    .attr("dx", 12)
    .attr("dy", ".35em")
    .text((d) => content[decodeURI(d.id).replace(/\s+/g, '-')]?.title || "Untitled")
    .text((d) => content[d.id]?.title || d.id.replace("-", " "))
    .style("opacity", 0)
    .style("pointer-events", "none")
    .call(drag(simulation));