Template:Team:Bonn:Network
From 2013.igem.org
(Difference between revisions)
Line 11: | Line 11: | ||
var content = document.getElementById(divContent); | var content = document.getElementById(divContent); | ||
getElements(node); | getElements(node); | ||
- | showElements(node,node, | + | showElements(node,node,divnetworkTop,content.parents,content.childs,content.titleShort,content.titleLong,content.summary,content.text); |
} | } | ||
function getElements(node) { | function getElements(node) { | ||
Line 90: | Line 90: | ||
var divSummary = "subpage-summary"; | var divSummary = "subpage-summary"; | ||
var divText = "subpage-text"; | var divText = "subpage-text"; | ||
- | var | + | var divnetworkBottom = "networkBottom"; |
- | var | + | var divnetworkTop = "networkTop"; |
var content = document.getElementById(divContent); | var content = document.getElementById(divContent); | ||
getElements(node); | getElements(node); | ||
Line 99: | Line 99: | ||
switch(action) { | switch(action) { | ||
- | case | + | case divnetworkTop: |
- | if(document.getElementById( | + | if(document.getElementById(divnetworkTop)) { |
- | var divs = document.getElementById( | + | var divs = document.getElementById(divnetworkTop); |
divs.innerHTML = ''; | divs.innerHTML = ''; | ||
} | } | ||
Line 133: | Line 133: | ||
case "navigation": | case "navigation": | ||
- | if(document.getElementById( | + | if(document.getElementById(divnetworkBottom)) { |
- | var divs = document.getElementById( | + | var divs = document.getElementById(divnetworkBottom); |
divs.innerHTML = ''; | divs.innerHTML = ''; | ||
} | } | ||
Line 185: | Line 185: | ||
function circle(general) { | function circle(general) { | ||
- | var | + | var divnetworkBottom = "networkBottom"; |
- | var | + | var divnetworkTop = "networkTop"; |
var divContent = "subpage-middle"; | var divContent = "subpage-middle"; | ||
var divTitle = "subpage-title"; | var divTitle = "subpage-title"; | ||
var divSummary = "subpage-summary"; | var divSummary = "subpage-summary"; | ||
var divText = "subpage-text"; | var divText = "subpage-text"; | ||
- | var genheight = parseInt(document.getElementById( | + | var genheight = parseInt(document.getElementById(divnetworkBottom).style.height); |
- | var genwidth = parseInt(document.getElementById( | + | var genwidth = parseInt(document.getElementById(divnetworkBottom).style.width); |
if(general.cheight) { | if(general.cheight) { | ||
} else{ | } else{ | ||
Line 255: | Line 255: | ||
document.getElementById(general.parent).appendChild(mid); | document.getElementById(general.parent).appendChild(mid); | ||
} else { | } else { | ||
- | document.getElementById( | + | document.getElementById(divnetworkBottom).appendChild(mid); |
} | } | ||
} | } | ||
Line 262: | Line 262: | ||
div.style.height = general.height; | div.style.height = general.height; | ||
div.style.width = general.width; | div.style.width = general.width; | ||
- | div.id = "div | + | div.id = "div"+general.type+"-"+general.mainnode; |
div.style.position ="absolute"; | div.style.position ="absolute"; | ||
div.style.top = (parseInt(document.getElementById("midnode"+general.mainnode).style.top)+general.mheight/2-general.height/2)+"px"; | div.style.top = (parseInt(document.getElementById("midnode"+general.mainnode).style.top)+general.mheight/2-general.height/2)+"px"; | ||
div.style.left = (parseInt(document.getElementById("midnode"+general.mainnode).style.left)+general.mwidth/2-general.width/2)+"px"; | div.style.left = (parseInt(document.getElementById("midnode"+general.mainnode).style.left)+general.mwidth/2-general.width/2)+"px"; | ||
if(general.parent) { | if(general.parent) { | ||
- | document.getElementById(" | + | document.getElementById("nodedivparent-"+general.mainnode).appendChild(div); |
} else { | } else { | ||
- | document.getElementById( | + | document.getElementById(divnetworkBottom).appendChild(div); |
} | } | ||
for(var x=0;x<general.n.length;x++) { | for(var x=0;x<general.n.length;x++) { | ||
Line 286: | Line 286: | ||
nodediv[i].style.top = "0"; | nodediv[i].style.top = "0"; | ||
nodediv[i].style.left = "0"; | nodediv[i].style.left = "0"; | ||
- | nodediv[i].id = "nodediv | + | nodediv[i].id = "nodediv"+general.type+"-"+i; |
- | document.getElementById("div | + | document.getElementById("div"+general.type+"-"+general.mainnode).appendChild(nodediv[i]); |
} | } | ||
node[i] = document.createElement("DIV"); | node[i] = document.createElement("DIV"); | ||
Line 403: | Line 403: | ||
node[i].mainnode = general.mainnode; | node[i].mainnode = general.mainnode; | ||
node[i].onclick = function() { | node[i].onclick = function() { | ||
- | $("# | + | $("#divchild-"+this.mainnode).stop().animate(); |
- | $("# | + | $("#divchild-"+this.mainnode).animate({left:"3000px"},700); |
- | $("# | + | $("#divparent-"+this.mainnode).stop().animate(); |
- | $("# | + | $("#divparent-"+this.mainnode).animate({left:"3000px"},700); |
var i = this.i; | var i = this.i; | ||
getElements(i); | getElements(i); | ||
Line 443: | Line 443: | ||
var slide = 150-(top2-top1); | var slide = 150-(top2-top1); | ||
if(slide>0) { | if(slide>0) { | ||
- | for(j=i-1;document.getElementById("nodediv | + | for(j=i-1;document.getElementById("nodediv"+this.type+"-"+j);j--) { |
var top = parseInt(document.getElementById("node"+mainnode+"-"+this.type+"-"+j).style.top); | var top = parseInt(document.getElementById("node"+mainnode+"-"+this.type+"-"+j).style.top); | ||
- | $("#nodediv | + | $("#nodediv"+this.type+"-"+j).stop().animate(); |
- | $("#nodediv | + | $("#nodediv"+this.type+"-"+j).animate({top:slide+"px"},700); |
} | } | ||
} | } | ||
Line 459: | Line 459: | ||
var slide = 150-(top2-top1); | var slide = 150-(top2-top1); | ||
if(slide>0) { | if(slide>0) { | ||
- | for(j=i+1;document.getElementById("nodediv | + | for(j=i+1;document.getElementById("nodediv"+this.type+"-"+j);j++) { |
var top = parseInt(document.getElementById("node"+mainnode+"-"+this.type+"-"+j).style.top); | var top = parseInt(document.getElementById("node"+mainnode+"-"+this.type+"-"+j).style.top); | ||
- | $("#nodediv | + | $("#nodediv"+this.type+"-"+j).stop().animate(); |
- | $("#nodediv | + | $("#nodediv"+this.type+"-"+j).animate({top:slide+"px"},700); |
} | } | ||
} | } | ||
Line 489: | Line 489: | ||
if(this.type=="parent") { | if(this.type=="parent") { | ||
- | for(j=i-1;document.getElementById("nodediv | + | for(j=i-1;document.getElementById("nodediv"+this.type+"-"+j);j--) { |
- | $("#nodediv | + | $("#nodediv"+this.type+"-"+j).stop().animate(); |
- | $("#nodediv | + | $("#nodediv"+this.type+"-"+j).animate({top:"0px"},700); |
} | } | ||
} else{ | } else{ | ||
- | for(j=i+1;document.getElementById("nodediv | + | for(j=i+1;document.getElementById("nodediv"+this.type+"-"+j);j++) { |
- | $("#nodediv | + | $("#nodediv"+this.type+"-"+j).stop().animate(); |
- | $("#nodediv | + | $("#nodediv"+this.type+"-"+j).animate({top:"0px"},700); |
} | } | ||
} | } | ||
Line 516: | Line 516: | ||
left:node[i].left+general.cwidth/2, | left:node[i].left+general.cwidth/2, | ||
parentID:general.mainnode, | parentID:general.mainnode, | ||
- | parent:"div | + | parent:"div"+general.type+"-"+general.mainnode, |
cwidth:9, | cwidth:9, | ||
cheight:9 | cheight:9 | ||
Line 531: | Line 531: | ||
var divSummary = "subpage-summary"; | var divSummary = "subpage-summary"; | ||
var divText = "subpage-text"; | var divText = "subpage-text"; | ||
- | var | + | var divnetworkBottom = "networkBottom"; |
- | var | + | var divnetworkTop = "networkTop"; |
var m= (ay-by)/(bx-ax); | var m= (ay-by)/(bx-ax); | ||
var length = Math.sqrt((ax-bx)*(ax-bx)+(by-ay)*(by-ay)); | var length = Math.sqrt((ax-bx)*(ax-bx)+(by-ay)*(by-ay)); | ||
Line 559: | Line 559: | ||
ddiv[i].style.left = ddiv[i].left +"px"; | ddiv[i].style.left = ddiv[i].left +"px"; | ||
if(parentID) { | if(parentID) { | ||
- | document.getElementById("div | + | document.getElementById("div"+type+"-"+mainnode).appendChild(ddiv[i]); |
} else { | } else { | ||
- | document.getElementById("nodediv | + | document.getElementById("nodediv"+type+"-"+nodeID).appendChild(ddiv[i]); |
} | } | ||
} | } | ||
Line 574: | Line 574: | ||
var divSummary = "subpage-summary"; | var divSummary = "subpage-summary"; | ||
var divText = "subpage-text"; | var divText = "subpage-text"; | ||
- | var | + | var divnetworkBottom = "networkBottom"; |
- | var | + | var divnetworkTop = "networkTop"; |
- | var genheight = parseInt(document.getElementById( | + | var genheight = parseInt(document.getElementById(divnetworkTop).style.height); |
- | var genwidth = parseInt(document.getElementById( | + | var genwidth = parseInt(document.getElementById(divnetworkTop).style.width); |
if(general.cheight) { | if(general.cheight) { | ||
} else{ | } else{ | ||
Line 614: | Line 614: | ||
title.style.top = title.top + "px"; | title.style.top = title.top + "px"; | ||
title.style.right = title.right + "px"; | title.style.right = title.right + "px"; | ||
- | document.getElementById( | + | document.getElementById(divnetworkTop).appendChild(title); |
var summary = document.createElement("DIV"); | var summary = document.createElement("DIV"); | ||
Line 625: | Line 625: | ||
summary.style.top = summary.top + "px"; | summary.style.top = summary.top + "px"; | ||
summary.style.right = summary.right + "px"; | summary.style.right = summary.right + "px"; | ||
- | document.getElementById( | + | document.getElementById(divnetworkTop).appendChild(summary); |
var Summary = document | var Summary = document | ||
if(document.getElementById("netNode"+general.mainnode)) { | if(document.getElementById("netNode"+general.mainnode)) { | ||
Line 645: | Line 645: | ||
node[general.mainnode].left = 0; | node[general.mainnode].left = 0; | ||
node[general.mainnode].style.left = node[general.mainnode].left+"px"; | node[general.mainnode].style.left = node[general.mainnode].left+"px"; | ||
- | document.getElementById( | + | document.getElementById(divnetworkTop).appendChild(node[general.mainnode]); |
nodeTitle[general.mainnode] = document.createElement("DIV"); | nodeTitle[general.mainnode] = document.createElement("DIV"); | ||
Line 660: | Line 660: | ||
nodeTitle[general.mainnode].left = node[general.mainnode].left+15; | nodeTitle[general.mainnode].left = node[general.mainnode].left+15; | ||
nodeTitle[general.mainnode].style.left = nodeTitle[general.mainnode].left+"px"; | nodeTitle[general.mainnode].style.left = nodeTitle[general.mainnode].left+"px"; | ||
- | document.getElementById( | + | document.getElementById(divnetworkTop).appendChild(nodeTitle[general.mainnode]); |
node[general.mainnode].onclick = function() { | node[general.mainnode].onclick = function() { | ||
- | $("# | + | $("#divchild-"+this.mainnode).stop().animate(); |
- | $("# | + | $("#divparent-"+this.mainnode).stop().animate(); |
- | $("# | + | $("#divchild-"+this.mainnode).animate({left:"1000px"},700); |
- | $("# | + | $("#divparent-"+this.mainnode).animate({left:"1000px"},700); |
var i = this.i; | var i = this.i; | ||
getElements(i); | getElements(i); | ||
Line 759: | Line 759: | ||
} | } | ||
node[i].style.left = node[i].left+"px"; | node[i].style.left = node[i].left+"px"; | ||
- | document.getElementById( | + | document.getElementById(divnetworkTop).appendChild(node[i]); |
nodeTitle[i] = document.createElement("DIV"); | nodeTitle[i] = document.createElement("DIV"); | ||
Line 774: | Line 774: | ||
nodeTitle[i].left = node[i].left+15; | nodeTitle[i].left = node[i].left+15; | ||
nodeTitle[i].style.left = nodeTitle[i].left+"px"; | nodeTitle[i].style.left = nodeTitle[i].left+"px"; | ||
- | document.getElementById( | + | document.getElementById(divnetworkTop).appendChild(nodeTitle[i]); |
} | } | ||
if(general.parentID) { | if(general.parentID) { | ||
Line 815: | Line 815: | ||
node[i].mainnode = general.mainnode; | node[i].mainnode = general.mainnode; | ||
node[i].onclick = function() { | node[i].onclick = function() { | ||
- | $("# | + | $("#divchild-"+this.mainnode).stop().animate(); |
- | $("# | + | $("#divparent-"+this.mainnode).stop().animate(); |
- | $("# | + | $("#divchild-"+this.mainnode).animate({left:"1000px"},700); |
- | $("# | + | $("#divparent-"+this.mainnode).animate({left:"1000px"},700); |
var i = this.i; | var i = this.i; | ||
getElements(i); | getElements(i); | ||
Line 873: | Line 873: | ||
left:node[i].left+general.cwidth/2, | left:node[i].left+general.cwidth/2, | ||
parentID:general.mainnode, | parentID:general.mainnode, | ||
- | parent:"div | + | parent:"div"+general.type+"-"+general.mainnode, |
}); | }); | ||
} | } | ||
Line 898: | Line 898: | ||
left:node[i].left+general.cwidth/2, | left:node[i].left+general.cwidth/2, | ||
parentID:general.mainnode, | parentID:general.mainnode, | ||
- | parent:"div | + | parent:"div"+general.type+"-"+general.mainnode, |
}); | }); | ||
} | } | ||
Line 911: | Line 911: | ||
var divSummary = "subpage-summary"; | var divSummary = "subpage-summary"; | ||
var divText = "subpage-text"; | var divText = "subpage-text"; | ||
- | var | + | var divnetworkBottom = "networkBottom"; |
- | var | + | var divnetworkTop = "networkTop"; |
var m= (ay-by)/(bx-ax); | var m= (ay-by)/(bx-ax); | ||
var length = Math.sqrt((ax-bx)*(ax-bx)+(by-ay)*(by-ay)); | var length = Math.sqrt((ax-bx)*(ax-bx)+(by-ay)*(by-ay)); | ||
Line 938: | Line 938: | ||
ddiv[i].style.top = ddiv[i].top +"px"; | ddiv[i].style.top = ddiv[i].top +"px"; | ||
ddiv[i].style.left = ddiv[i].left +"px"; | ddiv[i].style.left = ddiv[i].left +"px"; | ||
- | document.getElementById( | + | document.getElementById(divnetworkTop).appendChild(ddiv[i]); |
} | } | ||
Revision as of 08:46, 1 October 2013