From 293b20963f2bbf0cfca1a146506d65d615b01c2c Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Sat, 6 Oct 2012 00:19:12 -0700 Subject: starting to bootstrap the layout: navbar and tricks - changing the tricks-selector to a paginator and fixing the js for highlighting - adding a navbar using bootstrap, probably should use .wrap more instead of adding divs to the code --- css/standard.less | 33 +++++---------------------------- include/cancelgame.php | 3 --- include/game.php | 14 +++++++------- include/output.php | 38 +++++++++++++++++++++++--------------- index.php | 2 +- js/game.js | 23 ++++++++++++++++++++++- js/layout.js | 3 +++ 7 files changed, 61 insertions(+), 55 deletions(-) create mode 100644 js/layout.js diff --git a/css/standard.less b/css/standard.less index 3c5a9bc..5383d30 100644 --- a/css/standard.less +++ b/css/standard.less @@ -17,7 +17,7 @@ * */ -body { background-color: #ddd; } +body { background-color: #ddd; padding-top:40px} /* the header, footer, etc */ header { @@ -51,13 +51,6 @@ footer { footer .right { text-align:right; font-size:smaller;} footer .left { float:left; font-size:smaller;} -.status { - position:absolute; - right:4em; - top:0.1em; - font-size: smaller; -} - .WIP { background-color: #efaaaa; text-size: larger; @@ -263,25 +256,6 @@ div span.numberoftricks { /* display the card tricks */ -ul.tricks { - text-align:center; - list-style:none; - margin:0px; - padding:3px; - padding-bottom:3px; - border-bottom:1px solid #444; -} -ul.tricks a { text-decoration:none; color:#000;} -ul.tricks li { - /*background-color:blue;*/ - padding:0.1em; - margin:0.2em 0.5em; - display:inline; -} -ul.tricks li.old { background-color:#fff; } -ul.tricks li a:hover { background-color: #bbb;} -ul.tricks li.nohighlight a:hover { background-color: #fff;} - div.tricks { position: absolute; top: 0; @@ -806,7 +780,7 @@ header, footer { border-top: 1px solid gray; } -.session div.sessionscore div, .status { +.session div.sessionscore div { right:0em; } @@ -849,4 +823,7 @@ header, footer { text-align: right; font-size: smaller; } +} +.pagination { + text-align:center; } \ No newline at end of file diff --git a/include/cancelgame.php b/include/cancelgame.php index da6ffcc..df6e98d 100644 --- a/include/cancelgame.php +++ b/include/cancelgame.php @@ -24,9 +24,6 @@ if(!isset($HOST)) exit; -/* display the menu */ -output_status(); - /* you should only get here from a game page, so $me should be set */ if(!myisset("me")) { diff --git a/include/game.php b/include/game.php index d43699b..d07ff5b 100644 --- a/include/game.php +++ b/include/game.php @@ -367,7 +367,7 @@ switch($mystatus) case 'check': /* output sickness of other playes, in case they already selected and are sitting in front of the current player */ echo "\n\n"; /* end div trick, end li trick , end tricks*/ /* end displaying sickness */ @@ -381,7 +381,7 @@ switch($mystatus) $mygametype = DB_get_gametype_by_gameid($gameid); - echo "
  • Pre\n"; + echo "
  • Pre\n"; echo "
  • \n\n\n"; /* end div trick, end li trick , end ul tricks */ } /* end output pre-game trick */ @@ -411,19 +411,19 @@ switch($mystatus) { $trick=$r[0]; if($trick!=$lasttrick) - echo "
  • "._('Trick')." $trickNR
  • \n"; + echo "
  • "._('Trick')." $trickNR
  • \n"; else if($trick==$lasttrick) - echo "
  • "._('Trick')." $trickNR
  • \n"; + echo "
  • "._('Trick')." $trickNR
  • \n"; $trickNR++; } /* if game is over, also output link to Score tab */ if($mystatus=='gameover' && DB_get_game_status_by_gameid($gameid)=='gameover' ) - echo "
  • "._('Score')."
  • \n"; + echo "
  • "._('Score')."
  • \n"; /* output previous/next buttons */ - echo '
  • \n"; - echo '
  • \n"; + echo '
  • '._('prev')."
  • \n"; + echo '
  • '._('next')."
  • \n"; echo "\n\n"; diff --git a/include/output.php b/include/output.php index 9094171..fa61c87 100644 --- a/include/output.php +++ b/include/output.php @@ -431,11 +431,6 @@ function output_header() -
    - '._('Welcome to E-Doko').' '; -?> -
    "; @@ -464,6 +459,7 @@ function output_footer() echo ''; echo ''; echo ''; + echo ''; echo ''; echo "\n"; @@ -472,7 +468,7 @@ function output_footer() return; } -function output_status() +function output_navbar() { global $defaulttimezone, $INDEX, $WIKI, $RSS; @@ -493,15 +489,27 @@ function output_status() $token = get_user_token($myid); /* logout info */ - echo "\n
    \n"; - echo $name,"\n"; - echo " | "._('mypage')."\n"; - echo " | "._('settings')."\n"; - echo " | "._('new game')."\n"; - echo " | "._('statistics')."\n"; - echo " | "._('wiki/bugs')."\n"; - echo " | "._('atom')."\n"; - echo " |    "._('logout')."\n"; + echo "\n
    \n"; + echo "
    \n"; + echo " E-DoKo\n"; + echo " \n"; + echo "
    \n"; echo "
    \n\n"; echo "
    "._('last login').": ".date("r",$unixtime)."
    \n\n"; diff --git a/index.php b/index.php index 0001408..bbdfeb2 100644 --- a/index.php +++ b/index.php @@ -138,7 +138,7 @@ switch($action) /* ask for login or display login info, needs to go at the end, so that we have the * session-variable already set. */ -output_status(); +output_navbar(); output_footer(); diff --git a/js/game.js b/js/game.js index 3a1a080..d1d8405 100644 --- a/js/game.js +++ b/js/game.js @@ -5,9 +5,30 @@ var current=0; /* do the higlighting */ function hl(num) { var i; - for(i=0;i<14;i++){ $("#trick"+i).hide(); } + for(i=0;i<14;i++){ $("#trick"+i).hide(); $("#tricks"+i).removeClass('active'); } $("#trick"+num).css('display', 'block'); + $("#tricks"+num).addClass('active'); current=num; + + if(document.getElementById("tricks0")) + min=0; + else + min=1; + + if(document.getElementById("tricks13")) + max=13; + else + min=12; + + if(current==min) + $("#prevtr").addClass('disabled'); + else + $("#prevtr").removeClass('disabled'); + if(current==max) + $("#nexttr").addClass('disabled'); + else + $("#nexttr").removeClass('disabled'); + } /* highlight the last trick, useful when a page is called the first time*/ diff --git a/js/layout.js b/js/layout.js new file mode 100644 index 0000000..b98db8e --- /dev/null +++ b/js/layout.js @@ -0,0 +1,3 @@ +$(".navbar .nav").addClass("pull-right"); +$("table").addClass("table table-striped"); +$("ul.tricks").wrap('