1010}-->
1111.text-highlight-nodes text{
1212 opacity: 1 !important;
13- stroke-width: 10;
14- font-size: 20px;
13+ stroke-width: 2;
1514 font-weight: bold;
1615 fill: black;
1716}
1817.text-highlight-edges text{
1918 opacity: 1 !important;
20- stroke-width: 10;
21- font-size: 20px;
19+ stroke-width: 2;
2220 font-weight: bold;
2321 fill: Indigo;
2422}
2523.edge-highlight path{
2624 opacity: 1;
27- stroke-width: 10 ;
25+ stroke-width: 2 ;
2826 stroke: crimson;
2927}
3028.edge-highlight polygon{
3129 opacity: 1;
32- stroke-width: 10 ;
30+ stroke-width: 2 ;
3331 stroke: crimson;
3432}
3533.node-highlight polygon{
3634 opacity: 1;
37- stroke-width: 10 ;
35+ stroke-width: 2 ;
3836 stroke: crimson;
3937 z-index:99999;
4038}
4139.node-highlight ellipse{
4240 opacity: 1;
43- stroke-width: 10 ;
41+ stroke-width: 2 ;
4442 stroke: crimson;
4543 z-index:99999;
4644}
4745.node-highlight path{
4846 opacity: 1;
49- stroke-width: 10 ;
47+ stroke-width: 2 ;
5048 stroke: crimson;
5149 z-index:99999;
5250}
7169 }
7270</style>
7371<script>
74- <![CDATA[
72+ // <![CDATA[
7573function addInteractivity(evt) {
7674
7775 var svg = evt.target;
@@ -172,13 +170,13 @@ function addInteractivity(evt) {
172170 }
173171 }
174172 }
175- function clickNode() {
173+ function clickNode(event ) {
176174 if (nodrag) {
177175 var nodeName = this.childNodes[1].textContent;
178176 // Escape special characters in the node name
179177 var nodeNameEscaped = nodeName.replace(/[-[\]{}()*+!<=:?.\/\\^$|#\s,]/g, '\\$&');
180178
181- var patroon = new RegExp('^' + nodeNameEscaped + '->|->' + nodeNameEscaped + '$| ' + nodeNameEscaped + '--|--' + nodeNameEscaped + '$')
179+ var patroon = new RegExp('^' + nodeNameEscaped + '(:\\w+)* ->|->' + nodeNameEscaped + '(:\\w+)*$|^ ' + nodeNameEscaped + '(:\\w+)* --|--' + nodeNameEscaped + '(:\\w+)* $')
182180
183181 if (this.classList.contains("node-highlight")) {
184182 this.classList.remove("node-highlight");
@@ -202,31 +200,38 @@ function clickNode() {
202200 }
203201 }
204202 }
203+ // Prevent opening a possible URL attached to the node
204+ // Note that the URL can still be opened with browser contextual menu (right-click)
205+ event.preventDefault()
205206 }
206207}
207208function animateEdge(edge){
208- var path = edge.querySelector('path');
209- var polygon = edge.querySelector('polygon');
210- var length = path.getTotalLength();
211- // Clear any previous transition
212- path.style.transition = path.style.WebkitTransition = 'none';
213- if (polygon){polygon.style.transition = polygon.style.WebkitTransition = 'none';};
214- // Set up the starting positions
215- path.style.strokeDasharray = length + ' ' + length;
216- path.style.strokeDashoffset = length;
217- if(polygon){polygon.style.opacity='0';};
218- // Trigger a layout so styles are calculated & the browser
219- // picks up the starting position before animating
220- path.getBoundingClientRect();
221- // Define our transition
222- path.style.transition = path.style.WebkitTransition =
223- 'stroke-dashoffset 2s ease-in-out';
224- if (polygon){polygon.style.transition = polygon.style.WebkitTransition =
225- 'fill-opacity 1s ease-in-out 2s';};
226- // Go!
227- path.style.strokeDashoffset = '0';
228- if (polygon){setTimeout(function(){polygon.style.opacity='1';},2000)};
229- }
209+ let pathList = edge.querySelectorAll('path');
210+ for (let i = 0; i < pathList.length; i++) {
211+ let path = pathList[i];
212+ let length = path.getTotalLength();
213+ // Clear any previous transition
214+ path.style.transition = path.style.WebkitTransition = 'none';
215+ // Set up the starting positions
216+ path.style.strokeDasharray = length + ' ' + length;
217+ path.style.strokeDashoffset = length;
218+ // Trigger a layout so styles are calculated & the browser
219+ // picks up the starting position before animating
220+ path.getBoundingClientRect();
221+ // Define our transition
222+ path.style.transition = path.style.WebkitTransition = 'stroke-dashoffset 2s ease-in-out';
223+ path.style.strokeDashoffset = '0';
224+ }
225+ let polygonList = edge.querySelectorAll('polygon');
226+ for (let i = 0; i < polygonList.length; i++) {
227+ let polygon = polygonList[i];
228+ polygon.style.transition = polygon.style.WebkitTransition = 'none';
229+ polygon.style.opacity='0';
230+ polygon.style.transition = polygon.style.WebkitTransition = 'fill-opacity 1s ease-in-out 2s';
231+ setTimeout(function(){polygon.style.opacity='1';},2000)
232+ }
233+ }
234+
230235 function addzoomers(cluster){
231236
232237 var bb = cluster.getBBox();
@@ -593,5 +598,5 @@ function adjustViewBox(svg) {
593598 var newViewBox = viewBoxParts[0] + " " + newYMin + " " + newXMax + " " + newYMax;
594599 svg.setAttribute("viewBox", newViewBox);
595600}
596- ]]>
601+ // ]]>
597602</script>
0 commit comments