Added content & functionality

Added a top banner, current score lines for top and bottom, imported bootstrap for responsive functionality.
This commit is contained in:
RyanNeilson
2018-01-28 15:23:22 -04:00
committed by GitHub
parent bfd9caee20
commit 894212f5a9

View File

@@ -1,3 +1,4 @@
<!DOCTYPE html>
<!-- <!--
Copyright (c) 2013 Fabrice ECAILLE aka Febbweiss Copyright (c) 2013 Fabrice ECAILLE aka Febbweiss
@@ -7,7 +8,7 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--> -->
<!DOCTYPE html>
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -21,79 +22,66 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<![endif]--> <![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href='http://fonts.googleapis.com/css?family=Zeyada' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Zeyada' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/css?family=Fredericka+the+Great" rel="stylesheet">
<script src="lib/jquery-1.7.1.min.js" type="text/javascript" ></script> <script src="lib/jquery-1.7.1.min.js" type="text/javascript" ></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.bundle.min.js">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="css/yahtzee.css" type="text/css" rel="stylesheet" media="screen, projection" /> <link href="css/yahtzee.css" type="text/css" rel="stylesheet" media="screen, projection" />
</head> </head>
<body> <body>
<div style="width: 50%;float: left;"> <div id="banner"class="col-xs-12">
<div class="dice empty" id="dice1"></div> <h1>FEBBWEISS' YAHTZEE!</h1>
<div class="dice empty" id="dice2"></div>
<div class="dice empty" id="dice3"></div>
<div class="dice empty" id="dice4"></div>
<div class="dice empty" id="dice5"></div>
<div class="dice empty" id="dice6"></div>
<div class="clear"></div>
<div>
<span>Launch</span>
<span id="launch"></span>
</div> </div>
<a href="javascript:void(0)" id="launchBtn">Launch</a> <div class="container">
<div class="row">
<div class="col-xs-12 col-xl-4">
<div> <div>
<dl> <dl><br>
<dt>Three of a kind</dt> <dt>Three of a kind</dt>
<dd>Three dice showing the same face</dd> <dd>Three dice showing the same face (Ex. Three 3's)</dd>
<dd>Sum of all dice</dd> <dd>Scoring: Sum of all dice</dd>
<br>
<dt>Four of a kind</dt> <dt>Four of a kind</dt>
<dd>Four dice showing the same face</dd> <dd>Four dice showing the same face (Ex. Four 5's)</dd>
<dd>Sum of all dice</dd> <dd>Scoring: Sum of all dice</dd>
<dt>Full</dt> <br>
<dd>A three-of-a-kind and a pair</dd> <dt>Full House</dt>
<dd>25 points</dd> <dd>A three-of-a-kind and a pair (Ex. Three 1's and Two 4's)</dd>
<dd>Scoring: 25 points</dd>
<br>
<dt>Small straight</dt> <dt>Small straight</dt>
<dd>Four sequential dice</dd> <dd>Four sequential dice (Ex. 2, 3, 4, 5)</dd>
<dd>30 points</dd> <dd>Scoring: 30 points</dd>
<br>
<dt>Large straight</dt> <dt>Large straight</dt>
<dd>Five sequential dice</dd> <dd>Five sequential dice (Ex. 2, 3, 4, 5, 6)</dd>
<dd>40 points</dd> <dd>Scoring: 40 points</dd>
<br>
<dt>Yahtzee</dt> <dt>Yahtzee</dt>
<dd>Five dice showing the same face</dd> <dd>Five dice showing the same face (Ex. Five 4's)</dd>
<dd>50 points</dd> <dd>Scoring: 50 points</dd>
<br>
<dt>Chance</dt> <dt>Chance</dt>
<dd>Sum of all dice</dd> <dd>Scoring: Sum of all dice</dd>
</dl> </dl>
</div> </div>
<div id="scorePanel" style="display: none;">
<table class="table table-bordered">
<tr>
<td>Upper grid score</td>
<td id="upperScore" style="text-align: center"></td>
</tr>
<tr>
<td>Bonus</td>
<td id="bonus" style="text-align: center"></td>
</tr>
<tr>
<td>Lower grid score</td>
<td id="lowerScore" style="text-align: center"></td>
</tr>
<tr>
<td><b>Total</b></td>
<td id="totalScore" style="text-align: center"><b></b></td>
</tr>
</table>
</div> </div>
</div>
<div style="width: 50%;float: left;"> <div class="col-xs-12 col-xl-4">
<table border="1"> <table border="1">
<thead> <thead>
<tr> <tr>
<th style="text-align: center;">Combinaison</th> <th style="text-align: center;">Combination</th>
<th style="text-align: center;" width="84px"> <th style="text-align: center;" width="84px">
Score Score
</th> </th>
<th style="text-align: center;" width="100px"></th> <th style="text-align: center;" width="100px">Options</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -101,7 +89,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<tr> <tr>
<td> <td>
<span id="oneLabel"> <span id="oneLabel">
One Ones
</span> </span>
</td> </td>
<td style="text-align: center;"> <td style="text-align: center;">
@@ -116,7 +104,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<tr> <tr>
<td> <td>
<span id="twoLabel"> <span id="twoLabel">
Two Twos
</span> </span>
</td> </td>
<td style="text-align: center;"> <td style="text-align: center;">
@@ -131,7 +119,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<tr> <tr>
<td> <td>
<span id="threeLabel"> <span id="threeLabel">
Three Threes
</span> </span>
</td> </td>
<td style="text-align: center;"> <td style="text-align: center;">
@@ -146,7 +134,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<tr> <tr>
<td> <td>
<span id="fourLabel"> <span id="fourLabel">
Four Fours
</span> </span>
</td> </td>
<td style="text-align: center;"> <td style="text-align: center;">
@@ -161,7 +149,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<tr> <tr>
<td> <td>
<span id="fiveLabel"> <span id="fiveLabel">
Five Fives
</span> </span>
</td> </td>
<td style="text-align: center;"> <td style="text-align: center;">
@@ -176,7 +164,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<tr> <tr>
<td> <td>
<span id="sixLabel"> <span id="sixLabel">
Six Sixes
</span> </span>
</td> </td>
<td style="text-align: center;"> <td style="text-align: center;">
@@ -187,19 +175,61 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<a href="javascript:void(0)"id="sixTrash" data-id="six" class="trash">Trash</a> <a href="javascript:void(0)"id="sixTrash" data-id="six" class="trash">Trash</a>
</td> </td>
</tr> </tr>
<tr>
<td>
<span>
Upper Score
</span>
</td>
<td style="text-align: center;">
<span class="score" id="topScore"></span>
</td>
</tr>
</tbody> </tbody>
</table> </table>
<br>
<div id="btn">
<a href="javascript:void(0)" id="launchBtn">Roll the Dice</a>
</div>
<br>
<div>
<span>Dice Roll #:</span>
<span id="launch"></span>
</div>
<br>
<div>
<div class="dice empty" id="dice1"></div>
<div class="dice empty" id="dice2"></div>
<div class="dice empty" id="dice3"></div>
<div class="dice empty" id="dice4"></div>
<div class="dice empty" id="dice5"></div>
<div class="dice empty" id="dice6"></div>
<div class="clear"></div>
</div>
<div>
</div>
</div>
<div class="col-xs-12 col-xl-4">
<table border="1"> <table border="1">
<thead> <thead>
<tr> <tr>
<th style="text-align: center;">Combinaison</th> <th style="text-align: center;">Combination</th>
<th style="text-align: center;">Probability</th> <th style="text-align: center;">Probability</th>
<th style="text-align: center;" width="84px"> <th style="text-align: center;" width="84px">
Score Score
</th> </th>
<th style="text-align: center;" width="100px"></th> <th style="text-align: center;" width="100px">Options</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@@ -249,7 +279,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<tr> <tr>
<td> <td>
<span id="fullLabel"> <span id="fullLabel">
Full Full House
</span> </span>
</td> </td>
<td> <td>
@@ -270,7 +300,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<tr> <tr>
<td> <td>
<span id="smallStraightLabel"> <span id="smallStraightLabel">
Small straight Small Straight
</span> </span>
</td> </td>
<td> <td>
@@ -291,7 +321,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<tr> <tr>
<td> <td>
<span id="largeStraightLabel"> <span id="largeStraightLabel">
Large straight Large Straight
</span> </span>
</td> </td>
<td> <td>
@@ -350,38 +380,81 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<a href="javascript:void(0)"id="luckTrash" data-id="luck" class="trash">Trash</a> <a href="javascript:void(0)"id="luckTrash" data-id="luck" class="trash">Trash</a>
</td> </td>
</tr> </tr>
<tr>
<td>
<span>
Lower Score
</span>
</td>
<td>
</td>
<td style="text-align: center;">
<span id="bottomScore" class="score"></span>
</td>
</tr>
</tbody> </tbody>
</table> </table>
<br>
<div id="scorePanel" style="display: none;">
<table class="table table-bordered">
<tr>
<th>Final Score</th>
</tr>
<tr>
<td>Upper grid score</td>
<td id="upperScore" style="text-align: center"></td>
</tr>
<tr>
<td>Bonus</td>
<td id="bonus" style="text-align: center"></td>
</tr>
<tr>
<td>Lower grid score</td>
<td id="lowerScore" style="text-align: center"></td>
</tr>
<tr>
<td><b>Total</b></td>
<td id="totalScore" style="text-align: center"><b></b></td>
</tr>
</table>
</div>
</div>
</div> </div>
</div> </div>
</div> <!-- End of span9 -->
<script src="js/yahtzee.js" type="text/javascript" ></script> <script src="js/yahtzee.js" type="text/javascript" ></script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function () { $(document).ready(function ()
$(".dice").click(function(evt) { {
$(".dice").click(function(evt)
{
if( $(this).hasClass("selected") ) if( $(this).hasClass("selected") )
$(this).removeClass("selected"); $(this).removeClass("selected");
else else
$(this).addClass("selected"); $(this).addClass("selected");
}); });
$(".keep").click(function(evt) { $(".keep").click(function(evt)
{
console.log("Keeping " + $(this).attr('data-id')); console.log("Keeping " + $(this).attr('data-id'));
Yahtzee.keep($(this).attr('data-id')); Yahtzee.keep($(this).attr('data-id'));
}); });
$(".trash").click(function(evt) { $(".trash").click(function(evt)
{
console.log("Trashing " + $(this).attr('data-id')); console.log("Trashing " + $(this).attr('data-id'));
Yahtzee.trash($(this).attr('data-id')); Yahtzee.trash($(this).attr('data-id'));
}); });
$("#launchBtn").click(function() { $("#launchBtn").click(function()
{
Yahtzee.shuffle(); Yahtzee.shuffle();
Yahtzee.findCombinaisons(); Yahtzee.findCombinations();
if( Yahtzee.launch < 3 ) if( Yahtzee.launch < 3 )
Yahtzee.findPossibilities(); Yahtzee.findPossibilities();
}); });