Team:EPF-Lausanne/template/script.js
From 2013.igem.org
//Generate private namespace window.EPFL = (function(){
//Little hack to stop MediaWiki from replacing ampersands... var amp = unescape("%26"); return { init: function(){ EPFL.setupTitle(); EPFL.setupTOC(); $('p') .filter(function(){ return $.trim($(this).text()) === && $.trim($(this).html()).length < 10; }) .remove(); }, onLoad: function() { $(".main-item").on }, setupTOC: function(){ var toc = $("#toc"); toc.remove(); $(".paper").prepend(toc); }, setupTitle: function(){ var title = ""; if(window.titleOverride !== undefined && window.titleOverride !== "" && window.titleOverride !== " " && window.titleOverride !== "{{{1}}}"){ title = window.titleOverride; }else{ var title = $($(".firstHeading")[0]).text(); var prefix = "Team:EPF-Lausanne/"; title = title.substr(prefix.length); titleParts = title.split("/"); switch(titleParts[0]){ case "Template": titleParts.shift(); break; } var result = titleParts.join(" "); if(titleParts.length > 1){ result = titleParts.shift()+": "+titleParts.join(" "); } if(result == ""){ result = "Home"; } title = result; } $("#pageTitle").text(title); }, startTaxi: function() { var taxi = $("#taxi"); var menu = $($(".menu")[0]); var DURATION = 400; var EASING = "swing"; var DELAY = 800; var OFFSET = 15; var base = $(menu.find(".main-item")[0]); var current = $(menu.find(".main-item")[0]); current.addClass("menu-item-selected"); var returnTimeout = null; var gotoMenuItem = function(item) { if (current == item) return; current.removeClass("menu-item-selected"); current = item; current.addClass("menu-item-selected"); var menuPosition = 0;//menu.position().left; var currentPosition = $("#taxi").position().left var menuItemPosition = item.position().left; var targetPosition = menuItemPosition - menuPosition + OFFSET; $("#taxi").stop(true, false); $("#taxi").animate({left: targetPosition+"px"}, { duration: DURATION, easing: EASING }); if(currentPosition-menuPosition <= targetPosition) { $("#taxi").css({transform: "scale(1,1)", filter: ""}); } else { $("#taxi").css({transform: "scale(-1,1)", filter: "fliph"}); } }; var returnToBase = function() { gotoMenuItem(base); returnTimeout = null; } $(".menu-item").mouseover(function() { if(!$(this).hasClass("main-item")) return; if(returnTimeout != null) { clearTimeout(returnTimeout); returnTimeout = null; } gotoMenuItem($(this)); }).mouseout(function() { if(!$(this).hasClass("main-item")) return; if(returnTimeout == null) { returnTimeout = setTimeout(returnToBase, DELAY); } }); } };
}());
if(!window.console){
//Dummy console... window.console = { log: function(){ } };
}
$(function(){
EPFL.onLoad();
});
var oldRunOnloadHook = runOnloadHook; runOnloadHook = function(){
EPFL.init(); if (oldRunOnloadHook) oldRunOnloadHook();
};