Template:Team:HKU-HKBU/script.js

From 2009.igem.org

(Difference between revisions)
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 tabNames = new Array()
+
   var tabs = new Array();
-
   tabNames[0] = "Brainstorming";
+
   tabs[0] = new TopTab(347, 104, "Brainstorming", "Brainstorming");
-
   tabNames[1] = "Team";
+
   tabs[1] = new TopTab(2, 55, "Team", "Team");
-
   tabNames[2] = "Gallery";
+
   tabs[2] = new TopTab(2, 64, "Gallery", "Gallery");
-
   tabNames[3] = "Calendar";
+
   tabs[3] = new TopTab(2, 75, "Calendar", "Calendar");
-
   tabNames[4] = "Protocols"
+
   tabs[4] = new TopTab(2, 77, "Protocols", "Protocols");
-
  tabNames[5] = "Human Practice";
+
   tabs[5] = new TopTab(2, 136, "Acknowledgements", "Acknowledgements");
-
   tabNames[6] = "Acknowledgements";
+
   tabs[6] = new TopTab(2, 69, "Contact", "Contact");
-
   tabNames[7] = "Contact";
+
-
  var tabWidths = new Array(92, 43, 52, 63, 65, 102, 124, 57);
 
-
  var leftWidth = 327;
 
-
  var rightWidth = 12;
 
-
  var seperWidth = 2;
 
   var i = 0;
   var i = 0;
-
   document.write("\
+
   document.write("<div class=\"topblock\"></div>");
-
    <div id=\"topnavtopblock\"></div>\
+
   for (i in tabs)
-
    <div class=\"seper\" style=\"width:" + (leftWidth - seperWidth) + "px\"></div>");
+
     tabs[i].addToTopNav();
-
   for (i in tabNames) {
+
}
-
     var pageName = tabNames[i].replace(/ /g, "_").toLowerCase();
+
 
-
    document.write("\
+
function LeftTab(topSpaceHeight, topLineHeight, bottomLineHeight, level, text, filename)
-
      <div class=\"seper\" style=\"width:" + seperWidth + "px\"></div>\
+
{
-
      <div class=\"tab" + ((document.URL.indexOf("/" + pageName) != -1) ? "sel" : "") + "\" style=\"width:" + tabWidths[i] + "px\">\
+
  this.topSpaceHeight = topSpaceHeight;
-
        <a href=\"https://2009.igem.org/Team:HKU-HKBU/" + pageName + "\">" + tabNames[i] + "</a>\
+
  this.topLineHeight = topLineHeight;
-
      </div>");
+
  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";
   }
   }
-
  document.write("<div class=\"seper\" style=\"width:" + rightWidth + "px\"></div>");
 
}
}
-
function loadLeftNav()
+
function indent()
{
{
-
   var majorTabNames = new Array()
+
   switch (this.level) {
-
   majorTabNames[0] = "Home";
+
   case 1:
-
  majorTabNames[1] = "Overview";
+
    return "> ";
-
   majorTabNames[2] = "Parts";
+
   case 2:
-
  majorTabNames[3] = "Modeling";
+
    return ">> ";
-
   majorTabNames[4] = "Strain Selection";
+
   default:
-
  majorTabNames[5] = "Motor";
+
    return "";
-
   majorTabNames[6] = "Polar Expression";
+
   }
-
  majorTabNames[7] = "Speed Control";
+
}
-
   var minorTabNumbers = new Array(0, 0, 0, 0, 0, 3, 4, 4);
+
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 minorTabNames = new Array()
+
function loadLeftNav()
-
  minorTabNames[0] = "Design";
+
{
-
  minorTabNames[1] = "Results";
+
   var tabs = new Array();
-
  minorTabNames[2] = "Protocols";
+
-
  minorTabNames[3] = "Design";
+
-
  minorTabNames[4] = "Parts";
+
-
  minorTabNames[5] = "Results";
+
-
  minorTabNames[6] = "Protocols";
+
-
  minorTabNames[7] = "Design";
+
-
  minorTabNames[8] = "Parts";
+
-
  minorTabNames[9] = "Results";
+
-
  minorTabNames[10] = "Protocols";
+
-
   var majorSeperHeight = 12;
+
   tabs[0] = new LeftTab(12, 0, 2, 0, "HOME", "Home");
-
   var minorSeperHeight = 2;
+
   tabs[1] = new LeftTab(12, 0, 2, 0, "PROJECT", "Project");
-
   var i = 0;
+
   tabs[2] = new LeftTab(0, 0, 1, 1, "Parts", "Parts");
-
   var j = 0;
+
   tabs[3] = new LeftTab(0, 0, 1, 1, "Micro-Motor", "Motor_Overview");
-
   var minorTabCount = 0;
+
   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");
-
   for (i in majorTabNames) {
+
   var i = 0;
-
    document.write("<div class=\"seper\" style=\"height:" + majorSeperHeight + "px\"></div>");
+
  for (i in tabs)
-
    if (minorTabNumbers[i] > 0) {
+
     tabs[i].addToLeftNav();
-
      document.write("<div class=\"texttab\">" + majorTabNames[i].toUpperCase() + "</div>");
+
-
      for (minorTabCount = 0; minorTabCount < minorTabNumbers[i]; ++minorTabCount) {
+
-
        var pageName = (majorTabNames[i] + " " + minorTabNames[j]).replace(/ /g, "_").toLowerCase();
+
-
        document.write("\
+
-
          <div class=\"seper\" style=\"height:" + minorSeperHeight + "px\"></div>\
+
-
          <div class=\"linktab" + ((document.URL.indexOf("/" + pageName) != -1) ? "sel" : "") + "\">\
+
-
            <a href=\"https://2009.igem.org/Team:HKU-HKBU/" + pageName + "\">" + minorTabNames[j] + "</a>\
+
-
          </div>");
+
-
        ++j;
+
-
      }
+
-
     } else {
+
-
      var pageName = majorTabNames[i].replace(/ /g, "_").toLowerCase();
+
-
      document.write("\
+
-
        <div class=\"linktab" + ((document.URL.indexOf("/" + pageName) != -1 || document.URL + pageName == "https://2009.igem.org/Team:HKU-HKBU" + "home") ? "sel" : "") + "\">\
+
-
          <a href=" + ((pageName == "parts") ? ("\"http://partsregistry.org/cgi/partsdb/pgroup.cgi?pgroup=iGEM2009&group=HKU-HKBU\" target=\"_blank\"") : ("\"https://2009.igem.org/Team:HKU-HKBU/" + pageName + "\"")) + ">" + majorTabNames[i].toUpperCase() + "</a>\
+
-
        </div>");
+
-
    }
+
-
  }
+
-
  document.write("<div class=\"seper\" style=\"height:" + majorSeperHeight + "px\"></div>");
+
}
}
-
function loadLogos()
+
function Logo(sponsorAddress, pictureAddress, alt)
{
{
-
   var URLs = new Array()
+
   this.sponsorAddress = sponsorAddress;
-
  URLs[0] = "http://www.hku.hk/";
+
   this.pictureAddress = pictureAddress;
-
  URLs[1] = "http://www.hku.hk/facmed/";
+
   this.alt = alt;
-
   URLs[2] = "http://www.hku.hk/biochem/";
+
-
  URLs[3] = "http://www.hku.hk/science/";
+
-
   URLs[4] = "http://www.hkbu.edu.hk/";
+
-
  URLs[5] = "http://www.sci.hkbu.edu.hk/";
+
-
  URLs[6] = "http://physics.hkbu.edu.hk/";
+
-
  URLs[7] = "http://www.bio-rad.com/";
+
-
  URLs[8] = "http://www.delta.com/";
+
-
  URLs[9] = "http://www.genetimes.com.cn/";
+
-
  URLs[10] = "http://www.invitrogen.com/";
+
-
   var pictureURLs = new Array();
+
   this.addToLogos = addToLogos;
-
  pictureURLs[0] = "https://static.igem.org/mediawiki/2009/8/8a/HKU-HKBU_HKU_240_60.png";
+
}
-
  pictureURLs[1] = "https://static.igem.org/mediawiki/2009/3/31/HKU-HKBU_HKU_medicine_240_60.png";
+
-
  pictureURLs[2] = "https://static.igem.org/mediawiki/2009/a/ad/HKU-HKBU_HKU_biochem_240_60.png";
+
-
  pictureURLs[3] = "https://static.igem.org/mediawiki/2009/b/bf/HKU-HKBU_HKU_science_240_60.png";
+
-
  pictureURLs[4] = "https://static.igem.org/mediawiki/2009/4/47/HKU-HKBU_HKBU_240_60.png";
+
-
  pictureURLs[5] = "https://static.igem.org/mediawiki/2009/a/af/HKU-HKBU_HKBU_science_240_60.png";
+
-
  pictureURLs[6] = "https://static.igem.org/mediawiki/2009/f/f2/HKU-HKBU_HKBU_physics_240_60.png";
+
-
  pictureURLs[7] = "https://static.igem.org/mediawiki/2009/b/b7/HKU-HKBU_biorad_240_60.png";
+
-
  pictureURLs[8] = "https://static.igem.org/mediawiki/2009/3/3c/HKU-HKBU_delta_240_60.png";
+
-
  pictureURLs[9] = "https://static.igem.org/mediawiki/2009/b/b3/HKU-HKBU_genetimes_240_60.png";
+
-
  pictureURLs[10] = "https://static.igem.org/mediawiki/2009/8/84/HKU-HKBU_invitrogen_240_60.png";
+
-
   var alts = new Array();
+
function addToLogos()
-
   alts[0] = "The University of Hong Kong";
+
{
-
   alts[1] = "The University of Hong Kong Li Ka Shing Faculty of Medicine";
+
  document.write("\
-
   alts[2] = "Department of Biochemistry, The University of Hong Kong";
+
    <div class=\"sponsorlogo\"><a href=\"" + this.sponsorAddress + "\">\
-
   alts[3] = "Faculty of Science, The University of Hong Kong";
+
      <img class=\"sponsorlogo\" src=\"" + this.pictureAddress + "\" alt=\"" + this.alt + "\" />\
-
   alts[4] = "Hong Kong Baptist University";
+
    </a></div>");
-
   alts[5] = "Faculty of Science, Hong Kong Baptist University";
+
}
-
   alts[6] = "Department of Physics, Hong Kong Baptist University";
+
 
-
   alts[7] = "Bio-Rad Laboratories";
+
function loadLogos()
-
   alts[8] = "Delta Air Lines - Airline Tickets and Airfare to Worldwide Destinations";
+
{
-
   alts[9] = "Genetimes Technology, Inc.";
+
   var logos = new Array();
-
   alts[10] = "Invitrogen.com a Provider of Essential Life Science Technologies";
+
   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 URLs)
+
 
-
     document.write("\
+
   for (i in logos)
-
      <div class=\"sponsorlogo\"><a href=\"" + URLs[i] + "\">\
+
     logos[i].addToLogos();
-
        <img class=\"sponsorlogo\" src=\"" + pictureURLs[i] + "\" alt=\"" + alts[i] + "\" />\
+
-
      </a></div>");
+
}
}
</script>
</script>
</html>
</html>

Revision as of 09:11, 16 October 2009