First pass at loading characters and a readable roster

This commit is contained in:
Eric Fredricksen
2010-07-02 21:07:49 -07:00
parent ca2f9b30c3
commit 1c6a681880
5 changed files with 92 additions and 80 deletions
+40
View File
@@ -0,0 +1,40 @@
$(document).ready(function () {
var games;
function load() {
var roster = $("#roster");
roster.empty();
roster.text("Loading...");
games = loadRoster()
if (!games) {
roster.text("Err...no local storage");
return;
}
$.each(games, function (index, c) {
var p = $("<dt/>");
p.appendTo(roster);
p.text(c.name);
var a = $("<a/>", {href: "main.html#" + c.name})
a.text(c.name);
a.appendTo(p);
p = $("<dd/>");
p.appendTo(roster);
p.text("Level " + (c.level || 1) + " " + c.race + " " + c['class']);
});
}
load();
$("#test").click(function () {
games.push({testy:"cul", "name":"betsy"});
storeRoster(games);
load();
});
$("#clear").click(function () {
storeRoster([]);
load();
});
});