luci-app-bmx6: drop this because of security vulnerabilities
[feed/routing.git] / luci-app-bmx6 / dracula / dracula_graph.js
diff --git a/luci-app-bmx6/dracula/dracula_graph.js b/luci-app-bmx6/dracula/dracula_graph.js
deleted file mode 100644 (file)
index f25e5b3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-function log(a){console.log&&console.log(a)}var AbstractEdge=function(){};AbstractEdge.prototype={hide:function(){this.connection.fg.hide(),this.connection.bg&&this.bg.connection.hide()}};var EdgeFactory=function(){this.template=new AbstractEdge,this.template.style=new Object,this.template.style.directed=!1,this.template.weight=1};EdgeFactory.prototype={build:function(a,b){var c=jQuery.extend(!0,{},this.template);return c.source=a,c.target=b,c}};var Graph=function(){this.nodes={},this.edges=[],this.snapshots=[],this.edgeFactory=new EdgeFactory};Graph.prototype={addNode:function(a,b){return void 0==this.nodes[a]&&(this.nodes[a]=new Graph.Node(a,b)),this.nodes[a]},addEdge:function(a,b,c){var d=this.addNode(a),e=this.addNode(b),f=this.edgeFactory.build(d,e);jQuery.extend(f.style,c),d.edges.push(f),this.edges.push(f),e.edges.push(f)},snapShot:function(a){},removeNode:function(a){delete this.nodes[a];for(var b=0;b<this.edges.length;b++)this.edges[b].source.id!=a&&this.edges[b].target.id!=a||(this.edges.splice(b,1),b--)}},Graph.Node=function(a,b){return b=b||{},b.id=a,b.edges=[],b.hide=function(){this.hidden=!0,this.shape&&this.shape.hide();for(i in this.edges)(this.edges[i].source.id==a||this.edges[i].target==a)&&this.edges[i].hide&&this.edges[i].hide()},b.show=function(){this.hidden=!1,this.shape&&this.shape.show();for(i in this.edges)(this.edges[i].source.id==a||this.edges[i].target==a)&&this.edges[i].show&&this.edges[i].show()},b},Graph.Node.prototype={},Graph.Renderer={},Graph.Renderer.Raphael=function(a,b,c,d){this.width=c||400,this.height=d||400;var e=this;this.r=Raphael(a,this.width,this.height),this.radius=40,this.graph=b,this.mouse_in=!1,this.graph.render||(this.graph.render=function(){}),this.isDrag=!1,this.dragger=function(a){this.dx=a.clientX,this.dy=a.clientY,e.isDrag=this,this.set&&this.set.animate({"fill-opacity":.1},200)&&this.set.toFront(),a.preventDefault&&a.preventDefault()};var f=document.getElementById(a);f.onmousemove=function(a){if(a=a||window.event,e.isDrag){var b=e.isDrag.set.getBBox(),c=a.clientX-e.isDrag.dx+(b.x+b.width/2),d=a.clientY-e.isDrag.dy+(b.y+b.height/2),f=a.clientX-(c<20?c-20:c>e.width-20?c-e.width+20:0),g=a.clientY-(d<20?d-20:d>e.height-20?d-e.height+20:0);e.isDrag.set.translate(f-Math.round(e.isDrag.dx),g-Math.round(e.isDrag.dy));for(var h in e.graph.edges)e.graph.edges[h].connection&&e.graph.edges[h].connection.draw();e.isDrag.dx=f,e.isDrag.dy=g}},f.onmouseup=function(){e.isDrag&&e.isDrag.set.animate({"fill-opacity":.6},500),e.isDrag=!1},this.draw()},Graph.Renderer.Raphael.prototype={translate:function(a){return[(a[0]-this.graph.layoutMinX)*this.factorX+this.radius,(a[1]-this.graph.layoutMinY)*this.factorY+this.radius]},rotate:function(a,b,c){var d=b*Math.cos(c),e=b*Math.sin(c);return[a[0]+d,a[1]+e]},draw:function(){this.factorX=(this.width-2*this.radius)/(this.graph.layoutMaxX-this.graph.layoutMinX),this.factorY=(this.height-2*this.radius)/(this.graph.layoutMaxY-this.graph.layoutMinY);for(a in this.graph.nodes)this.drawNode(this.graph.nodes[a]);for(var a=0;a<this.graph.edges.length;a++)this.drawEdge(this.graph.edges[a])},drawNode:function(a){var b=this.translate([a.layoutPosX,a.layoutPosY]);if(a.point=b,a.shape){var c=a.shape.getBBox(),d={x:c.x+c.width/2,y:c.y+c.height/2};return a.shape.translate(Math.round(b[0]-d.x),Math.round(b[1]-d.y)),this.r.safari(),a}var e;a.render||(a.render=function(a,b){var c=Raphael.getColor(),d=a.ellipse(0,0,30,20).attr({fill:c,stroke:c,"stroke-width":2});return d.node.id=b.label||b.id,e=a.set().push(d).push(a.text(0,30,b.label||b.id))}),a.shapes,e=a.render(this.r,a).hide(),e.attr({"fill-opacity":.6}),e.items.forEach(function(a){a.set=e,a.node.style.cursor="move"}),e.mousedown(this.dragger);var f=e.getBBox();e.translate(Math.round(b[0]-(f.x+f.width/2)),Math.round(b[1]-(f.y+f.height/2))),a.hidden||e.show(),a.shape=e},drawEdge:function(a){if(!a.backedge){if(a.source.hidden||a.target.hidden)return void(a.connection&&a.connection.fg.hide()|a.connection.bg&&a.connection.bg.hide());if(!a.connection)return a.style&&a.style.callback&&a.style.callback(a),void(a.connection=this.r.connection(a.source.shape,a.target.shape,a.style));a.connection.fg.show(),a.connection.bg&&a.connection.bg.show(),a.connection.draw()}}},Graph.Layout={},Graph.Layout.Spring=function(a){this.graph=a,this.iterations=500,this.maxRepulsiveForceDistance=6,this.k=2,this.c=.01,this.maxVertexMovement=.5,this.layout()},Graph.Layout.Spring.prototype={layout:function(){this.layoutPrepare();for(var a=0;a<this.iterations;a++)this.layoutIteration();this.layoutCalcBounds()},layoutPrepare:function(){for(i in this.graph.nodes){var a=this.graph.nodes[i];a.layoutPosX=0,a.layoutPosY=0,a.layoutForceX=0,a.layoutForceY=0}},layoutCalcBounds:function(){var a=1/0,b=-(1/0),c=1/0,d=-(1/0);for(i in this.graph.nodes){var e=this.graph.nodes[i].layoutPosX,f=this.graph.nodes[i].layoutPosY;e>b&&(b=e),e<a&&(a=e),f>d&&(d=f),f<c&&(c=f)}this.graph.layoutMinX=a,this.graph.layoutMaxX=b,this.graph.layoutMinY=c,this.graph.layoutMaxY=d},layoutIteration:function(){var a=new Array;for(var b in this.graph.nodes){var c=this.graph.nodes[b];for(var d in a){var e=this.graph.nodes[a[d]];this.layoutRepulsive(c,e)}a.push(b)}for(var f=0;f<this.graph.edges.length;f++){var g=this.graph.edges[f];this.layoutAttractive(g)}for(f in this.graph.nodes){var h=this.graph.nodes[f],i=this.c*h.layoutForceX,j=this.c*h.layoutForceY,k=this.maxVertexMovement;i>k&&(i=k),i<-k&&(i=-k),j>k&&(j=k),j<-k&&(j=-k),h.layoutPosX+=i,h.layoutPosY+=j,h.layoutForceX=0,h.layoutForceY=0}},layoutRepulsive:function(a,b){if("undefined"!=typeof a&&"undefined"!=typeof b){var c=b.layoutPosX-a.layoutPosX,d=b.layoutPosY-a.layoutPosY,e=c*c+d*d;if(e<.01){c=.1*Math.random()+.1,d=.1*Math.random()+.1;var e=c*c+d*d}var f=Math.sqrt(e);if(f<this.maxRepulsiveForceDistance){var g=this.k*this.k/f;b.layoutForceX+=g*c/f,b.layoutForceY+=g*d/f,a.layoutForceX-=g*c/f,a.layoutForceY-=g*d/f}}},layoutAttractive:function(a){var b=a.source,c=a.target,d=c.layoutPosX-b.layoutPosX,e=c.layoutPosY-b.layoutPosY,f=d*d+e*e;if(f<.01){d=.1*Math.random()+.1,e=.1*Math.random()+.1;var f=d*d+e*e}var g=Math.sqrt(f);g>this.maxRepulsiveForceDistance&&(g=this.maxRepulsiveForceDistance,f=g*g);var h=(f-this.k*this.k)/this.k;void 0==a.attraction&&(a.attraction=1),h*=.5*Math.log(a.attraction)+1,c.layoutForceX-=h*d/g,c.layoutForceY-=h*e/g,b.layoutForceX+=h*d/g,b.layoutForceY+=h*e/g}},Graph.Layout.Ordered=function(a,b){this.graph=a,this.order=b,this.layout()},Graph.Layout.Ordered.prototype={layout:function(){this.layoutPrepare(),this.layoutCalcBounds()},layoutPrepare:function(a){for(i in this.graph.nodes){var b=this.graph.nodes[i];b.layoutPosX=0,b.layoutPosY=0}var c=0;for(i in this.order){var b=this.order[i];b.layoutPosX=c,b.layoutPosY=Math.random(),c++}},layoutCalcBounds:function(){var a=1/0,b=-(1/0),c=1/0,d=-(1/0);for(i in this.graph.nodes){var e=this.graph.nodes[i].layoutPosX,f=this.graph.nodes[i].layoutPosY;e>b&&(b=e),e<a&&(a=e),f>d&&(d=f),f<c&&(c=f)}this.graph.layoutMinX=a,this.graph.layoutMaxX=b,this.graph.layoutMinY=c,this.graph.layoutMaxY=d}},Raphael.el.tooltip=function(a){return this.tp=a,this.tp.o={x:0,y:0},this.tp.hide(),this.hover(function(a){this.mousemove(function(a){this.tp.translate(a.clientX-this.tp.o.x,a.clientY-this.tp.o.y),this.tp.o={x:a.clientX,y:a.clientY}}),this.tp.show().toFront()},function(a){this.tp.hide(),this.unmousemove()}),this},Array.prototype.forEach||(Array.prototype.forEach=function(a){var b=this.length;if("function"!=typeof a)throw new TypeError;for(var c=arguments[1],d=0;d<b;d++)d in this&&a.call(c,this[d],d,this)});