Template:Team:HKU-HKBU/script.js

From 2009.igem.org

(Difference between revisions)
 
(61 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 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] = "Human Practice";
+
   tabs[4] = new TopTab(2, 77, "Protocols", "Protocols");
-
   tabNames[5] = "Acknowledgements";
+
   tabs[5] = new TopTab(2, 136, "Acknowledgements", "Acknowledgements");
-
   tabNames[6] = "Contact";
+
   tabs[6] = new TopTab(2, 69, "Contact", "Contact");
-
  var tabWidths = new Array(112, 40, 64, 72, 120, 136, 64);
 
-
  var leftWidth = 325;
 
-
  var rightWidth = 6;
 
-
  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, jumpOut)
-
      <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=\"" + pageName + ".html\">" + 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.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=\"seper\" style=\"width:" + rightWidth + "px\"></div>");
+
}
 +
 
 +
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 majorTabNames = new Array()
+
   var tabs = new Array();
-
  majorTabNames[0] = "Home";
+
-
  majorTabNames[1] = "Overview";
+
-
  majorTabNames[2] = "Parts";
+
-
  majorTabNames[3] = "Modeling";
+
-
  majorTabNames[4] = "Strain Selection";
+
-
  majorTabNames[5] = "Motor";
+
-
  majorTabNames[6] = "Polar Expression";
+
-
  majorTabNames[7] = "Speed Control";
+
-
   var minorTabNumbers = new Array(0, 0, 0, 0, 0, 3, 4, 4);
+
   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);
-
   var minorTabNames = new Array()
+
   tabs[2].address = "http://partsregistry.org/cgi/partsdb/pgroup.cgi?pgroup=iGEM2009&group=HKU-HKBU";
-
  minorTabNames[0] = "Design";
+
   tabs[3].address = "./Motor_Overview";
-
  minorTabNames[1] = "Experiments";
+
   tabs[8].address = "./Polar_Expression_Design";
-
  minorTabNames[2] = "Protocols";
+
   tabs[12].address = "./Speed_Control_Design";
-
   minorTabNames[3] = "Design";
+
-
   minorTabNames[4] = "Parts";
+
-
  minorTabNames[5] = "Experiments";
+
-
  minorTabNames[6] = "Protocols";
+
-
  minorTabNames[7] = "Design";
+
-
  minorTabNames[8] = "Parts";
+
-
  minorTabNames[9] = "Experiments";
+
-
   minorTabNames[10] = "Protocols";
+
-
  var majorSeperHeight = 12;
 
-
  var minorSeperHeight = 2;
 
   var i = 0;
   var i = 0;
-
   var j = 0;
+
   for (i in tabs)
-
  var minorTabCount = 0;
+
    tabs[i].addToLeftNav();
 +
}
-
  for (i in majorTabNames) {
+
function Logo(sponsorAddress, pictureAddress, alt)
-
    document.write("<div class=\"seper\" style=\"height:" + majorSeperHeight + "px\"></div>");
+
{
-
    if (minorTabNumbers[i] > 0) {
+
  this.sponsorAddress = sponsorAddress;
-
      document.write("<div class=\"texttab\">" + majorTabNames[i].toUpperCase() + "</div>");
+
  this.pictureAddress = pictureAddress;
-
      for (minorTabCount = 0; minorTabCount < minorTabNumbers[i]; ++minorTabCount) {
+
  this.alt = alt;
-
        var pageName = (majorTabNames[i] + " " + minorTabNames[j]).replace(/ /g, "_").toLowerCase();
+
 
-
        document.write("\
+
  this.addToLogos = addToLogos;
-
          <div class=\"seper\" style=\"height:" + minorSeperHeight + "px\"></div>\
+
}
-
          <div class=\"linktab" + ((document.URL.indexOf(pageName) != -1) ? "sel" : "") + "\">\
+
 
-
            <a href=\"" + pageName + ".html\">" + minorTabNames[j] + "</a>\
+
function addToLogos()
-
          </div>");
+
{
-
        ++j;
+
  document.write("\
-
      }
+
    <div class=\"sponsorlogo\"><a href=\"" + this.sponsorAddress + "\">\
-
    } else {
+
      <img class=\"sponsorlogo\" src=\"" + this.pictureAddress + "\" alt=\"" + this.alt + "\" />\
-
      var pageName = majorTabNames[i].replace(/ /g, "_").toLowerCase();
+
    </a></div>");
-
      document.write("\
+
-
        <div class=\"linktab" + ((document.URL.indexOf(pageName) != -1) ? "sel" : "") + "\">\
+
-
          <a href=\"" + pageName + ".html\">" + majorTabNames[i].toUpperCase() + "</a>\
+
-
        </div>");
+
-
    }
+
-
  }
+
-
  document.write("<div class=\"seper\" style=\"height:" + majorSeperHeight + "px\"></div>");
+
}
}
function loadLogos()
function loadLogos()
{
{
-
   var pictureNames = new Array();
+
   var logos = new Array();
-
   pictureNames[0] = "HKU";
+
   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");
-
   pictureNames[1] = "HKU_medicine";
+
   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");
-
   pictureNames[2] = "HKU_biochem";
+
   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");
-
   pictureNames[3] = "HKU_science";
+
   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");
-
   pictureNames[4] = "HKBU";
+
   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");
-
   pictureNames[5] = "HKBU_science";
+
   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");
-
   pictureNames[6] = "HKBU_physics";
+
   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");
-
   pictureNames[7] = "biorad";
+
   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");
-
   pictureNames[8] = "delta";
+
   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");
-
   pictureNames[9] = "genetimes";
+
   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.");
-
   pictureNames[10] = "invitrogen";
+
   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 alts = new Array();
+
   var i = 0;
-
  alts[0] = "The University of Hong Kong";
+
-
  alts[1] = "The University of Hong Kong Li Ka Shing Faculty of Medicine";
+
-
  alts[2] = "Department of Biochemistry, The University of Hong Kong";
+
-
  alts[3] = "Faculty of Science, The University of Hong Kong";
+
-
  alts[4] = "Hong Kong Baptist University";
+
-
  alts[5] = "Faculty of Science, Hong Kong Baptist University";
+
-
  alts[6] = "Department of Physics, Hong Kong Baptist University";
+
-
  alts[7] = "Bio-Rad Laboratories";
+
-
  alts[8] = "Delta Air Lines - Airline Tickets and Airfare to Worldwide Destinations";
+
-
  alts[9] = "Genetimes Technology, Inc.";
+
-
  alts[10] = "Invitrogen.com a Provider of Essential Life Science Technologies";
+
-
   var URLs = new Array()
+
   for (i in logos)
-
  URLs[0] = "http://www.hku.hk/";
+
    logos[i].addToLogos();
-
  URLs[1] = "http://www.hku.hk/facmed/";
+
}
-
  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 i = 0;
+
function removeTitle(){
-
   for (i in pictureNames)
+
   var el = document.getElementsByTagName("h1")[0];
-
     document.write("\
+
   if (el != null) {
-
      <div class=\"sponsorlogo\"><a href=\"" + URLs[i] + "\">\
+
    if (el.childNodes) {
-
         <img class=\"sponsorlogo\" src=\"HKU-HKBU_" + pictureNames[i] + "_240_60.png\" alt=\"" + alts[i] + "\" />\
+
      for (var i = 0; i < el.childNodes.length; i++) {
-
       </a></div>");
+
        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