Team:TU-Munich/TUM13 Script

From 2013.igem.org

(Difference between revisions)
m
Line 424: Line 424:
function swaffel() {
function swaffel() {
-
   var volker = [ 'Molker Votorrad', 'Swolker', 'Vollgas Motorrad', 'Schmolkers Vorrat', 'Polter Volker', 'Volkan Murrat', 'Voll der Koller', 'Mullah Murrat', 'Mordsding Vollhart', 'Volter Streichzart', 'Vollkorn Mossart',  'Vortex Mozart',  'Vodka Melonath', 'Volker Racho', 'Molkers Vorrath', 'Herbert' ];
+
   var volker = [ 'Molker Votorrad', 'Swolker', 'Vollgas Motorrad', 'Schmolkers Vorrat', 'Polter Volker', 'Volkan Murrat', 'Voll der Koller', 'Mullah Murrat', 'Mordsding Vollhart', 'Volter Streichzart', 'Vollkorn Mossart',  'Vortex Mozart',  'Vodka Melonath', 'Volker Racho', 'Molkers Vorrath', 'Herbert' , 'Volker Willesso'];
   index = Math.round(Math.random() * volker.length);
   index = Math.round(Math.random() * volker.length);
   return volker[index];
   return volker[index];

Revision as of 02:11, 29 October 2013

function myWikiReady() {


// audio if ($('div#blubberkolben').length > 0) {

 preload('https://static.igem.org/mediawiki/2013/4/42/TUM13_blubber.gif');
 $('div#blubberkolben img').hover(function(e){
   $('div#blubberkolben img')[0].src = "TUM13_blubber.gif";
   $('div#blubberkolben').append($('<audio autobuffer autoplay loop><source src="https://static.igem.org/mediawiki/2013/b/b3/TUM13_blubbern.mp3" type="audio/mpeg"></audio>'));
 }, function(e){
   $('div#blubberkolben img')[0].src = "TUM13_blubbern-stop.gif";
   $('div#blubberkolben audio').remove();
 });

}


// put the footer in the right place

$("#footer-box").prepend($("#social-footer"));


// animate top button

function gotop(e){

 if ($(window).scrollTop() != 0) {
   $("a#gotop").fadeIn(400);
 } else {
   $("a#gotop").fadeOut(400);
 }

}

$("a#gotop").hide(0); gotop();

$(window).scroll(gotop); $("a#gotop").click(function(e){

 e.preventDefault();
 $(window).off('scroll', gotop);
 $('html, body').animate({scrollTop : 0},500,'swing',function(){$(window).scroll(gotop);$("a#gotop").fadeOut(400);});

});


// GET parsing

$.urlParam = function(name){

   var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
   if (results==null){
      return null;
   }
   else{
      while (results[1].indexOf('+') != -1) {
          results[1] = results[1].replace('+', ' ');
      }
      return results[1] || 0;
   }

};


// implement image preloading

function preload() {

   var images = new Array()
   for (i = 0; i < preload.arguments.length; i++) {
       images[i] = new Image()
       images[i].src = preload.arguments[i]
   }

}

// FilterModel

if ($('#rafts').length > 0) {

   initFilterModel();

}

// preload menu backgrounds

preload( "TUM13_menu-highlight.png",

        "TUM13_submenu-bg.png",
        "TUM13_submenu-highlight.png",
        "TUM13_tour-start-highlight.png",
        "TUM13_tour-previous-highlight.png",
        "TUM13_tour-next-highlight.png",
        "TUM13_button-application-highlight.png",
        "TUM13_button-autoannotator-highlight.png",
        "TUM13_button-physco-highlight.png",
        "TUM13_button-entrepreneur-highlight.png",
        "TUM13_button-safety-highlight.png",
        "TUM13_button-judging-highlight.png",
        "TUM13_gotop-highlight.png",
        "TUM13_gotop.png",
        "TUM13_ajax-loading.gif",
        "TUM13_ajax-bg.png" );

// preload footer links

preload( "TUM13_address-highlight.png",

        "TUM13_contact-icon-highlight.png",
        "TUM13_facebook-icon-highlight.png",
        "TUM13_twitter-icon-highlight.png",
        "TUM13_youtube-icon-highlight.png" );

// preload team pictures

if ( $("div#teamfield").length > 0 ) { preload( "TUM13_moos.png",

        "TUM13_katrin-front.png",        // Katrin
        "TUM13_katrin-t.png",
        "TUM13_katrin-t-l.png",
        "TUM13_katrin-l.png",
        "TUM13_katrin-b-l.png",
        "TUM13_katrin-b.png",
        "TUM13_katrin-b-r.png",
        "TUM13_katrin-r.png",
        "TUM13_katrin-t-r.png",
        "TUM13_rosario-front.png",        // Rosario
        "TUM13_rosario-t.png",
        "TUM13_rosario-t-l.png",
        "TUM13_rosario-l.png",
        "TUM13_rosario-b-l.png",
        "TUM13_rosario-b.png",
        "TUM13_rosario-b-r.png",
        "TUM13_rosario-r.png",
        "TUM13_rosario-t-r.png",
        "TUM13_fabian-front.png",        // Fabian
        "TUM13_fabian-t.png",
        "TUM13_fabian-t-l.png",
        "TUM13_fabian-l.png",
        "TUM13_fabian-b-l.png",
        "TUM13_fabian-b.png",
        "TUM13_fabian-b-r.png",
        "TUM13_fabian-r.png",
        "TUM13_fabian-t-r.png",
        "TUM13_andreas-front.png",        // Andreas
        "TUM13_andreas-t.png",
        "TUM13_andreas-t-l.png",
        "TUM13_andreas-l.png",
        "TUM13_andreas-b-l.png",
        "TUM13_andreas-b.png",
        "TUM13_andreas-b-r.png",
        "TUM13_andreas-r.png",
        "TUM13_andreas-t-r.png",
        "TUM13_louise-front.png",        // Louise
        "TUM13_louise-t.png",
        "TUM13_louise-t-l.png",
        "TUM13_louise-l.png",
        "TUM13_louise-b-l.png",
        "TUM13_louise-b.png",
        "TUM13_louise-b-r.png",
        "TUM13_louise-r.png",
        "TUM13_louise-t-r.png",
        "TUM13_johanna-front.png",        // Johanna
        "TUM13_johanna-t.png",
        "TUM13_johanna-t-l.png",
        "TUM13_johanna-l.png",
        "TUM13_johanna-b-l.png",
        "TUM13_johanna-b.png",
        "TUM13_johanna-b-r.png",
        "TUM13_johanna-r.png",
        "TUM13_johanna-t-r.png",
        "TUM13_meike-front.png",        // Meike
        "TUM13_meike-t.png",
        "TUM13_meike-t-l.png",
        "TUM13_meike-l.png",
        "TUM13_meike-b-l.png",
        "TUM13_meike-b.png",
        "TUM13_meike-b-r.png",
        "TUM13_meike-r.png",
        "TUM13_meike-t-r.png",
        "TUM13_volker-front.png",        // Volker
        "TUM13_volker-t.png",
        "TUM13_volker-t-l.png",
        "TUM13_volker-l.png",
        "TUM13_volker-b-l.png",
        "TUM13_volker-b.png",
        "TUM13_volker-b-r.png",
        "TUM13_volker-r.png",
        "TUM13_volker-t-r.png",
        "TUM13_polte-front.png",        // Polte
        "TUM13_polte-t.png",
        "TUM13_polte-t-l.png",
        "TUM13_polte-l.png",
        "TUM13_polte-b-l.png",
        "TUM13_polte-b.png",
        "TUM13_polte-b-r.png",
        "TUM13_polte-r.png",
        "TUM13_polte-t-r.png",
        "TUM13_leonie-front.png",        // Leonie
        "TUM13_leonie-t.png",
        "TUM13_leonie-t-l.png",
        "TUM13_leonie-l.png",
        "TUM13_leonie-b-l.png",
        "TUM13_leonie-b.png",
        "TUM13_leonie-b-r.png",
        "TUM13_leonie-r.png",
        "TUM13_leonie-t-r.png",
        "TUM13_philipp-front.png",        // Philipp
        "TUM13_philipp-t.png",
        "TUM13_philipp-t-l.png",
        "TUM13_philipp-l.png",
        "TUM13_philipp-b-l.png",
        "TUM13_philipp-b.png",
        "TUM13_philipp-b-r.png",
        "TUM13_philipp-r.png",
        "TUM13_philipp-t-r.png",
        "TUM13_jeff-front.png",        // Jeff
        "TUM13_jeff-t.png",
        "TUM13_jeff-t-l.png",
        "TUM13_jeff-l.png",
        "TUM13_jeff-b-l.png",
        "TUM13_jeff-b.png",
        "TUM13_jeff-b-r.png",
        "TUM13_jeff-r.png",
        "TUM13_jeff-t-r.png",
        "TUM13_chris-front.png",        // Chris
        "TUM13_chris-t.png",
        "TUM13_chris-t-l.png",
        "TUM13_chris-l.png",
        "TUM13_chris-b-l.png",
        "TUM13_chris-b.png",
        "TUM13_chris-b-r.png",
        "TUM13_chris-r.png",
        "TUM13_chris-t-r.png",
        "TUM13_flo-front.png",        // Flo
        "TUM13_flo-t.png",
        "TUM13_flo-t-l.png",
        "TUM13_flo-l.png",
        "TUM13_flo-b-l.png",
        "TUM13_flo-b.png",
        "TUM13_flo-b-r.png",
        "TUM13_flo-r.png"/*,
        "TUM13_jeff-anim.gif",        // Gifs
        "TUM13_rosario-anim.gif",
        "TUM13_fabian-anim.gif",
        "TUM13_philipp-anim.gif",
        "TUM13_johanna-anim.gif",
        "TUM13_andi-anim.gif",
        "TUM13_flo-anim.gif",
        "TUM13_polte-anim.gif",
        "TUM13_leonie-anim.gif",
        "TUM13_louise-anim.gif",
        "TUM13_chris-anim.gif",
        "TUM13_katrin-anim.gif",
        "TUM13_meike-anim.gif" */ );

}

// Slideshows

$('.bxslider').bxSlider({

   responsive: false,
   auto: true,
   autoHover: true,
   captions: true

});

$('.bxgallery').bxSlider({

   captions: true,
   slideMargin: 10,
   minSlides: 3,
   maxSlides: 3,
   moveSlides: 1,
   slideWidth: 5000

});

// Lightbox

$("div.thumbinner > a img").slimbox({}, function(el) { url = el.src; if (url.indexOf('thumb') != -1) { url = url.substring(0, url.lastIndexOf('/')); url = url.replace('/thumb/', '/'); } description = $(el).parents("div.thumbinner").children("div.thumbcaption").text(); return [url, description]; }, function(el) { return (this == el); });

$("ul.bxgallery img").slimbox({ loop: true }, function(el) { url = el.src; if (url.indexOf('thumb') != -1) { url = url.substring(0, url.lastIndexOf('/')); url = url.replace('/thumb/', '/'); } description = el.title + el.alt; return [url, description]; }, function(el) { return (this == el) || (this.parentNode.parentNode && (this.parentNode.parentNode == el.parentNode.parentNode)); });


// Counter and Countdown

function render_counter(c) { i = 0; iid = window.setInterval(function(){ if ( (c-i) > (c/200) ) { $('span#counter').html(i); i += Math.round(c/200); } else { $('span#counter').html(c); window.clearInterval(iid); } }, 10); }

if ($('span#counter').length > 0) { $.ajax({ url: "https://2013.igem.org/Special:PopularPages", success: function( html ) { dom = $.parseHTML(html); visitors = $(dom).find('a[title="Team:TU-Munich"]').parent().text(); visitors = visitors.substring(visitors.indexOf('(')+1); visitors = visitors.substring(0, visitors.indexOf(' ')); visitors = visitors.replace(',', ); render_counter(visitors); }, error: function( xhr, status ) { render_counter(4700); } }); }

if ($('span#countdown').length > 0) { clock = window.setInterval(function(){ jetzt = new Date(); time_left = Date.UTC(2013, 9, 29, 4, 0, 0) - Date.UTC(jetzt.getUTCFullYear(), jetzt.getUTCMonth(), jetzt.getUTCDate(), jetzt.getUTCHours(), jetzt.getUTCMinutes(), jetzt.getUTCSeconds()); time_left = (time_left < 0) ? 0 : time_left ; left_sec = (time_left/1000)%60; left_sec = (left_sec < 10) ? "0" + left_sec : left_sec; left_min = Math.floor(time_left/60000)%60; left_min = (left_min < 10) ? "0" + left_min : left_min; left_h = Math.floor(time_left/3600000)%24; left_h = (left_h < 10) ? "0" + left_h : left_h; left_d = Math.floor(time_left/86400000); left_d = (left_d == 1) ? left_d + " day" : left_d + " days"; $('span#countdown').html(left_d + " " + left_h + ":" + left_min + ":" + left_sec); }, 1000); }


// Animate teamfield

if ( $("div#teamfield").length > 0 ) {

var $members = $("div#teamfield a");

$("body").mousemove(function(event){ for (i=0; i<$members.length; i++) {

if ( $members.eq(i).offset().left > event.pageX ) {

   if ( $members.eq(i).offset().top > event.pageY ) {
       $members.eq(i).removeClass();
       $members.eq(i).addClass("top-left");
   } else if ( $members.eq(i).offset().top <= event.pageY && ( $members.eq(i).offset().top + $members.eq(i).height() ) >= event.pageY ) {
       $members.eq(i).removeClass();
       $members.eq(i).addClass("left");
   } else if ( ( $members.eq(i).offset().top + $members.eq(i).height() ) < event.pageY ) {
       $members.eq(i).removeClass();
       $members.eq(i).addClass("bottom-left");
   }

} else if ( $members.eq(i).offset().left <= event.pageX && ( $members.eq(i).offset().left + $members.eq(i).width() ) >= event.pageX ) {

   if ( $members.eq(i).offset().top > event.pageY ) {
       $members.eq(i).removeClass();
       $members.eq(i).addClass("top");
   } else if ( $members.eq(i).offset().top <= event.pageY && ( $members.eq(i).offset().top + $members.eq(i).height() ) >= event.pageY ) {
       $members.eq(i).removeClass();
       $members.eq(i).addClass("front");
   } else if ( ( $members.eq(i).offset().top + $members.eq(i).height() ) < event.pageY ) {
       $members.eq(i).removeClass();
       $members.eq(i).addClass("bottom");
   }    

} else if ( ( $members.eq(i).offset().left + $members.eq(i).width() ) < event.pageX ) {

   if ( $members.eq(i).offset().top > event.pageY ) {
       $members.eq(i).removeClass();
       $members.eq(i).addClass("top-right");
   } else if ( $members.eq(i).offset().top <= event.pageY && ( $members.eq(i).offset().top + $members.eq(i).height() ) >= event.pageY ) {
       $members.eq(i).removeClass();
       $members.eq(i).addClass("right");
   } else if ( ( $members.eq(i).offset().top + $members.eq(i).height() ) < event.pageY ) {
       $members.eq(i).removeClass();
       $members.eq(i).addClass("bottom-right");
   }  

}

} });

// team gifs /* $("div.team img").hover(function(e){

   // alert("Test");
   if (this.src.search(/gif/) != -1) {
     tmp = this.src;
     this.src = this.alt;
     this.alt = tmp;
   }

});

  • /

// name generator

function swaffel() {

 var volker = [ 'Molker Votorrad', 'Swolker', 'Vollgas Motorrad', 'Schmolkers Vorrat', 'Polter Volker', 'Volkan Murrat', 'Voll der Koller', 'Mullah Murrat', 'Mordsding Vollhart', 'Volter Streichzart', 'Vollkorn Mossart',  'Vortex Mozart',  'Vodka Melonath', 'Volker Racho', 'Molkers Vorrath', 'Herbert' , 'Volker Willesso'];
 index = Math.round(Math.random() * volker.length);
 return volker[index];

}

$('span#swolker').html(swaffel());

$('span#swolker').click(function(e){

 $('span#swolker').html(swaffel());

});

}

}

$(document).ready(myWikiReady);