Template:Team:HKU-HKBU/script.js
From 2009.igem.org
(Difference between revisions)
YinanZhang (Talk | contribs) |
YinanZhang (Talk | contribs) |
||
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) | |
- | + | { | |
- | + | 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.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"; | ||
} | } | ||
- | |||
} | } | ||
- | function | + | 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.indent() + this.text + "</a>\ | ||
+ | </div>\ | ||
+ | <div class=\"block\" style=\"background-color:black;height:" + this.bottomLineHeight + "px\"></div>"); | ||
+ | } | ||
- | var | + | function loadLeftNav() |
- | + | { | |
- | + | var tabs = new Array(); | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | tabs[0] = new LeftTab(12, 0, 2, 0, "HOME", "Home"); | |
- | + | tabs[1] = new LeftTab(12, 0, 2, 0, "PROJECT", "Project"); | |
- | + | tabs[2] = new LeftTab(0, 0, 1, 1, "Parts", "Parts"); | |
- | + | tabs[3] = new LeftTab(0, 0, 1, 1, "Micro-Motor", "Motor_Overview"); | |
- | + | tabs[4] = new LeftTab(0, 0, 0, 2, "Overview", "Motor_Overview"); | |
+ | tabs[5] = new LeftTab(0, 0, 0, 2, "Membrane Version", "Motor_Membrane_Version"); | ||
+ | tabs[6] = new LeftTab(0, 0, 0, 2, "Silicon Version", "Motor_Silicon_Version"); | ||
+ | tabs[7] = new LeftTab(0, 0, 1, 2, "Methodology", "Motor_Methodology"); | ||
+ | tabs[8] = new LeftTab(0, 0, 1, 1, "Polar Expression", "Polar_Expression_Design"); | ||
+ | tabs[9] = new LeftTab(0, 0, 0, 2, "Design", "Polar_Expression_Design"); | ||
+ | tabs[10] = new LeftTab(0, 0, 0, 2, "Results", "Polar_Expression_Results"); | ||
+ | tabs[11] = new LeftTab(0, 0, 1, 2, "Methodology", "Polar_Expression_Methodology"); | ||
+ | tabs[12] = new LeftTab(0, 0, 1, 1, "Speed Control", "Speed_Control_Design"); | ||
+ | tabs[13] = new LeftTab(0, 0, 0, 2, "Design", "Speed_Control_Design"); | ||
+ | tabs[14] = new LeftTab(0, 0, 0, 2, "Results", "Speed_Control_Results"); | ||
+ | tabs[15] = new LeftTab(0, 0, 1, 2, "Methodology", "Speed_Control_Methodology"); | ||
+ | tabs[16] = new LeftTab(0, 0, 1, 1, "Modeling", "Modeling"); | ||
+ | tabs[17] = new LeftTab(0, 0, 0, 1, "Applications", "Applications"); | ||
+ | tabs[18] = new LeftTab(12, 0, 2, 0, "HUMAN PRACTICE", "Human_Practice"); | ||
+ | tabs[19] = new LeftTab(0, 0, 1, 1, "Questionnaire", "Human_Practice_Questionnaire"); | ||
+ | tabs[20] = new LeftTab(0, 0, 1, 1, "Website", "Human_Practice_Website"); | ||
+ | tabs[21] = new LeftTab(0, 0, 1, 1, "Interview", "Human_Practice_Interview"); | ||
+ | tabs[22] = new LeftTab(0, 0, 0, 1, "Lecture", "Human_Practice_Lecture"); | ||
- | + | var i = 0; | |
- | + | for (i in tabs) | |
- | + | tabs[i].addToLeftNav(); | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
} | } | ||
- | function | + | function Logo(sponsorAddress, pictureAddress, alt) |
{ | { | ||
- | + | this.sponsorAddress = sponsorAddress; | |
- | + | this.pictureAddress = pictureAddress; | |
- | + | this.alt = alt; | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | this.addToLogos = addToLogos; | |
- | + | } | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | var | + | function addToLogos() |
- | + | { | |
- | + | document.write("\ | |
- | + | <div class=\"sponsorlogo\"><a href=\"" + this.sponsorAddress + "\">\ | |
- | + | <img class=\"sponsorlogo\" src=\"" + this.pictureAddress + "\" alt=\"" + this.alt + "\" />\ | |
- | + | </a></div>"); | |
- | + | } | |
- | + | ||
- | + | function loadLogos() | |
- | + | { | |
- | + | 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 i = 0; | var i = 0; | ||
- | for (i in | + | |
- | + | for (i in logos) | |
- | + | logos[i].addToLogos(); | |
- | + | ||
- | + | ||
} | } | ||
</script> | </script> | ||
</html> | </html> |
Revision as of 09:11, 16 October 2009