fmt: remove semis :)
This commit is contained in:
		
							parent
							
								
									66304da027
								
							
						
					
					
						commit
						9ba0a4b34f
					
				
					 2 changed files with 29 additions and 29 deletions
				
			
		| 
						 | 
					@ -47,27 +47,27 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const drag = simulation => {
 | 
					  const drag = simulation => {
 | 
				
			||||||
    function dragstarted(event, d) {
 | 
					    function dragstarted(event, d) {
 | 
				
			||||||
      if (!event.active) simulation.alphaTarget(1).restart();
 | 
					      if (!event.active) simulation.alphaTarget(1).restart()
 | 
				
			||||||
      d.fx = d.x;
 | 
					      d.fx = d.x
 | 
				
			||||||
      d.fy = d.y;
 | 
					      d.fy = d.y
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function dragged(event, d) {
 | 
					    function dragged(event, d) {
 | 
				
			||||||
      d.fx = event.x;
 | 
					      d.fx = event.x
 | 
				
			||||||
      d.fy = event.y;
 | 
					      d.fy = event.y
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function dragended(event, d) {
 | 
					    function dragended(event, d) {
 | 
				
			||||||
      if (!event.active) simulation.alphaTarget(0);
 | 
					      if (!event.active) simulation.alphaTarget(0)
 | 
				
			||||||
      d.fx = null;
 | 
					      d.fx = null
 | 
				
			||||||
      d.fy = null;
 | 
					      d.fy = null
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const noop = () => { }
 | 
					    const noop = () => { }
 | 
				
			||||||
    return d3.drag()
 | 
					    return d3.drag()
 | 
				
			||||||
      .on("start", enableDrag ? dragstarted : noop)
 | 
					      .on("start", enableDrag ? dragstarted : noop)
 | 
				
			||||||
      .on("drag", enableDrag ? dragged : noop)
 | 
					      .on("drag", enableDrag ? dragged : noop)
 | 
				
			||||||
      .on("end", enableDrag ? dragended : noop);
 | 
					      .on("end", enableDrag ? dragended : noop)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const height = Math.max(document.getElementById("graph-container").offsetHeight, 250)
 | 
					  const height = Math.max(document.getElementById("graph-container").offsetHeight, 250)
 | 
				
			||||||
| 
						 | 
					@ -76,13 +76,13 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege
 | 
				
			||||||
  const simulation = d3.forceSimulation(data.nodes)
 | 
					  const simulation = d3.forceSimulation(data.nodes)
 | 
				
			||||||
    .force("charge", d3.forceManyBody().strength(-30))
 | 
					    .force("charge", d3.forceManyBody().strength(-30))
 | 
				
			||||||
    .force("link", d3.forceLink(data.links).id(d => d.id).distance(40))
 | 
					    .force("link", d3.forceLink(data.links).id(d => d.id).distance(40))
 | 
				
			||||||
    .force("center", d3.forceCenter());
 | 
					    .force("center", d3.forceCenter())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const svg = d3.select('#graph-container')
 | 
					  const svg = d3.select('#graph-container')
 | 
				
			||||||
    .append('svg')
 | 
					    .append('svg')
 | 
				
			||||||
    .attr('width', width)
 | 
					    .attr('width', width)
 | 
				
			||||||
    .attr('height', height)
 | 
					    .attr('height', height)
 | 
				
			||||||
    .attr("viewBox", [-width / 2, -height / 2, width, height]);
 | 
					    .attr("viewBox", [-width / 2, -height / 2, width, height])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (enableLegend) {
 | 
					  if (enableLegend) {
 | 
				
			||||||
    const legend = [
 | 
					    const legend = [
 | 
				
			||||||
| 
						 | 
					@ -183,7 +183,7 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege
 | 
				
			||||||
        .duration(200)
 | 
					        .duration(200)
 | 
				
			||||||
        .style("opacity", 0)
 | 
					        .style("opacity", 0)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
    .call(drag(simulation));
 | 
					    .call(drag(simulation))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // draw labels
 | 
					  // draw labels
 | 
				
			||||||
  const labels = graphNode.append("text")
 | 
					  const labels = graphNode.append("text")
 | 
				
			||||||
| 
						 | 
					@ -195,7 +195,7 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege
 | 
				
			||||||
    .style("pointer-events", "none")
 | 
					    .style("pointer-events", "none")
 | 
				
			||||||
    .style("font-size", "0.4em")
 | 
					    .style("font-size", "0.4em")
 | 
				
			||||||
    .raise()
 | 
					    .raise()
 | 
				
			||||||
    .call(drag(simulation));
 | 
					    .call(drag(simulation))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // set panning
 | 
					  // set panning
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -204,14 +204,14 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege
 | 
				
			||||||
      .extent([[0, 0], [width, height]])
 | 
					      .extent([[0, 0], [width, height]])
 | 
				
			||||||
      .scaleExtent([0.25, 4])
 | 
					      .scaleExtent([0.25, 4])
 | 
				
			||||||
      .on("zoom", ({ transform }) => {
 | 
					      .on("zoom", ({ transform }) => {
 | 
				
			||||||
        link.attr("transform", transform);
 | 
					        link.attr("transform", transform)
 | 
				
			||||||
        node.attr("transform", transform);
 | 
					        node.attr("transform", transform)
 | 
				
			||||||
        const scale = transform.k
 | 
					        const scale = transform.k
 | 
				
			||||||
        const scaledOpacity = Math.max((scale - 1) / 3.75, 0)
 | 
					        const scaledOpacity = Math.max((scale - 1) / 3.75, 0)
 | 
				
			||||||
        labels
 | 
					        labels
 | 
				
			||||||
          .attr("transform", transform)
 | 
					          .attr("transform", transform)
 | 
				
			||||||
          .style("opacity", scaledOpacity)
 | 
					          .style("opacity", scaledOpacity)
 | 
				
			||||||
      }));
 | 
					      }))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // progress the simulation
 | 
					  // progress the simulation
 | 
				
			||||||
| 
						 | 
					@ -227,5 +227,5 @@ async function drawGraph(url, baseUrl, pathColors, depth, enableDrag, enableLege
 | 
				
			||||||
    labels
 | 
					    labels
 | 
				
			||||||
      .attr("x", d => d.x)
 | 
					      .attr("x", d => d.x)
 | 
				
			||||||
      .attr("y", d => d.y)
 | 
					      .attr("y", d => d.y)
 | 
				
			||||||
  });
 | 
					  })
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,8 +9,8 @@ const removeMarkdown = (
 | 
				
			||||||
    preserveLinks: false,
 | 
					    preserveLinks: false,
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
) => {
 | 
					) => {
 | 
				
			||||||
  let output = markdown || "";
 | 
					  let output = markdown || ""
 | 
				
			||||||
  output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*$/gm, "");
 | 
					  output = output.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*$/gm, "")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
    if (options.stripListLeaders) {
 | 
					    if (options.stripListLeaders) {
 | 
				
			||||||
| 
						 | 
					@ -18,15 +18,15 @@ const removeMarkdown = (
 | 
				
			||||||
        output = output.replace(
 | 
					        output = output.replace(
 | 
				
			||||||
          /^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,
 | 
					          /^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,
 | 
				
			||||||
          options.listUnicodeChar + " $1"
 | 
					          options.listUnicodeChar + " $1"
 | 
				
			||||||
        );
 | 
					        )
 | 
				
			||||||
      else output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1");
 | 
					      else output = output.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (options.gfm) {
 | 
					    if (options.gfm) {
 | 
				
			||||||
      output = output
 | 
					      output = output
 | 
				
			||||||
        .replace(/\n={2,}/g, "\n")
 | 
					        .replace(/\n={2,}/g, "\n")
 | 
				
			||||||
        .replace(/~{3}.*\n/g, "")
 | 
					        .replace(/~{3}.*\n/g, "")
 | 
				
			||||||
        .replace(/~~/g, "")
 | 
					        .replace(/~~/g, "")
 | 
				
			||||||
        .replace(/`{3}.*\n/g, "");
 | 
					        .replace(/`{3}.*\n/g, "")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (options.preserveLinks) {
 | 
					    if (options.preserveLinks) {
 | 
				
			||||||
      output = output.replace(/\[(.*?)\][\[\(](.*?)[\]\)]/g, "$1 ($2)")
 | 
					      output = output.replace(/\[(.*?)\][\[\(](.*?)[\]\)]/g, "$1 ($2)")
 | 
				
			||||||
| 
						 | 
					@ -49,13 +49,13 @@ const removeMarkdown = (
 | 
				
			||||||
      .replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
 | 
					      .replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2")
 | 
				
			||||||
      .replace(/(`{3,})(.*?)\1/gm, "$2")
 | 
					      .replace(/(`{3,})(.*?)\1/gm, "$2")
 | 
				
			||||||
      .replace(/`(.+?)`/g, "$1")
 | 
					      .replace(/`(.+?)`/g, "$1")
 | 
				
			||||||
      .replace(/\n{2,}/g, "\n\n");
 | 
					      .replace(/\n{2,}/g, "\n\n")
 | 
				
			||||||
  } catch (e) {
 | 
					  } catch (e) {
 | 
				
			||||||
    console.error(e);
 | 
					    console.error(e)
 | 
				
			||||||
    return markdown;
 | 
					    return markdown
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return output;
 | 
					  return output
 | 
				
			||||||
};
 | 
					}
 | 
				
			||||||
// -----
 | 
					// -----
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(async function() {
 | 
					(async function() {
 | 
				
			||||||
| 
						 | 
					@ -186,8 +186,8 @@ const removeMarkdown = (
 | 
				
			||||||
          term,
 | 
					          term,
 | 
				
			||||||
        }))
 | 
					        }))
 | 
				
			||||||
        .join("\n")
 | 
					        .join("\n")
 | 
				
			||||||
      const anchors = document.getElementsByClassName("result-card");
 | 
					      const anchors = [...document.getElementsByClassName("result-card")]
 | 
				
			||||||
      [...anchors].forEach(anchor => {
 | 
					      anchors.forEach(anchor => {
 | 
				
			||||||
        anchor.onclick = () => redir(anchor.id, term)
 | 
					        anchor.onclick = () => redir(anchor.id, term)
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue