Template:Team:Bonn:Network
From 2013.igem.org
(Difference between revisions)
Line 2: | Line 2: | ||
<script> | <script> | ||
function test(node) { | function test(node) { | ||
- | var | + | var divContent = "subpage-middle"; |
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
getElements(node); | getElements(node); | ||
showElements(node,node,"navigation",content.parents,content.childs,content.titleShort,content.titleLong,content.summary,content.text); | showElements(node,node,"navigation",content.parents,content.childs,content.titleShort,content.titleLong,content.summary,content.text); | ||
} | } | ||
function initiateNetwork(node) { | function initiateNetwork(node) { | ||
- | var | + | var divContent = "subpage-middle"; |
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
getElements(node); | getElements(node); | ||
showElements(node,node,div-networkTop,content.parents,content.childs,content.titleShort,content.titleLong,content.summary,content.text); | showElements(node,node,div-networkTop,content.parents,content.childs,content.titleShort,content.titleLong,content.summary,content.text); | ||
} | } | ||
+ | function getElements(node) { | ||
+ | var divContent = "subpage-middle"; | ||
+ | var divTitle = "subpage-title"; | ||
+ | var divSummary = "subpage-summary"; | ||
+ | var divText = "subpage-text"; | ||
+ | var content = document.getElementById(divContent); | ||
+ | content.childs = new Array(); | ||
+ | content.parents = new Array(); | ||
+ | node = parseInt(node); | ||
+ | switch(node) { | ||
+ | case 1: | ||
+ | content.i = 1; | ||
+ | content.parents=[4]; | ||
+ | content.childs=[2,3]; | ||
+ | content.titleShort = "A title!1"; | ||
+ | content.titleLong = "See a title!1"; | ||
+ | content.summary= "this is a summary1"; | ||
+ | content.text= "This is my Text!1"; | ||
+ | content.type=""; | ||
+ | break; | ||
+ | case 2: | ||
+ | content.i = 2; | ||
+ | content.parents=[1]; | ||
+ | content.childs=[5]; | ||
+ | content.titleShort = "A title!2"; | ||
+ | content.titleLong = "See a title!2"; | ||
+ | content.summary= "this is a summary2"; | ||
+ | content.text= "This is my Text!2"; | ||
+ | content.type=""; | ||
+ | break; | ||
+ | case 3: | ||
+ | content.i = 3; | ||
+ | content.parents=[1]; | ||
+ | content.childs=[5]; | ||
+ | content.titleShort = "A title!3"; | ||
+ | content.titleLong = "See a title!3"; | ||
+ | content.summary= "this is a summary3"; | ||
+ | content.text= "This is my Text!3"; | ||
+ | content.type=""; | ||
+ | break; | ||
+ | case 4: | ||
+ | content.i = 4; | ||
+ | content.parents=[6]; | ||
+ | content.childs=[1]; | ||
+ | content.titleShort = "A title!4"; | ||
+ | content.titleLong = "See a title!4"; | ||
+ | content.summary= "this is a summary4"; | ||
+ | content.text= "This is my Text!4"; | ||
+ | content.type=""; | ||
+ | break; | ||
+ | case 5: | ||
+ | content.i = 5; | ||
+ | content.parents=[3,2]; | ||
+ | content.childs=[]; | ||
+ | content.titleShort = "A title!5"; | ||
+ | content.titleLong = "See a title!5"; | ||
+ | content.summary= "this is a summary5"; | ||
+ | content.text= "This is my Text!5"; | ||
+ | content.type=""; | ||
+ | break; | ||
+ | case 6: | ||
+ | content.i = 6; | ||
+ | content.parents=[]; | ||
+ | content.childs=[4]; | ||
+ | content.titleShort = "A title!6"; | ||
+ | content.titleLong = "See a title!6"; | ||
+ | content.summary= "this is a summary6"; | ||
+ | content.text= "This is my Text!6"; | ||
+ | content.type=""; | ||
+ | break; | ||
+ | } | ||
+ | } | ||
function showElements(node,mainnode,action,parents,childs,titleShort,titleLong,summary,text) { | function showElements(node,mainnode,action,parents,childs,titleShort,titleLong,summary,text) { | ||
- | var | + | var divContent = "subpage-middle"; |
- | var | + | var divTitle = "subpage-title"; |
- | var | + | var divSummary = "subpage-summary"; |
- | var | + | var divText = "subpage-text"; |
var div-networkBottom = "networkBottom"; | var div-networkBottom = "networkBottom"; | ||
var div-networkTop = "networkTop"; | var div-networkTop = "networkTop"; | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
getElements(node); | getElements(node); | ||
- | var contentTitle = document.getElementById( | + | var contentTitle = document.getElementById(divTitle); |
- | var contentSummary = document.getElementById( | + | var contentSummary = document.getElementById(divSummary); |
- | var contentText = document.getElementById( | + | var contentText = document.getElementById(divText); |
switch(action) { | switch(action) { | ||
Line 115: | Line 187: | ||
var div-networkBottom = "networkBottom"; | var div-networkBottom = "networkBottom"; | ||
var div-networkTop = "networkTop"; | var div-networkTop = "networkTop"; | ||
- | var | + | var divContent = "subpage-middle"; |
- | var | + | var divTitle = "subpage-title"; |
- | var | + | var divSummary = "subpage-summary"; |
- | var | + | var divText = "subpage-text"; |
var genheight = parseInt(document.getElementById(div-networkBottom).style.height); | var genheight = parseInt(document.getElementById(div-networkBottom).style.height); | ||
var genwidth = parseInt(document.getElementById(div-networkBottom).style.width); | var genwidth = parseInt(document.getElementById(div-networkBottom).style.width); | ||
Line 322: | Line 394: | ||
getElements(i); | getElements(i); | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
var nodeTitle = document.getElementById("nodeTitle"+i); | var nodeTitle = document.getElementById("nodeTitle"+i); | ||
nodeTitle.innerHTML = content.titleShort; | nodeTitle.innerHTML = content.titleShort; | ||
Line 337: | Line 409: | ||
var i = this.i; | var i = this.i; | ||
getElements(i); | getElements(i); | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
content.mainnode = this.mainnode; | content.mainnode = this.mainnode; | ||
setTimeout(function() { | setTimeout(function() { | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
showElements(content.i,content.mainnode,"navigation",content.parents,content.childs,content.titleShort,content.titleLong,content.summary,content.text) | showElements(content.i,content.mainnode,"navigation",content.parents,content.childs,content.titleShort,content.titleLong,content.summary,content.text) | ||
} | } | ||
Line 349: | Line 421: | ||
getElements(i); | getElements(i); | ||
var mainnode = this.mainnode; | var mainnode = this.mainnode; | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
var nodeTitle = document.getElementById("nodeTitle"+i); | var nodeTitle = document.getElementById("nodeTitle"+i); | ||
if(this.parentID) { | if(this.parentID) { | ||
Line 401: | Line 473: | ||
getElements(i); | getElements(i); | ||
var mainnode = this.mainnode; | var mainnode = this.mainnode; | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
var nodeTitle = document.getElementById("nodeTitle"+i); | var nodeTitle = document.getElementById("nodeTitle"+i); | ||
if(this.parentID) { | if(this.parentID) { | ||
Line 430: | Line 502: | ||
}; | }; | ||
if(general.type == "parent") { | if(general.type == "parent") { | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
getElements(i); | getElements(i); | ||
if(content.childs) { | if(content.childs) { | ||
Line 455: | Line 527: | ||
function connect(nodeID,mainnode,type,ax,ay,bx,by,parentID,dheight,dwidth) { | function connect(nodeID,mainnode,type,ax,ay,bx,by,parentID,dheight,dwidth) { | ||
- | var | + | var divContent = "subpage-middle"; |
- | var | + | var divTitle = "subpage-title"; |
- | var | + | var divSummary = "subpage-summary"; |
- | var | + | var divText = "subpage-text"; |
var div-networkBottom = "networkBottom"; | var div-networkBottom = "networkBottom"; | ||
var div-networkTop = "networkTop"; | var div-networkTop = "networkTop"; | ||
Line 498: | Line 570: | ||
function createNetwork(general) { | function createNetwork(general) { | ||
- | var | + | var divContent = "subpage-middle"; |
- | var | + | var divTitle = "subpage-title"; |
- | var | + | var divSummary = "subpage-summary"; |
- | var | + | var divText = "subpage-text"; |
var div-networkBottom = "networkBottom"; | var div-networkBottom = "networkBottom"; | ||
var div-networkTop = "networkTop"; | var div-networkTop = "networkTop"; | ||
Line 536: | Line 608: | ||
title.style.height = title.height + "px"; | title.style.height = title.height + "px"; | ||
title.style.width = title.width + "px"; | title.style.width = title.width + "px"; | ||
- | title.id = | + | title.id = divTitle; |
title.style.position = "absolute"; | title.style.position = "absolute"; | ||
title.top = 20; | title.top = 20; | ||
Line 547: | Line 619: | ||
summary.style.height = "200px"; | summary.style.height = "200px"; | ||
summary.style.width = "150px"; | summary.style.width = "150px"; | ||
- | summary.id = | + | summary.id = divSummary; |
summary.style.position = "absolute"; | summary.style.position = "absolute"; | ||
summary.top = 10+title.top+title.height; | summary.top = 10+title.top+title.height; | ||
Line 597: | Line 669: | ||
var i = this.i; | var i = this.i; | ||
getElements(i); | getElements(i); | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
content.mainnode = i; | content.mainnode = i; | ||
setTimeout(function() { | setTimeout(function() { | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
showElements(content.i,content.mainnode,"navigation",content.parents,content.childs,content.titleShort,content.titleLong,content.summary,content.text) | showElements(content.i,content.mainnode,"navigation",content.parents,content.childs,content.titleShort,content.titleLong,content.summary,content.text) | ||
} | } | ||
Line 609: | Line 681: | ||
getElements(i); | getElements(i); | ||
var mainnode = this.mainnode; | var mainnode = this.mainnode; | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
- | var nodeTitle = document.getElementById( | + | var nodeTitle = document.getElementById(divTitle); |
- | var nodeSummary = document.getElementById( | + | var nodeSummary = document.getElementById(divSummary); |
nodeSummary.innerHTML = content.summary; | nodeSummary.innerHTML = content.summary; | ||
nodeTitle.innerHTML = content.titleLong; | nodeTitle.innerHTML = content.titleLong; | ||
Line 625: | Line 697: | ||
getElements(i); | getElements(i); | ||
var mainnode = this.mainnode; | var mainnode = this.mainnode; | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
- | var nodeTitle = document.getElementById( | + | var nodeTitle = document.getElementById(divTitle); |
- | var nodeSummary = document.getElementById( | + | var nodeSummary = document.getElementById(divSummary); |
nodeSummary.innerHTML = ""; | nodeSummary.innerHTML = ""; | ||
nodeTitle.innerHTML = content.titleShort; | nodeTitle.innerHTML = content.titleShort; | ||
Line 734: | Line 806: | ||
getElements(i); | getElements(i); | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
- | var nodeTitle = document.getElementById( | + | var nodeTitle = document.getElementById(divTitle); |
nodeTitle.innerHTML = content.titleShort; | nodeTitle.innerHTML = content.titleShort; | ||
if(general.parentID) { | if(general.parentID) { | ||
Line 749: | Line 821: | ||
var i = this.i; | var i = this.i; | ||
getElements(i); | getElements(i); | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
content.mainnode = this.mainnode; | content.mainnode = this.mainnode; | ||
setTimeout(function() { | setTimeout(function() { | ||
Line 760: | Line 832: | ||
getElements(i); | getElements(i); | ||
var mainnode = this.mainnode; | var mainnode = this.mainnode; | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
- | var nodeTitle = document.getElementById( | + | var nodeTitle = document.getElementById(divTitle); |
- | var nodeSummary = document.getElementById( | + | var nodeSummary = document.getElementById(divSummary); |
nodeSummary.innerHTML = content.summary; | nodeSummary.innerHTML = content.summary; | ||
nodeTitle.innerHTML = content.titleLong; | nodeTitle.innerHTML = content.titleLong; | ||
Line 771: | Line 843: | ||
getElements(i); | getElements(i); | ||
var mainnode = this.mainnode; | var mainnode = this.mainnode; | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
- | var nodeTitle = document.getElementById( | + | var nodeTitle = document.getElementById(divTitle); |
- | var nodeSummary = document.getElementById( | + | var nodeSummary = document.getElementById(divSummary); |
nodeSummary.innerHTML = ""; | nodeSummary.innerHTML = ""; | ||
nodeTitle.innerHTML = content.titleShort; | nodeTitle.innerHTML = content.titleShort; | ||
this.style.backgroundColor = "black"; | this.style.backgroundColor = "black"; | ||
}; | }; | ||
- | var content = document.getElementById( | + | var content = document.getElementById(divContent); |
getElements(i); | getElements(i); | ||
if(content.childs) { | if(content.childs) { | ||
Line 835: | Line 907: | ||
function connectNetwork(nodeID,mainnode,type,ax,ay,bx,by,parentID,dheight,dwidth) { | function connectNetwork(nodeID,mainnode,type,ax,ay,bx,by,parentID,dheight,dwidth) { | ||
- | var | + | var divContent = "subpage-middle"; |
- | var | + | var divTitle = "subpage-title"; |
- | var | + | var divSummary = "subpage-summary"; |
- | var | + | var divText = "subpage-text"; |
var div-networkBottom = "networkBottom"; | var div-networkBottom = "networkBottom"; | ||
var div-networkTop = "networkTop"; | var div-networkTop = "networkTop"; |
Revision as of 08:45, 1 October 2013