Template:Team:HokkaidoU Japan/header/js

From 2013.igem.org

(Difference between revisions)
Line 1: Line 1:
<html><script type="text/javascript">
<html><script type="text/javascript">
-
(function(a){a.fn.hoverIntent=function(k,j){var l={sensitivity:7,interval:100,timeout:0};l=a.extend(l,j?{over:k,out:j}:k);var n,m,h,d;var e=function(f){n=f.pageX;m=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-n)+Math.abs(d-m))<l.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return l.over.apply(f,[g])}else{h=n;d=m;f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return l.out.apply(f,[g])};var b=function(q){var o=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(o&&o!=this){try{o=o.parentNode}catch(q){o=this}}if(o==this){return false}var g=jQuery.extend({},q);var f=this;if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(q.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},l.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery);(function(a){a.fn.dcMegaMenu=function(c){var d={classParent:"dc-mega",classContainer:"sub-container",classSubParent:"mega-hdr",classSubLink:"mega-hdr",classWidget:"dc-extra",rowItems:3,speed:"fast",effect:"fade",event:"hover",fullWidth:false,onLoad:function(){},beforeOpen:function(){},beforeClose:function(){}};var c=a.extend(d,c);var b=this;return b.each(function(p){var j=d.classSubParent;var o=d.classSubLink;var m=d.classParent;var n=d.classContainer;var k=d.classWidget;l();function i(){var q=a(".sub",this);a(this).addClass("mega-hover");if(d.effect=="fade"){a(q).fadeIn(d.speed)}if(d.effect=="slide"){a(q).show(d.speed)}d.beforeOpen.call(this)}function f(r){var q=a(".sub",r);a(r).addClass("mega-hover");if(d.effect=="fade"){a(q).fadeIn(d.speed)}if(d.effect=="slide"){a(q).show(d.speed)}d.beforeOpen.call(this)}function h(){var q=a(".sub",this);a(this).removeClass("mega-hover");a(q).hide();d.beforeClose.call(this)}function e(r){var q=a(".sub",r);a(r).removeClass("mega-hover");a(q).hide();d.beforeClose.call(this)}function g(){a("li",b).removeClass("mega-hover");a(".sub",b).hide()}function l(){$arrow='<span class="dc-mega-icon"></span>';var s=m+"-li";var r=b.outerWidth();a("> li",b).each(function(){var D=a("> ul",this);var u=a("> a",this);if(D.length){u.addClass(m).append($arrow);D.addClass("sub").wrap('<div class="'+n+'" />');var y=a(this).position();pl=y.left;if(a("ul",D).length){a(this).addClass(s);a("."+n,this).addClass("mega");a("> li",D).each(function(){if(!a(this).hasClass(k)){a(this).addClass("mega-unit");if(a("> ul",this).length){a(this).addClass(j);a("> a",this).addClass(j+"-a")}else{a(this).addClass(o);a("> a",this).addClass(o+"-a")}}});var v=a(".mega-unit",this);rowSize=parseInt(d.rowItems);for(var J=0;J<v.length;J+=rowSize){v.slice(J,J+rowSize).wrapAll('<div class="row" />')}D.show();var B=a(this).width();var H=pl+B;var G=r-H;var F=D.outerWidth();var E=D.parent("."+n).outerWidth();var C=E-F;if(d.fullWidth==true){var w=r-C;D.parent("."+n).css({width:w+"px"});b.addClass("full-width")}var x=a(".mega-unit",D).outerWidth(true);var I=a(".row:eq(0) .mega-unit",D).length;var z=x*I;var A=z+C;a(".row",this).each(function(){a(".mega-unit:last",this).addClass("last");var N=undefined;a(".mega-unit > a",this).each(function(){var O=parseInt(a(this).height());if(N===undefined||N<O){N=O}});a(".mega-unit > a",this).css("height",N+"px");a(this).css("width",z+"px")});if(d.fullWidth==true){M={left:0}}else{var K=G<K?K+K-G:(A-B)/2;var L=pl-K;var M={left:pl+"px",marginLeft:-K+"px"};if(L<0){M={left:0}}else{if(G<K){M={right:0}}}}a("."+n,this).css(M);a(".row",D).each(function(){var N=a(this).height();a(".mega-unit",this).css({height:N+"px"});a(this).parent(".row").css({height:N+"px"})});D.hide()}else{a("."+n,this).addClass("non-mega").css("left",pl+"px")}}});var t=a("> li > a",b).outerHeight(true);a("."+n,b).css({top:t+"px"}).css("z-index","1000");if(d.event=="hover"){var q={sensitivity:2,interval:100,over:i,timeout:400,out:h};a("li",b).hoverIntent(q)}if(d.event=="click"){a("body").mouseup(function(u){if(!a(u.target).parents(".mega-hover").length){g()}});a("> li > a."+m,b).click(function(u){var v=a(this).parent();if(v.hasClass("mega-hover")){e(v)}else{f(v)}u.preventDefault()})}d.onLoad.call(this)}})}})(jQuery);(function(){$(function(){return $("#header-menu").dcMegaMenu({rowItems:"5",speed:"fast",effect:"fade"})})}).call(this);(function(){$('<div id="wiki-menu">').appendTo("#top-section");$('<div id="open-wiki-menu">').appendTo("#top-section").text("Wiki Menu");$("<h2>").appendTo("#wiki-menu").text("Page Menu");$(".left-menu").appendTo("#wiki-menu");$("<h2>").appendTo("#wiki-menu").text("User Menu");$(".right-menu").appendTo("#wiki-menu");$('<div id="close-wiki-menu">').appendTo("#wiki-menu").text("Close");$("#open-wiki-menu").click(function(){$(this).hide();return $("#wiki-menu").show()});$("#close-wiki-menu").click(function(){$("#wiki-menu").hide();return $("#open-wiki-menu").show()})}).call(this);
+
(function(a){a.fn.hoverIntent=function(k,j){var l={sensitivity:7,interval:100,timeout:0};l=a.extend(l,j?{over:k,out:j}:k);var n,m,h,d;var e=function(f){n=f.pageX;m=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-n)+Math.abs(d-m))<l.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return l.over.apply(f,[g])}else{h=n;d=m;f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return l.out.apply(f,[g])};var b=function(q){var o=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(o&&o!=this){try{o=o.parentNode}catch(q){o=this}}if(o==this){return false}var g=jQuery.extend({},q);var f=this;if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(q.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},l.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery);(function(a){a.fn.dcMegaMenu=function(c){var d={classParent:"dc-mega",classContainer:"sub-container",classSubParent:"mega-hdr",classSubLink:"mega-hdr",classWidget:"dc-extra",rowItems:3,speed:"fast",effect:"fade",event:"hover",fullWidth:false,onLoad:function(){},beforeOpen:function(){},beforeClose:function(){}};var c=a.extend(d,c);var b=this;return b.each(function(p){var j=d.classSubParent;var o=d.classSubLink;var m=d.classParent;var n=d.classContainer;var k=d.classWidget;l();function i(){var q=a(".sub",this);a(this).addClass("mega-hover");if(d.effect=="fade"){a(q).fadeIn(d.speed)}if(d.effect=="slide"){a(q).show(d.speed)}d.beforeOpen.call(this)}function f(r){var q=a(".sub",r);a(r).addClass("mega-hover");if(d.effect=="fade"){a(q).fadeIn(d.speed)}if(d.effect=="slide"){a(q).show(d.speed)}d.beforeOpen.call(this)}function h(){var q=a(".sub",this);a(this).removeClass("mega-hover");a(q).hide();d.beforeClose.call(this)}function e(r){var q=a(".sub",r);a(r).removeClass("mega-hover");a(q).hide();d.beforeClose.call(this)}function g(){a("li",b).removeClass("mega-hover");a(".sub",b).hide()}function l(){$arrow='<span class="dc-mega-icon"></span>';var s=m+"-li";var r=b.outerWidth();a("> li",b).each(function(){var D=a("> ul",this);var u=a("> a",this);if(D.length){u.addClass(m).append($arrow);D.addClass("sub").wrap('<div class="'+n+'" />');var y=a(this).position();pl=y.left;if(a("ul",D).length){a(this).addClass(s);a("."+n,this).addClass("mega");a("> li",D).each(function(){if(!a(this).hasClass(k)){a(this).addClass("mega-unit");if(a("> ul",this).length){a(this).addClass(j);a("> a",this).addClass(j+"-a")}else{a(this).addClass(o);a("> a",this).addClass(o+"-a")}}});var v=a(".mega-unit",this);rowSize=parseInt(d.rowItems);for(var J=0;J<v.length;J+=rowSize){v.slice(J,J+rowSize).wrapAll('<div class="row" />')}D.show();var B=a(this).width();var H=pl+B;var G=r-H;var F=D.outerWidth();var E=D.parent("."+n).outerWidth();var C=E-F;if(d.fullWidth==true){var w=r-C;D.parent("."+n).css({width:w+"px"});b.addClass("full-width")}var x=a(".mega-unit",D).outerWidth(true);var I=a(".row:eq(0) .mega-unit",D).length;var z=x*I;var A=z+C;a(".row",this).each(function(){a(".mega-unit:last",this).addClass("last");var N=undefined;a(".mega-unit > a",this).each(function(){var O=parseInt(a(this).height());if(N===undefined||N<O){N=O}});a(".mega-unit > a",this).css("height",N+"px");a(this).css("width",z+"px")});if(d.fullWidth==true){M={left:0}}else{var K=G<K?K+K-G:(A-B)/2;var L=pl-K;var M={left:pl+"px",marginLeft:-K+"px"};if(L<0){M={left:0}}else{if(G<K){M={right:0}}}}a("."+n,this).css(M);a(".row",D).each(function(){var N=a(this).height();a(".mega-unit",this).css({height:N+"px"});a(this).parent(".row").css({height:N+"px"})});D.hide()}else{a("."+n,this).addClass("non-mega").css("left",pl+"px")}}});var t=a("> li > a",b).outerHeight(true);a("."+n,b).css({top:t+"px"}).css("z-index","1000");if(d.event=="hover"){var q={sensitivity:2,interval:100,over:i,timeout:400,out:h};a("li",b).hoverIntent(q)}if(d.event=="click"){a("body").mouseup(function(u){if(!a(u.target).parents(".mega-hover").length){g()}});a("> li > a."+m,b).click(function(u){var v=a(this).parent();if(v.hasClass("mega-hover")){e(v)}else{f(v)}u.preventDefault()})}d.onLoad.call(this)}})}})(jQuery);(function(){$("#header-menu").dcMegaMenu({rowItems:"5",speed:"fast",effect:"fade"})}).call(this);(function(){$('<div id="wiki-menu">').appendTo("#top-section");$('<div id="open-wiki-menu">').appendTo("#top-section").text("Wiki Menu");$("<h2>").appendTo("#wiki-menu").text("Page Menu");$(".left-menu").appendTo("#wiki-menu");$("<h2>").appendTo("#wiki-menu").text("User Menu");$(".right-menu").appendTo("#wiki-menu");$('<div id="close-wiki-menu">').appendTo("#wiki-menu").text("Close");$("#open-wiki-menu").click(function(){$(this).hide();return $("#wiki-menu").show()});$("#close-wiki-menu").click(function(){$("#wiki-menu").hide();return $("#open-wiki-menu").show()})}).call(this);
</script></html>
</script></html>

Revision as of 14:23, 18 September 2013