diff --git a/public/js/arf.js b/public/js/arf.js index 567eb18..641deff 100644 --- a/public/js/arf.js +++ b/public/js/arf.js @@ -78,12 +78,14 @@ function update(source) { return d._children ? "lightsteelblue" : "#fff"; }); - nodeEnter + var nameLink = nodeEnter .append("a") .attr("target", "_blank") .attr("xlink:href", function (d) { return d.url; - }) + }); + + nameLink .append("svg:text") .attr("x", function (d) { return d.children || d._children ? -10 : 10; @@ -95,38 +97,34 @@ function update(source) { .text(function (d) { return d.name; }) - .style("fill: rgb(0, 0, 0)", function (d) { + .style("fill", function (d) { return d.free ? "black" : "#999"; }) .style("fill-opacity", 1e-6); + // Add Notes link for leaf nodes only nodeEnter .filter(function (d) { return !d.children && !d._children; - }) // Only leaf nodes + }) .append("a") .attr("target", "_blank") .attr("xlink:href", function (d) { - // Assuming your notes are in a "notes" folder with filename based on node name return ( - "https://git.hackinpovo.it/HackInPovo/resources/src/branch/main/Notes/" + + "https://git.hackinpovo.it/HackInPovo/resources/raw/branch/main/Notes/" + d.name + ".txt" ); - // Or if you have a specific property: return d.notesUrl; }) .append("svg:text") - .attr("x", function (d) { - // Position to the right of the node name - // Adjust the offset (60) based on your node name lengths - return 10 + 60; - }) + .attr("x", 80) // Fixed position - adjust this number as needed .attr("dy", ".35em") .attr("text-anchor", "start") - .text(" [Notes]") + .text("[Notes]") .style("fill", "blue") .style("fill-opacity", 1e-6) .style("text-decoration", "underline"); + // END OF NEW CODE nodeEnter.append("svg:title").text(function (d) { return d.description;