Team:Newcastle/script/javascript.js

From 2013.igem.org

(Difference between revisions)
Line 17: Line 17:
     //alert(msg);
     //alert(msg);
     //YOUTUBER.loadUpdates();
     //YOUTUBER.loadUpdates();
-
      
+
     /*
     var loop1,
     var loop1,
     c1 = 0;
     c1 = 0;
Line 66: Line 66:
       }
       }
     });*/
     });*/
-
      
+
     /*
     var agentStr = navigator.userAgent;
     var agentStr = navigator.userAgent;
     if (agentStr.indexOf("Trident/5.0") > -1) {
     if (agentStr.indexOf("Trident/5.0") > -1) {
Line 82: Line 82:
     else
     else
         mode = "IE7";
         mode = "IE7";
-
      
+
     */
     // Code for organising pages into viewable
     // Code for organising pages into viewable
      
      
Line 92: Line 92:
      
      
     // Check that you're not on the calendar and that you're not in Compatibility View
     // Check that you're not on the calendar and that you're not in Compatibility View
-
     if(url[url.length - 1] != "calendar" && mode != "Compatibility View")
+
     if(url[url.length - 1] != "calendar")// && mode != "Compatibility View")
         ParsePage(location.hash);
         ParsePage(location.hash);
      
      
Line 124: Line 124:
         $('#pop_up').fadeOut();
         $('#pop_up').fadeOut();
     });
     });
-
      
+
     /*
     if(mode != "Compatibility View")
     if(mode != "Compatibility View")
     {
     {
Line 138: Line 138:
         });
         });
     }
     }
-
     /*
+
     */
     var tocLeft = $('#toc').offset().left - 10;
     var tocLeft = $('#toc').offset().left - 10;
     var tocTopPerm = $('#toc').offset().top - $(window).scrollTop();
     var tocTopPerm = $('#toc').offset().top - $(window).scrollTop();
Line 160: Line 160:
                           'left': '0px'});
                           'left': '0px'});
         }
         }
-
     });*/
+
     });
});
});

Revision as of 19:57, 1 October 2013

var toggleSpeed = 150; var msg = "~~MESSAGE FROM MATT (Updates)~~\n\n\nUpdate:22/05/2013 (05:00)\nAdded another display type, if you click \"Change Display\" at the top of the page you should see the display underneath the image carousel change.\n\nUpdate:21/05/2013 (22:00)\nAdded in a main display page, the interactive elements you see on this page would generaly only be used on the front page of the wiki, but of course we can use them where-ever we want. Colors can be made different instead of all the blocks being the same very easily as well.\nThe twitter feed bug has been fixed and should now work perfectly :)\n\nUpdate:20/05/2013 (04:30)\nThe twitter feed is currently linked to my account but this can easily be changed. I think having a twitter will be a good tool to use as marketing.\nThe drop down functionality on tweets is also a little buggy but I'll sort it out before the meeting on wednesday hopefully."; var current_display = 'main';

var cur_main_display = 1;

var leaveFeedOpen = false;

var firstTimeOpened = true;

var cur_content = "";

var mode = "temp";

$(function(){

   //alert(msg);
   //YOUTUBER.loadUpdates();
   /*
   var loop1,
   c1 = 0;
   var loop2,
   c2 = 0;
   var loop3,
   c3 = 0;
   var loop4,
   c4 = 0;
   /*
   $('.box_2').on('mouseenter mouseleave', function( e ){
      if( e.type=='mouseleave' ){
        clearInterval( loop1 );
      }else{
        loop1 = setInterval(function(){        
           $('.box_2 .slice').css({transform: "rotate("+ ( (++c1) % 360 ) +"deg)"});                
        },30);   
      }
   });
   
   $('.box_3').on('mouseenter mouseleave', function( e ){
      if( e.type=='mouseleave' ){
        clearInterval( loop2 );
      }else{
        loop2 = setInterval(function(){        
           $('.box_3 .slice').css({transform: "rotate("+ ( (++c2 * -1) % 360 ) +"deg)"});                
        },30);   
      }
   });
   
   $('.box_4').on('mouseenter mouseleave', function( e ){
      if( e.type=='mouseleave' ){
        clearInterval( loop3 );
      }else{
        loop3 = setInterval(function(){        
           $('.box_4 .slice').css({transform: "rotate("+ ( (++c3 * 1) % 360 ) +"deg)"});                
        },30);   
      }
   });
   
   $('.box_5').on('mouseenter mouseleave', function( e ){
      if( e.type=='mouseleave' ){
        clearInterval( loop4 );
      }else{
        loop4 = setInterval(function(){        
           $('.box_5 .slice').css({transform: "rotate("+ ( (++c4 * -1) % 360 ) +"deg)"});                
        },30);   
      }
   });*/
   /*
   var agentStr = navigator.userAgent;
   if (agentStr.indexOf("Trident/5.0") > -1) {
       if (agentStr.indexOf("MSIE 7.0") > -1)
           mode = "Compatibility View";
       else
           mode = "IE9";
   }
   else if (agentStr.indexOf("Trident/4.0") > -1) {
       if (agentStr.indexOf("MSIE 7.0") > -1)
           mode = "Compatibility View";
       else
           mode = "IE8";
   }
   else
       mode = "IE7";
   */
   // Code for organising pages into viewable
   
   // Strip the hash
   var href = (location.href).split("#");
   
   // Split the components
   var url = href[0].split("/");
   
   // Check that you're not on the calendar and that you're not in Compatibility View
   if(url[url.length - 1] != "calendar")// && mode != "Compatibility View")
       ParsePage(location.hash);
   
   $('.top_menu li').hover(function(){
       $(this).find('ul').slideDown(toggleSpeed);
   }, function(){
       $(this).find('ul').slideUp(toggleSpeed);
   });
   
   $('#twitter_feed').hover(function(){
       $('#tweet_case').slideDown(toggleSpeed);
   }, function(){
       $('#tweet_case').slideUp(toggleSpeed);
   });
   
   $('#image_display .proj_box, #image_display .image_box').hover(function(){
       $(this).find('.display_image').hide();
       $(this).find('.under_text').show();
   }, function(){
       $(this).find('.display_image').show();
       if(!($(this).hasClass('box_1')))
           $(this).find('.under_text').hide();
   });
   
   // Event handlers for closing the pop up box. Individual actions taken by a page must be created in that page's JQuery
   $('#pop_up #pop_up_close').click(function(){
       $('#pop_up').fadeOut();
   });
   
   $('#pop_up #pop_up_underlay').click(function(){
       $('#pop_up').fadeOut();
   });
   /*
   if(mode != "Compatibility View")
   {
       $('.toclevel-2').click(function(){
           
           var href = $(this).children('a').attr('href');
           
           $('#toc').find('a[href="' + cur_content + '"]').toggleClass('active');
           $('#bodyContent').find(cur_content + '_section').hide();
           $('#bodyContent').find(href + '_section').show();
           
           cur_content = href;
       });
   }
   */
   var tocLeft = $('#toc').offset().left - 10;
   var tocTopPerm = $('#toc').offset().top - $(window).scrollTop();
   
   $(window).scroll( function(e){
       
       var windowTop = $(window).scrollTop();
       var tocTop = $('#toc').offset().top;
       var contentTop = $('#page_content').offset().top - 10;
       //alert(windowTop);
       
       if(windowTop > contentTop)
       {
           $('#toc').css({'position': 'fixed',
                          'top': '5px',
                         'left':tocLeft});
       } else
       {
           $('#toc').css({'position': 'relative',
                          'top': '0px',
                         'left': '0px'});
       }
   });

});

function ParsePage(hash) {

//('
').insertAfter('#toc');
   //$('#toc').nextUntil('#logos').addClass("temp_for_wrap");
//$('.temp_for_wrap').wrapAll('
'); }