Template:IGEM Kyoto/game/js

From OpenWetWare
Revision as of 18:50, 28 March 2015 by Hideaki Tsujii (talk | contribs)
Jump to navigationJump to search

<html> <script type="text/javascript">

   function game_open()
   {
       var gamebase=document.getElementById("kyoto-game-base");
       gamebase.style.opacity=1.0;
       setTimeout("game_menu_fadeout()",0);
       setTimeout("game_menu_return()",300);
       setTimeout("game_fadein()",300);
   }
   function game_menu_fadeout()
   {
       var menubase=document.getElementById("kyoto-menu-base");
       var opa = 0.9;
       var id = setInterval(function() {
           menubase.style.opacity = opa;
           opa+=-0.18;
           if(opa < 0) {
               clearInterval(id);
           }
       }, 60);
   }
   function game_menu_return()
   {
       var menubase=document.getElementById("kyoto-menu-base");
       menubase.style.top="-480px";
   }
   function game_fadein()
   {
       var gamebase=document.getElementById("kyoto-game-base");
       var top = -480;
       var t=0;
       var id = setInterval(function() {
           gamebase.style.top = top + "px";
           t+=1;
           top=-0.09375*(t-80)*(t-80)+120;
           if(t > 80) {
               clearInterval(id);
           }
       }, 12.5);
   }
   function game_close()
   {
       setTimeout("game_fadeout()",0);
       setTimeout("game_return()",300);
   }
   function game_fadeout()
   {
       var back=document.getElementById("kyoto-menu-background");
       var gamebase=document.getElementById("kyoto-game-base");
       var opa = 1.0;
       var opa1 = 0.9
       var id = setInterval(function() {
           back.style.opacity = opa1;
           gamebase.style.opacity = opa;
           opa+=-0.2;
           opa1+=-0.18
           if(opa < 0) {
               clearInterval(id);
           }
       }, 60);
   }
   function game_return()
   {
       var back=document.getElementById("kyoto-menu-background");
       var gamebase=document.getElementById("kyoto-game-base");
       back.style.height="0%";
       gamebase.style.top="-480px";
   }
   function game_start()
   {
   
   }

</script>

<script type="text/javascript">

   window.onload = function(){
   var ua = navigator.userAgent.toUpperCase();
       if(ua.indexOf('IPHONE') != -1){
           if(window.confirm('スマートフォンサイトに移動しますか?')) {
               location.href = 'http://openwetware.org/wiki/IGEM:Kyoto/about-sandbox';
           }
       }
       if(ua.indexOf('ANDROID') != -1){
           if(ua.indexOf('MOBILE') != -1){
               if(window.confirm('スマートフォンサイトに移動しますか?')) {
                   location.href = 'http://openwetware.org/wiki/IGEM:Kyoto/about-sandbox';
               }
           }
       }
   }

</script> </html>