summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/game.js45
-rw-r--r--include/output.php38
2 files changed, 46 insertions, 37 deletions
diff --git a/include/game.js b/include/game.js
new file mode 100644
index 0000000..862d8b6
--- /dev/null
+++ b/include/game.js
@@ -0,0 +1,45 @@
+/* some code to highlight the current trick and to switch between different tricks */
+/* which trick is currently highlighted*/
+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;
+ }
+}
+
+/* highlight the last trick, useful when a page is called the first time*/
+function high_last(){
+ if(document.getElementById){
+ var i;
+ for(i=13;i>=0;i--) {
+ if(document.getElementById("trick"+i))
+ {
+ hl(i);
+ current=i;
+ break;
+ }
+ }
+ }
+}
+
+/* highlight the next trick */
+function hl_next()
+{
+ if(document.getElementById("trick"+(current+1)))
+ hl(current+1);
+}
+
+/* highlight the previous trick */
+function hl_prev()
+{
+ if(document.getElementById("trick"+(current-1)))
+ hl(current-1);
+}
diff --git a/include/output.php b/include/output.php
index 47fddfe..17bd9e2 100644
--- a/include/output.php
+++ b/include/output.php
@@ -271,43 +271,7 @@ function output_header()
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />
<link rel="shortcut icon" type="image/x-icon" href="pics/edoko-favicon.png" />
<link rel="stylesheet" type="text/css" href="css/standard014.css" />
- <script type="text/javascript">
- var current=0;
- 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;
- }
- }
- function high_last(){
- if(document.getElementById){
- var i;
- for(i=13;i>=0;i--) {
- if(document.getElementById("trick"+i))
- {
- hl(i);
- current=i;
- break;
- }
- }
- }
- }
- function hl_next()
- {
- if(document.getElementById("trick"+(current+1)))
- hl(current+1);
- }
- function hl_prev()
- {
- if(document.getElementById("trick"+(current-1)))
- hl(current-1);
- }
- </script>
+ <script type="text/javascript" src="include/game.js"> </script>
</head>
<body onload="high_last();">
<div class="header">