Team:Uppsala/JavaScript

From 2014.igem.org

(Difference between revisions)
 
(37 intermediate revisions not shown)
Line 23: Line 23:
     });
     });
});
});
-
 
jQuery(document).ready(function() {
jQuery(document).ready(function() {
-
   $(document).click(function(e) {
+
   $(document).click(function() {
-
  var target = $(e.target);
+
-
   if ((target.is('#master') || target.is('#imagediv div')) && $('.view').css("opacity") == 1)
+
   if ( $('.view').css("opacity") == 1){
-
  {
+
   toggleVisibility('intro');
   toggleVisibility('intro');
   }
   }
Line 41: Line 38:
jQuery(document).ready(function() {
jQuery(document).ready(function() {
-
   $(document).click(function(f) {
+
   $(document).click(function() {
-
      var target = $(f.target);
+
-
      if (target.is('#launchDemo')){
+
  if ( $('.view').css("opacity") == 1){
 +
  toggleVisibility('intro');
 +
  }
-
        var url = "http://xbio.cloudcontrolled.com/Java/Test.jnlp";
 
-
        window.open(url,"BacterField")
 
-
        //deployJava.createWebStartLaunchButton(url, '1.7.0'); 
 
-
      }
 
-
 
-
      else if (target.is('#downloadDemo')){
 
-
 
-
        var url = "http://xbio.cloudcontrolled.com/Java/BacterFieldDemo.jar";
 
-
        window.open(url,"BacterField")
 
-
        //deployJava.createWebStartLaunchButton(url, '1.7.0'); 
 
-
      }
 
   });
   });
});
});
 +
jQuery(document).ready(function() {
jQuery(document).ready(function() {
Line 100: Line 88:
         if (target.is(str)) {
         if (target.is(str)) {
           document.getElementById("calendar_head").innerHTML = calendar_dates_array[i];
           document.getElementById("calendar_head").innerHTML = calendar_dates_array[i];
-
           var work_str = "";
+
           var work_str = "<tr><th>Strain</th><th>Backbone</th><th>Construct</th><th>Work</th><th>Person</th></tr>";
-
          var test = "<p id="test">heej</p>";
+
         
           for(j = 0; j < work_database[i].length; j++) {
           for(j = 0; j < work_database[i].length; j++) {
-
           work_str = work_str + work_database[i][j] + "<br>";
+
           work_str = work_str + work_database[i][j];
           }
           }
-
           document.getElementById("calendar_work").innerHTML = test;
+
 
 +
           document.getElementById("calendar_work").innerHTML = work_str;
           {break}
           {break}
         }
         }

Latest revision as of 13:32, 16 October 2014

jQuery(document).ready(function() {

   var button = ('.back-to-top'), timer;
   var offset = 500;
   var duration = 1000;
 jQuery(window).scroll(function() {
       if (jQuery(this).scrollTop() > offset) {
           jQuery(button).fadeIn(duration);
           clearTimeout(timer);
           timer = setTimeout(function() {
           jQuery(button).stop(true, true).fadeOut(duration);}, 2000);    
       }
        
        if (jQuery(this).scrollTop() < offset) {
        jQuery(button).fadeOut(duration);
        }        
  });
      
   jQuery(button).click(function(event) {
       event.preventDefault();
       jQuery('html, body').animate({scrollTop: 0}, duration);
       return false;
   });

});

jQuery(document).ready(function() {

  $(document).click(function() {
  if ( $('.view').css("opacity") == 1){
  toggleVisibility('intro');
  }
  });

});


jQuery(document).ready(function() {

  $(document).click(function() {
  if ( $('.view').css("opacity") == 1){
  toggleVisibility('intro');
  }
  });

});


jQuery(document).ready(function() {

  $(document).click(function(f) {
     var target = $(f.target);
     if (target.is('#week_incr')){
      if (calendar_week_var < total_weeks) {
       calendar_week_var = calendar_week_var + 1;
      }
       document.getElementById("calendar_week").innerHTML = "week " + calendar_week_var;  
      
       for(i = ((calendar_week_var*7)-7); i < (calendar_week_var*7); i++) {
         var str = "calendar_day" + (i+1-((calendar_week_var-1)*7));
         document.getElementById(str).innerHTML = calendar_dates_array[i];
       }
     }
     else if (target.is('#week_decr')){
       if (calendar_week_var > 1) {
       calendar_week_var = calendar_week_var - 1;
       }
       document.getElementById("calendar_week").innerHTML = "week " + calendar_week_var;
       
       for(i = ((calendar_week_var*7)-7); i < (calendar_week_var*7); i++) {
         var str = "calendar_day" + (i+1-((calendar_week_var-1)*7));
         document.getElementById(str).innerHTML = calendar_dates_array[i];
       }
     }
  });

});

jQuery(document).ready(function() {

  $(document).click(function(f) {
     var target = $(f.target);
          
     for(i = ((calendar_week_var*7)-7); i < (calendar_week_var*7); i++) {
       var str = "#calendar_day" + (i+1-((calendar_week_var-1)*7));
       if (target.is(str)) {
         document.getElementById("calendar_head").innerHTML = calendar_dates_array[i];
         var work_str = "<tr><th>Strain</th><th>Backbone</th><th>Construct</th><th>Work</th><th>Person</th></tr>";
         
         for(j = 0; j < work_database[i].length; j++) {
          work_str = work_str + work_database[i][j];
         }
         document.getElementById("calendar_work").innerHTML = work_str;
         {break}
       }
     }
  });

});