-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
61 lines (61 loc) · 2.09 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Munchkin Scorekeeper</title>
<meta name="viewport" content="width=device-width" />
<link rel="stylesheet" type="text/css" media="screen" href="css/scorekeeper.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script type="text/javascript" src="js/scorekeeper.js"></script>
</head>
<body>
<div id="wrapper">
<header>
<h1 id="title">Munchkin Scorekeeper</h1>
</header>
<section id="main">
<div id="scorekeeper"></div>
<div id="buttons">
<p>
<button id="add_player" onclick="addPlayerToList(-1);">Add Player</button>
<button id="new_game" onclick="newGame();">New Game</button>
<button id="reset_game" onclick="resetGame();">Clear All</button>
</p>
<p>Max Players:
<input type="text" id="max_players" size="2" onchange="changeMaxPlayers(this.value);"/>
<button id="max_players_plus" onclick="changeMaxPlayers(data.maxPlayers + 1);"> + </button>
<button id="max_players_minus" onclick="changeMaxPlayers(data.maxPlayers - 1);"> - </button>
</p>
</div>
</section>
<footer>
Made by <a href="mailto:bencentra@csh.rit.edu">Ben Centra</a>. View on <a href="https://github.com/bencentra/munchkin-scorekeeper">GitHub</a>.
</footer>
</div>
<script type="text/javascript">
//Checks for compatability with localStorage and loads previous data
$(document).ready(function(e) {
if (typeof(Storage) === "undefined") {
$("header").prepend("<p class='warning'>WARNING: This requires HTML5 localStorage to run properly. Please upgrade your browser and try again.</p>");
}
else {
console.log("Loading Game...");
if (localStorage.getItem("munchkinScorekeeper")) {
data = JSON.parse(localStorage.getItem("munchkinScorekeeper"));
}
else {
initData();
}
}
for (var i = 0; i < data.players.length; i++) {
var id = data.players[i].id;
var name = data.players[i].name;
var level = data.players[i].level;
addPlayerToList(id);
$("#name_"+id).val(name);
$("#level_"+id).val(level);
}
$("#max_players").val(data.maxPlayers);
});
</script>
</body>
</html>