underscore fix, fix relative path being weird for graph

hugo
Jacky Zhao 3 years ago
parent 54e3e071d1
commit 57ebf4c21c

@ -11,7 +11,7 @@
} }
</style> </style>
<script> <script>
const curPage = {{ strings.TrimRight "/" .Page.RelPermalink }}.replace({{strings.TrimRight "/" .Site.BaseURL }}, "") const curPage = {{ strings.TrimRight "/" .Page.Permalink }}.replace({{strings.TrimRight "/" .Site.BaseURL }}, "")
const pathColors = {{$.Site.Data.graphConfig.paths}} const pathColors = {{$.Site.Data.graphConfig.paths}}
let depth = {{$.Site.Data.graphConfig.depth}} let depth = {{$.Site.Data.graphConfig.depth}}
@ -143,7 +143,7 @@
.attr("fill", color) .attr("fill", color)
.style("cursor", "pointer") .style("cursor", "pointer")
.on("click", (_, d) => { .on("click", (_, d) => {
window.location.href = {{.Site.BaseURL}} + decodeURI(d.id).replace(/[\s_]+/g, '-') window.location.href = {{.Site.BaseURL}} + decodeURI(d.id).replace(/\s+/g, '-')
}) })
.on("mouseover", function (_, d) { .on("mouseover", function (_, d) {
d3.selectAll(".node") d3.selectAll(".node")
@ -201,7 +201,7 @@
const labels = graphNode.append("text") const labels = graphNode.append("text")
.attr("dx", 12) .attr("dx", 12)
.attr("dy", ".35em") .attr("dy", ".35em")
.text((d) => content[decodeURI(d.id).replace(/[\s_]+/g, '-')]?.title || "Untitled") .text((d) => content[decodeURI(d.id).replace(/\s+/g, '-')]?.title || "Untitled")
.style("opacity", 0) .style("opacity", 0)
.style("pointer-events", "none") .style("pointer-events", "none")
.call(drag(simulation)); .call(drag(simulation));

Loading…
Cancel
Save