Team:Grenoble/script

From 2012.igem.org

(Difference between revisions)
 
(132 intermediate revisions not shown)
Line 1: Line 1:
<html>
<html>
<script type="text/javascript">
<script type="text/javascript">
-
alert("coucou");
+
$(document).ready(
-
var t=navigator.appVersion.match(/MSIE/i)?navigator.appVersion.replace(/.*?MSIE ([^;]+);.*/i,"$1"):null;function u(c,a){var b,d={};for(b in a){d[b]=a[b]}for(b in c){d[b]=c[b]}return d}function v(c,a){return(a||o).getElementsByTagName(c)}function w(){var c,a,b=r,d=o,e=d.documentElement,f=d.body;if(b.innerWidth){c=b.innerWidth;a=b.innerHeight}else if(e.clientWidth){c=e.clientWidth;a=e.clientHeight}else{c=f.clientWidth;a=f.clientHeight}return{'w':c,'h':a}}function x(){var c=o,a=c.documentElement,b=c.body,d,e;e=a.scrollHeight;d=a.scrollWidth;if(a.clientHeight>e){e=a.clientHeight}if(a.clientWidth>d){d=a.clientWidth}if(b.scrollHeight>e){e=b.scrollHeight}if(b.scrollWidth>d){d=b.scrollWidth}return{'w':d,'h':e}}function y(c,a,b,d){if(c.addEventListener){c.addEventListener(a,b,d)}else{c.attachEvent("on"+a,b)}}function s(c,a){for(var b in a){c.style[b]=a[b]}}function p(c,a){a=(a==1)?0.99999:a;c.style.opacity=a;c.style.filter='alpha(opacity='+a*100+')';c.style.MozOpacity=a;c.style.KhtmlOpacity=a}function z(c,a,b,d){this.elem=c||o.body;this.to=a!==undefined?a:1;var e=this.elem.style;this.from=(b===undefined?(!e.opacity&&e.opacity!==0?(this.to>0?0:1):parseFloat(e.opacity)):b);d=d||{};this.duration=d.duration||500;this.frameRate=d.frameRate||30;this.onFinish=d.onFinish;this.totalFrames=Math.ceil(this.duration/1000*this.frameRate);this.perFrame=(this.to-this.from)/this.totalFrames;this.frameNb=0;var f=this;this.next=function(){this.prog=setTimeout(function(){f.frame()},1000/this.frameRate)};this.frame=function(){p(this.elem,this.from+this.perFrame*this.frameNb);if(this.frameNb===this.totalFrames){p(this.elem,this.to);if(typeof this.onFinish=='function'){setTimeout(this.onFinish,1)}}else{this.frameNb++;this.next()}};this.next()}function A(c,a,b){var d,e,f,j,k,l,i,g,h;b=b||{};d=b.max_w;e=b.min_w;f=b.max_h;j=b.max_h;k=b.round===undefined?1:b.round;l=c/a;i=a/c;g=a;h=c;if(h<e){h=e;g=h*i}if(g<j){g=j;h=g*l}if(d&&(h>d)){h=d;g=h*i}if(f&&(g>f)){g=f;h=g*l}h=h<0?0:h;g=g<0?0:g;return{w:k?Math.round(h):h,h:k?Math.round(g):g}}var q={defaults:{mode:'max',enlarge:1,reduce:1,ffHack:0,zIndex:-1,position:'absolute',align:'center',vertAlign:'top',fadeAfter:400,fadeOptions:{duration:1000,frameRate:25}},redim:function(){var c=q,a,b,d=w(),e,f,j,k,l,i,g,h,m,n;a=c.img;f=j=k=l='';b=c.opt;i=a.fileDim;if(i){if(b.mode=='full'){g=m=d.w;h=n=d.h;if(!b.enlarge){if(g>i.w){g=m=i.w}if(h>i.h){h=n=i.h}}if(!b.reduce){if(m<i.w){m=i.w;g=Math.max(m,g)}if(n<i.h){n=i.h;h=Math.max(n,h)}}}else{m=g=d.w;n=h=0;if(!b.reduce){g=0}}i=A(i.w,i.h,{min_w:m,win_h:n,max_w:g,max_h:h,round:1});a.width=i.w;a.height=i.h;if(!a.width){a.removeAttribute("width")}if(!a.height){a.removeAttribute("height")}switch(b.align){case'left':k='0px';break;case'right':l='0px';break;default:k=-Math.round((i.w-d.w)/2)+'px'}if(b.vertAlign=='bottom'){j='0px'}else if(b.vertAlign=='middle'){e=b.position=="fixed"?d.h:x().h;f=(-b.ffHack+(e-a.offsetHeight)/2)+"px"}else{f=a.hack||'0px'}s(a,{left:k,right:l,top:f,bottom:j})}},show:function(){var c=q,a;a=c.img;a.fileDim={w:a.naturalWidth||a.clientWidth,h:a.naturalHeight||a.clientHeight};c.redim();if(c.fadeIt){z(c.img,1,0,c.opt.fadeOptions)}else{p(a,1)}},init:function(c,a){var b=q,d=v('body')[0],e,f,j;a=u(a,this.defaults);if(t&&t<7){a.position='absolute'}b.opt=a;e=a.fadeAfter;f=b.img=o.createElement('img');f.id="bgMax";s(f,{zIndex:a.zIndex,position:a.position});j=navigator.userAgent.match(/Firefox.(\d+(\.\d+))/);if(j&&parseFloat(j[1])<3){s(d,{zIndex:0,position:'relative',top:0,left:0});f.hack='-'+a.ffHack}d.insertBefore(f,d.childNodes[0]);f.onload=b.show;if(e!==false){p(f,0);if(e){setTimeout(function(){b.fadeIt=1},e)}else{b.fadeIt=1}}y(r,'resize',b.redim);f.src=c}};r.bgMax=q;
+
function(){
-
alert("coucou");
+
$("ul.topnav li").hover(
 +
function() {
 +
// Hover over
 +
$(this).parent().find("ul.subnav").hide();
 +
$(this).find("ul.subnav").show();
 +
// Hover out
 +
$(this).hover(
 +
function() {
 +
},
 +
function(){
 +
$(this).find("ul.subnav").hide();
 +
}
 +
);
 +
},
 +
function(){
 +
$(this).find("ul.subnav").hide();
 +
}
 +
 
 +
);
 +
}
 +
);
</script>
</script>
 +
 +
<!--<script type="text/javascript">
 +
$(document).ready(
 +
function(){
 +
$("ul.menu li").hover(
 +
function() {
 +
// Hover over
 +
$(this).parent().find("ul.submenu").hide();
 +
$(this).find("ul.submenu").show();
 +
// Hover out
 +
$(this).hover(
 +
function() {
 +
},
 +
function(){
 +
$(this).find("ul.submenu").hide();
 +
}
 +
);
 +
},
 +
function(){
 +
$(this).find("ul.submenu").hide();
 +
}
 +
 +
);
 +
}
 +
);
 +
</script>-->
 +
 +
<script type="text/javascript">
 +
$(document).ready(
 +
function(){
 +
$("ul.mini li").hover(
 +
function() {
 +
// Hover over
 +
$(this).parent().find("ul.maxi").hide();
 +
$(this).find("ul.maxi").show();
 +
// Hover out
 +
$(this).hover(
 +
function() {
 +
},
 +
function(){
 +
$(this).find("ul.maxi").hide();
 +
}
 +
);
 +
},
 +
function(){
 +
$(this).find("ul.maxi").hide();
 +
}
 +
 +
);
 +
}
 +
);
 +
</script>
 +
 +
<!--<script type="text/javascript">
 +
$(document).ready(
 +
function(){
 +
$("demo").hover(
 +
function() {
 +
// Hover over
 +
$(this).parent().find("to_hide").hide();
 +
$(this).find("to_hide").show();
 +
// Hover out
 +
$(this).hover(
 +
function() {
 +
},
 +
function(){
 +
$(this).find("to_hide").hide();
 +
}
 +
);
 +
},
 +
function(){
 +
$(this).find("to_hide").hide();
 +
}
 +
 +
);
 +
}
 +
);
 +
</script>-->
 +
 +
<script type="text/javascript">
 +
function swap_div(my_div, my_object)
 +
{
 +
if (document.getElementById(my_div).style.display == "none")
 +
{
 +
document.getElementById(my_div).style.display = "all";
 +
my_object.value = "Cacher";
 +
}
 +
else
 +
{
 +
document.getElementById(my_div).style.display = "none";
 +
my_object.value = "Afficher";
 +
}
 +
}
 +
</script>
 +
 +
 +
<script type="text/javascript">
 +
// Méthode pour changer la visiblité d'une balise dont l'ID est passée en paramètre
 +
function toggleVisibility(tagId) {
 +
if (!document.getElementById) {
 +
msg = 'Votre navigateur est trop ancien pour profiter de votre visite\n';
 +
msg += 'Veuillez le mettre à jour ou vous en procurer un autre';
 +
return false;
 +
}
 +
var tagToToggle;
 +
try { // On tente de récupérer la balise cible dont on doit changer la visibilité
 +
tagToToggle = document.getElementById(tagId);
 +
} catch (e) { // Si échec de la récupération de la balise cible
 +
alert('Je n\'ai pas pu trouver la balise cible');
 +
}
 +
try { // Seulement pour les non IE
 +
if (tagToToggle.style.display == 'none') {
 +
tagToToggle.style.display = 'inline';
 +
} else {
 +
tagToToggle.style.display = 'none';
 +
}
 +
} catch (e) {
 +
}
 +
// Pour IE
 +
if (tagToToggle.style.visibility == 'hidden') {
 +
tagToToggle.style.visibility = 'visible';
 +
} else {
 +
tagToToggle.style.visibility = 'hidden';
 +
}
 +
}
 +
</script>
 +
 +
</html>
</html>

Latest revision as of 00:10, 26 September 2012