Template:Team:HKU-HKBU/script.js
From 2009.igem.org
(Difference between revisions)
YinanZhang (Talk | contribs) |
|||
(35 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
<html> | <html> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
+ | |||
+ | function isCurrentPage() | ||
+ | { | ||
+ | return (document.URL == this.address); | ||
+ | } | ||
+ | |||
+ | function TopTab(leftSpaceWidth, tabWidth, text, filename) | ||
+ | { | ||
+ | this.leftSpaceWidth = leftSpaceWidth; | ||
+ | this.tabWidth = tabWidth; | ||
+ | this.text = text; | ||
+ | this.address = "https://2009.igem.org/Team:HKU-HKBU/" + filename; | ||
+ | |||
+ | this.isCurrentPage = isCurrentPage; | ||
+ | this.addToTopNav = addToTopNav; | ||
+ | } | ||
+ | |||
+ | function addToTopNav() | ||
+ | { | ||
+ | document.write("\ | ||
+ | <div class=\"block\" style=\"width:" + this.leftSpaceWidth + "px\"></div>\ | ||
+ | <div class=\"" + (this.isCurrentPage() ? "tabsel" : "tab") + "\" style=\"width:" + this.tabWidth + "px\">\ | ||
+ | <a href=\"" + this.address + "\">" + this.text + "</a>\ | ||
+ | </div>"); | ||
+ | } | ||
function loadTopNav() | function loadTopNav() | ||
{ | { | ||
- | var | + | var tabs = new Array(); |
- | + | tabs[0] = new TopTab(347, 104, "Brainstorming", "Brainstorming"); | |
- | + | tabs[1] = new TopTab(2, 55, "Team", "Team"); | |
- | + | tabs[2] = new TopTab(2, 64, "Gallery", "Gallery"); | |
- | + | tabs[3] = new TopTab(2, 75, "Calendar", "Calendar"); | |
- | + | tabs[4] = new TopTab(2, 77, "Protocols", "Protocols"); | |
- | + | tabs[5] = new TopTab(2, 136, "Acknowledgements", "Acknowledgements"); | |
- | + | tabs[6] = new TopTab(2, 69, "Contact", "Contact"); | |
- | + | ||
- | |||
- | |||
- | |||
- | |||
var i = 0; | var i = 0; | ||
- | document.write(" | + | document.write("<div class=\"topblock\"></div>"); |
- | + | for (i in tabs) | |
- | + | tabs[i].addToTopNav(); | |
- | for (i in | + | } |
- | + | ||
- | + | function LeftTab(topSpaceHeight, topLineHeight, bottomLineHeight, level, text, filename, jumpOut) | |
- | + | { | |
- | + | this.topSpaceHeight = topSpaceHeight; | |
- | + | this.topLineHeight = topLineHeight; | |
- | + | this.bottomLineHeight = bottomLineHeight; | |
+ | this.level = level; | ||
+ | this.text = text; | ||
+ | this.address = "https://2009.igem.org/Team:HKU-HKBU/" + filename; | ||
+ | this.jumpOut = jumpOut; | ||
+ | |||
+ | this.isCurrentPage = isCurrentPage; | ||
+ | this.levelClass = levelClass; | ||
+ | this.indent = indent; | ||
+ | this.addToLeftNav = addToLeftNav; | ||
+ | } | ||
+ | |||
+ | function levelClass() | ||
+ | { | ||
+ | switch (this.level) { | ||
+ | case 1: | ||
+ | return "tabone"; | ||
+ | case 2: | ||
+ | return "tabtwo"; | ||
+ | default: | ||
+ | return "tabzero"; | ||
} | } | ||
- | document.write("<div class=\" | + | } |
+ | |||
+ | function indent() | ||
+ | { | ||
+ | switch (this.level) { | ||
+ | case 1: | ||
+ | return "> "; | ||
+ | case 2: | ||
+ | return ">> "; | ||
+ | default: | ||
+ | return ""; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function addToLeftNav() | ||
+ | { | ||
+ | document.write("\ | ||
+ | <div class=\"block\" style=\"background-color:transparent;height:" + this.topSpaceHeight + "px\"></div>\ | ||
+ | <div class=\"block\" style=\"background-color:black;height:" + this.topLineHeight + "px\"></div>\ | ||
+ | <div class=\"" + this.levelClass() + (this.isCurrentPage() ? "sel" : "") + "\">\ | ||
+ | <a href=\"" + this.address + "\"" + (this.jumpOut ? " target=\"_blank\"" : "") + ">" + this.indent() + this.text + "</a>\ | ||
+ | </div>\ | ||
+ | <div class=\"block\" style=\"background-color:black;height:" + this.bottomLineHeight + "px\"></div>"); | ||
} | } | ||
function loadLeftNav() | function loadLeftNav() | ||
{ | { | ||
- | var | + | var tabs = new Array(); |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | tabs[0] = new LeftTab(12, 0, 2, 0, "HOME", "Home", false); | |
+ | tabs[1] = new LeftTab(12, 0, 2, 0, "PROJECT", "Project", false); | ||
+ | tabs[2] = new LeftTab(0, 0, 1, 1, "Parts", "Parts", true); | ||
+ | tabs[3] = new LeftTab(0, 0, 1, 1, "Micro-Motor", "Motor_Overview", false); | ||
+ | tabs[4] = new LeftTab(0, 0, 0, 2, "Overview", "Motor_Overview", false); | ||
+ | tabs[5] = new LeftTab(0, 0, 0, 2, "Membrane Version", "Motor_Membrane_Version", false); | ||
+ | tabs[6] = new LeftTab(0, 0, 0, 2, "Silicon Version", "Motor_Silicon_Version", false); | ||
+ | tabs[7] = new LeftTab(0, 0, 1, 2, "Methodology", "Motor_Methodology", false); | ||
+ | tabs[8] = new LeftTab(0, 0, 1, 1, "Polar Expression", "Polar_Expression_Design", false); | ||
+ | tabs[9] = new LeftTab(0, 0, 0, 2, "Design", "Polar_Expression_Design", false); | ||
+ | tabs[10] = new LeftTab(0, 0, 0, 2, "Results", "Polar_Expression_Results", false); | ||
+ | tabs[11] = new LeftTab(0, 0, 1, 2, "Methodology", "Polar_Expression_Methodology", false); | ||
+ | tabs[12] = new LeftTab(0, 0, 1, 1, "Speed Control", "Speed_Control_Design", false); | ||
+ | tabs[13] = new LeftTab(0, 0, 0, 2, "Design", "Speed_Control_Design", false); | ||
+ | tabs[14] = new LeftTab(0, 0, 0, 2, "Results", "Speed_Control_Results", false); | ||
+ | tabs[15] = new LeftTab(0, 0, 1, 2, "Methodology", "Speed_Control_Methodology", false); | ||
+ | tabs[16] = new LeftTab(0, 0, 1, 1, "Modeling", "Modeling", false); | ||
+ | tabs[17] = new LeftTab(0, 0, 0, 1, "Applications", "Applications", false); | ||
+ | tabs[18] = new LeftTab(12, 0, 2, 0, "HUMAN PRACTICE", "Human_Practice", false); | ||
+ | tabs[19] = new LeftTab(0, 0, 1, 1, "Questionnaire", "Human_Practice_Questionnaire", false); | ||
+ | tabs[20] = new LeftTab(0, 0, 1, 1, "Website", "Human_Practice_Website", false); | ||
+ | tabs[21] = new LeftTab(0, 0, 1, 1, "Interview", "Human_Practice_Interview", false); | ||
+ | tabs[22] = new LeftTab(0, 0, 0, 1, "Lecture", "Human_Practice_Lecture", false); | ||
- | + | tabs[2].address = "http://partsregistry.org/cgi/partsdb/pgroup.cgi?pgroup=iGEM2009&group=HKU-HKBU"; | |
- | + | tabs[3].address = "./Motor_Overview"; | |
- | + | tabs[8].address = "./Polar_Expression_Design"; | |
- | + | tabs[12].address = "./Speed_Control_Design"; | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | |||
- | |||
var i = 0; | var i = 0; | ||
- | + | for (i in tabs) | |
- | + | tabs[i].addToLeftNav(); | |
+ | } | ||
- | + | function Logo(sponsorAddress, pictureAddress, alt) | |
- | + | { | |
- | + | this.sponsorAddress = sponsorAddress; | |
- | + | this.pictureAddress = pictureAddress; | |
- | + | this.alt = alt; | |
- | + | ||
- | + | this.addToLogos = addToLogos; | |
- | + | } | |
- | + | ||
- | + | function addToLogos() | |
- | + | { | |
- | + | document.write("\ | |
- | + | <div class=\"sponsorlogo\"><a href=\"" + this.sponsorAddress + "\">\ | |
- | + | <img class=\"sponsorlogo\" src=\"" + this.pictureAddress + "\" alt=\"" + this.alt + "\" />\ | |
- | + | </a></div>"); | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
} | } | ||
function loadLogos() | function loadLogos() | ||
{ | { | ||
- | var | + | var logos = new Array(); |
- | + | logos[0] = new Logo("http://www.hku.hk/", "https://static.igem.org/mediawiki/2009/8/8a/HKU-HKBU_HKU_240_60.png", "The University of Hong Kong"); | |
- | + | logos[1] = new Logo("http://www.hku.hk/facmed/", "https://static.igem.org/mediawiki/2009/3/31/HKU-HKBU_HKU_medicine_240_60.png", "The University of Hong Kong Li Ka Shing Faculty of Medicine"); | |
- | + | logos[2] = new Logo("http://www.hku.hk/biochem/", "https://static.igem.org/mediawiki/2009/a/ad/HKU-HKBU_HKU_biochem_240_60.png", "Department of Biochemistry, The University of Hong Kong"); | |
- | + | logos[3] = new Logo("http://www.hku.hk/science/", "https://static.igem.org/mediawiki/2009/b/bf/HKU-HKBU_HKU_science_240_60.png", "Faculty of Science, The University of Hong Kong"); | |
- | + | logos[4] = new Logo("http://www.hkbu.edu.hk/", "https://static.igem.org/mediawiki/2009/4/47/HKU-HKBU_HKBU_240_60.png", "Hong Kong Baptist University"); | |
- | + | logos[5] = new Logo("http://www.sci.hkbu.edu.hk/", "https://static.igem.org/mediawiki/2009/a/af/HKU-HKBU_HKBU_science_240_60.png", "Faculty of Science, Hong Kong Baptist University"); | |
- | + | logos[6] = new Logo("http://physics.hkbu.edu.hk/", "https://static.igem.org/mediawiki/2009/f/f2/HKU-HKBU_HKBU_physics_240_60.png", "Department of Physics, Hong Kong Baptist University"); | |
- | + | logos[7] = new Logo("http://www.bio-rad.com/", "https://static.igem.org/mediawiki/2009/b/b7/HKU-HKBU_biorad_240_60.png", "Bio-Rad Laboratories"); | |
- | + | logos[8] = new Logo("http://www.delta.com/", "https://static.igem.org/mediawiki/2009/3/3c/HKU-HKBU_delta_240_60.png", "Delta Air Lines - Airline Tickets and Airfare to Worldwide Destinations"); | |
- | + | logos[9] = new Logo("http://www.genetimes.com.cn/", "https://static.igem.org/mediawiki/2009/b/b3/HKU-HKBU_genetimes_240_60.png", "Genetimes Technology, Inc."); | |
- | + | logos[10] = new Logo("http://www.invitrogen.com/", "https://static.igem.org/mediawiki/2009/8/84/HKU-HKBU_invitrogen_240_60.png", "Invitrogen.com a Provider of Essential Life Science Technologies"); | |
- | var | + | var i = 0; |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | for (i in logos) | |
- | + | logos[i].addToLogos(); | |
- | + | } | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | var | + | function removeTitle(){ |
- | + | var el = document.getElementsByTagName("h1")[0]; | |
- | + | if (el != null) { | |
- | + | if (el.childNodes) { | |
- | + | for (var i = 0; i < el.childNodes.length; i++) { | |
- | + | var childNode = el.childNodes[i]; | |
+ | el.removeChild(childNode); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function modifyTopBar(){ | ||
+ | var el = document.getElementById("tabs"); | ||
+ | var aNodes = el.getElementsByTagName("a"); | ||
+ | for (var i = 0; i < aNodes.length; i++) { | ||
+ | if (aNodes[i].getAttribute("href") == document.URL) { | ||
+ | aNodes[i].style.backgroundPosition="0% -42px"; | ||
+ | var sNode = aNodes[i].getElementsByTagName("span")[0]; | ||
+ | sNode.style.backgroundPosition="100% -42px"; | ||
+ | } | ||
+ | } | ||
} | } | ||
</script> | </script> | ||
</html> | </html> |
Latest revision as of 12:38, 18 October 2009