Team:TU-Munich/TUM13 Script
From 2013.igem.org
(72 intermediate revisions not shown) | |||
Line 1: | Line 1: | ||
- | $( | + | function myWikiReady() { |
+ | |||
+ | |||
+ | // audio | ||
+ | if ($('div#blubberkolben').length > 0) { | ||
+ | preload('https://static.igem.org/mediawiki/2013/4/42/TUM13_blubber.gif'); | ||
+ | $('div#blubberkolben').hover(function(e){ | ||
+ | $('div#blubberkolben img')[0].src = "https://static.igem.org/mediawiki/2013/4/42/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 = "https://static.igem.org/mediawiki/2013/a/ab/TUM13_blubbern-stop.gif"; | ||
+ | $('div#blubberkolben audio').remove(); | ||
+ | }); | ||
+ | } | ||
Line 5: | Line 18: | ||
$("#footer-box").prepend($("#social-footer")); | $("#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 | // GET parsing | ||
Line 20: | Line 55: | ||
} | } | ||
}; | }; | ||
+ | |||
// implement image preloading | // implement image preloading | ||
Line 31: | Line 67: | ||
} | } | ||
+ | // FilterModel | ||
+ | |||
+ | if ($('#rafts').length > 0) { | ||
+ | initFilterModel(); | ||
+ | } | ||
// preload menu backgrounds | // preload menu backgrounds | ||
Line 36: | Line 77: | ||
preload( "https://static.igem.org/mediawiki/2013/9/95/TUM13_menu-highlight.png", | preload( "https://static.igem.org/mediawiki/2013/9/95/TUM13_menu-highlight.png", | ||
"https://static.igem.org/mediawiki/2013/4/4e/TUM13_submenu-bg.png", | "https://static.igem.org/mediawiki/2013/4/4e/TUM13_submenu-bg.png", | ||
- | "https://static.igem.org/mediawiki/2013/d/db/TUM13_submenu-highlight.png" ); | + | "https://static.igem.org/mediawiki/2013/d/db/TUM13_submenu-highlight.png", |
+ | "https://static.igem.org/mediawiki/2013/5/5f/TUM13_tour-start-highlight.png", | ||
+ | "https://static.igem.org/mediawiki/2013/6/6e/TUM13_tour-previous-highlight.png", | ||
+ | "https://static.igem.org/mediawiki/2013/3/35/TUM13_tour-next-highlight.png", | ||
+ | "https://static.igem.org/mediawiki/2013/4/44/TUM13_button-application-highlight.png", | ||
+ | "https://static.igem.org/mediawiki/2013/a/a7/TUM13_button-autoannotator-highlight.png", | ||
+ | "https://static.igem.org/mediawiki/2013/d/d5/TUM13_button-physco-highlight.png", | ||
+ | "https://static.igem.org/mediawiki/2013/e/e6/TUM13_button-entrepreneur-highlight.png", | ||
+ | "https://static.igem.org/mediawiki/2013/0/01/TUM13_button-safety-highlight.png", | ||
+ | "https://static.igem.org/mediawiki/2013/d/d6/TUM13_button-judging-highlight.png", | ||
+ | "https://static.igem.org/mediawiki/2013/c/c5/TUM13_gotop-highlight.png", | ||
+ | "https://static.igem.org/mediawiki/2013/2/2d/TUM13_gotop.png", | ||
+ | "https://static.igem.org/mediawiki/2013/b/b4/TUM13_ajax-loading.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/2/29/TUM13_ajax-bg.png" ); | ||
// preload footer links | // preload footer links | ||
Line 174: | Line 228: | ||
"https://static.igem.org/mediawiki/2013/6/6b/TUM13_flo-b.png", | "https://static.igem.org/mediawiki/2013/6/6b/TUM13_flo-b.png", | ||
"https://static.igem.org/mediawiki/2013/4/4b/TUM13_flo-b-r.png", | "https://static.igem.org/mediawiki/2013/4/4b/TUM13_flo-b-r.png", | ||
- | "https://static.igem.org/mediawiki/2013/3/30/TUM13_flo-r.png", | + | "https://static.igem.org/mediawiki/2013/3/30/TUM13_flo-r.png"/*, |
- | "https://static.igem.org/mediawiki/2013/ | + | "https://static.igem.org/mediawiki/2013/5/5d/TUM13_jeff-anim.gif", // Gifs |
+ | "https://static.igem.org/mediawiki/2013/f/f9/TUM13_rosario-anim.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/d/d1/TUM13_fabian-anim.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/a/aa/TUM13_philipp-anim.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/f/ff/TUM13_johanna-anim.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/a/a5/TUM13_andi-anim.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/e/ea/TUM13_flo-anim.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/6/6c/TUM13_polte-anim.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/7/70/TUM13_leonie-anim.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/2/24/TUM13_louise-anim.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/9/9b/TUM13_chris-anim.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/6/6c/TUM13_katrin-anim.gif", | ||
+ | "https://static.igem.org/mediawiki/2013/5/5e/TUM13_meike-anim.gif" */ ); | ||
} | } | ||
Line 183: | Line 249: | ||
responsive: false, | responsive: false, | ||
auto: true, | auto: true, | ||
- | autoHover: true | + | autoHover: true, |
+ | captions: true | ||
}); | }); | ||
$('.bxgallery').bxSlider({ | $('.bxgallery').bxSlider({ | ||
+ | captions: true, | ||
slideMargin: 10, | slideMargin: 10, | ||
minSlides: 3, | minSlides: 3, | ||
Line 196: | Line 264: | ||
// Lightbox | // Lightbox | ||
- | $("div.thumbinner > a img").slimbox({ | + | $("div.thumbinner > a img").slimbox({}, function(el) { |
url = el.src; | url = el.src; | ||
if (url.indexOf('thumb') != -1) { | if (url.indexOf('thumb') != -1) { | ||
Line 214: | Line 282: | ||
url = url.replace('/thumb/', '/'); | url = url.replace('/thumb/', '/'); | ||
} | } | ||
- | + | description = el.title + el.alt; | |
- | return [url, | + | return [url, description]; |
}, function(el) { | }, function(el) { | ||
return (this == el) || (this.parentNode.parentNode && (this.parentNode.parentNode == el.parentNode.parentNode)); | return (this == el) || (this.parentNode.parentNode && (this.parentNode.parentNode == el.parentNode.parentNode)); | ||
Line 256: | Line 324: | ||
clock = window.setInterval(function(){ | clock = window.setInterval(function(){ | ||
jetzt = new Date(); | jetzt = new Date(); | ||
- | time_left = Date.UTC(2013, 9, | + | 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 ; | time_left = (time_left < 0) ? 0 : time_left ; | ||
left_sec = (time_left/1000)%60; | left_sec = (time_left/1000)%60; | ||
Line 342: | Line 410: | ||
}); | }); | ||
+ | // 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); |
Latest revision as of 19:27, 9 May 2014
function myWikiReady() {
// audio
if ($('div#blubberkolben').length > 0) {
preload('https://static.igem.org/mediawiki/2013/4/42/TUM13_blubber.gif'); $('div#blubberkolben').hover(function(e){ $('div#blubberkolben img')[0].src = ""; $('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 = ""; $('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( "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "" );
// preload footer links
preload( "",
"", "", "", "" );
// preload team pictures
if ( $("div#teamfield").length > 0 ) { preload( "",
"", // Katrin "", "", "", "", "", "", "", "", "", // Rosario "", "", "", "", "", "", "", "", "", // Fabian "", "", "", "", "", "", "", "", "", // Andreas "", "", "", "", "", "", "", "", "", // Louise "", "", "", "", "", "", "", "", "", // Johanna "", "", "", "", "", "", "", "", "", // Meike "", "", "", "", "", "", "", "", "", // Volker "", "", "", "", "", "", "", "", "", // Polte "", "", "", "", "", "", "", "", "", // Leonie "", "", "", "", "", "", "", "", "", // Philipp "", "", "", "", "", "", "", "", "", // Jeff "", "", "", "", "", "", "", "", "", // Chris "", "", "", "", "", "", "", "", "", // Flo "", "", "", "", "", "", ""/*, "", // Gifs "", "", "", "", "", "", "", "", "", "", "", "" */ );
}
// 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);