diff options
author | Arun Persaud <arun@nubati.net> | 2011-11-13 21:57:09 -0800 |
---|---|---|
committer | Arun Persaud <apersaud@lbl.gov> | 2011-11-13 22:00:03 -0800 |
commit | 0b8f00b41b22dc971f8415f1e6de4700ea86c0fb (patch) | |
tree | c3db9016b3174bb77e362baae342f3e4c1556a28 /include | |
parent | 189a8296e5f6ba47e87167083cff9cb3e1d0d03b (diff) | |
download | e-DoKo-0b8f00b41b22dc971f8415f1e6de4700ea86c0fb.tar.gz e-DoKo-0b8f00b41b22dc971f8415f1e6de4700ea86c0fb.tar.bz2 e-DoKo-0b8f00b41b22dc971f8415f1e6de4700ea86c0fb.zip |
CLEANUP: moves javascript from header into game.js
should make html output smaller, since game.js can be cached
Diffstat (limited to 'include')
-rw-r--r-- | include/game.js | 50 | ||||
-rw-r--r-- | include/output.php | 35 |
2 files changed, 41 insertions, 44 deletions
diff --git a/include/game.js b/include/game.js index 862d8b6..bf93272 100644 --- a/include/game.js +++ b/include/game.js @@ -4,15 +4,10 @@ var current=0; /* do the higlighting */ function hl(num) { - if(document.getElementById){ - var i; - for(i=0;i<14;i++){ - if(document.getElementById("trick"+i)) - document.getElementById("trick"+i).style.display = 'none'; - } - document.getElementById("trick"+num).style.display = 'block'; - current=num; - } + var i; + for(i=0;i<14;i++){ $("#trick"+i).hide(); } + $("#trick"+num).css('display', 'block'); + current=num; } /* highlight the last trick, useful when a page is called the first time*/ @@ -43,3 +38,40 @@ function hl_prev() if(document.getElementById("trick"+(current-1))) hl(current-1); } + +$(document).ready( + function() + { + $("#ScoreTable").tablesorter({ widgets: ['zebra']}); + + $(".gameshidesession").click( function () { + $(this).parenthesis().children(".gamessession").hide(300); + $(this).parent().children(".gamesshowsession").show(); + $(this).hide(); + }); + + $(".gamesshowsession").click( function () { + $(this).parenthesis().children(".gamessession").show(300); + $(this).parent().children(".gameshidesession").show(); + $(this).hide(); + }); + + $(".gameshowall").click( function () { + $(".gamessession").show(300); + $(".gamesshowsession").hide(); + $(".gameshidesession").show(); + }); + $(".gamehideall").click( function () { + $(".gamessession").hide(300); + $(".gamesshowsession").show(); + $(".gameshidesession").hide(); + }); + + $("ul.loginregister").click(function () { + $(".dologin").slideToggle(); + $(".doregister").slideToggle(); + }); + + $(".message div div").parent().click ( function() { $(this).hide(); }); + + }); diff --git a/include/output.php b/include/output.php index e91451c..c6d78e3 100644 --- a/include/output.php +++ b/include/output.php @@ -386,41 +386,6 @@ function output_header() <script type="text/javascript" src="include/jquery.tools.min.js"></script> <script type="text/javascript" src="include/game.js"> </script> <script type="text/javascript"> - $(document).ready(function() - { - $("#ScoreTable").tablesorter({ widgets: ['zebra']}); - - $(".gameshidesession").click( function () { - $(this).parent().children(".gamessession").hide(300); - $(this).parent().children(".gamesshowsession").show(); - $(this).hide(); - }); - - $(".gamesshowsession").click( function () { - $(this).parent().children(".gamessession").show(300); - $(this).parent().children(".gameshidesession").show(); - $(this).hide(); - }); - - $(".gameshowall").click( function () { - $(".gamessession").show(300); - $(".gamesshowsession").hide(); - $(".gameshidesession").show(); - }); - $(".gamehideall").click( function () { - $(".gamessession").hide(300); - $(".gamesshowsession").show(); - $(".gameshidesession").hide(); - }); - - $("ul.loginregister").click(function () { - $(".dologin").slideToggle(); - $(".doregister").slideToggle(); - }); - - $(".message div div").parent().click ( function() { $(this).hide(); }); - - }); </script> </head> <body onload="high_last();"> |