var Serf=Serf||{};!function(){function t(t){for(var e=p[t],i=g.select("#id_"+e.index).classed("active linkgroup_"+d,!0),r={},s=[],o=0;oo;o++){var u=s[o],a=r[u].pop(),f={source:e,target:a};m.push(f)}n()}function e(){v.attr("x1",function(t){return t.source.x}).attr("y1",function(t){return t.source.y}).attr("x2",function(t){return t.target.x}).attr("y2",function(t){return t.target.y}),y.attr("cx",function(t){return t.x}).attr("cy",function(t){return t.y})}function n(){y=y.data(p),y.enter().insert("circle",".cursor").attr("class","node").attr("r",12).attr("id",function(t,e){return"id_"+e}).call(f.drag),v=v.data(m),v.enter().insert("line",".node").attr("class","link active linkgroup_"+d),f.start(),r(d),d++}function r(t){setTimeout(s,700,t)}function s(t){g.selectAll(".linkgroup_"+t).classed("active",!1)}function o(){var t=document.getElementById("node-canvas");wW=window.innerWidth,t.style.left=(wW-l)/2+"px"}function a(){for(n(),i=0;u>i;i++)setTimeout(t,700*i+1e3,i)}var l=1400,h=490,c=50,u=128,d=0,p=[];for(i=0;u>i;i++)p.push({x:Math.random()*(l-c)+c/2,y:Math.random()*(h-c)+c/2});d3.scale.category20();var f=d3.layout.force().size([l,h]).nodes(p).linkDistance(60).charge(-1).gravity(4e-4).on("tick",e),g=d3.select("#jumbotron").append("svg").attr("id","node-canvas").attr("width",l).attr("height",h);o(),g.append("rect").attr("width",l).attr("height",h);var p=f.nodes(),m=f.links(),y=g.selectAll(".node"),v=g.selectAll(".link");g.append("circle").attr("r",30).attr("transform","translate(-100,-100)").attr("class","cursor"),window.onresize=function(){o()},Serf.Nodes={},Serf.Nodes.init=a}();