Second pass at char sheet - ugly but mostly all there

This commit is contained in:
Eric Fredricksen
2010-07-06 00:15:57 -07:00
parent 73fe1bf0a7
commit 3dc59c774c
2 changed files with 18 additions and 4 deletions
+15 -1
View File
@@ -1,13 +1,27 @@
// TODO These code bits don't really belong here, but this is the only shared bit of js // TODO These code bits don't really belong here, but this is the only shared bit of js
function tabulate(html) {
var result = '';
$("<table>").html(html).find("tr").each(function () {
result += " " + $(this).children().first().text() + ": " +
$(this).children().last().text() + "\n";
});
return result;
}
function template(id, data) { function template(id, data) {
var tmpl = $("#" + id).html(); var tmpl = $("#" + id).html();
var brag = tmpl.replace(/\$([_A-Za-z.]+)/g, function (str, p1) { var brag = tmpl.replace(/\$([_A-Za-z.]+)/g, function (str, p1) {
var dict = data; var dict = data;
$.each(p1.split("."), function (i,v) { $.each(p1.split("."), function (i,v) {
if (!dict) return true; if (!dict) return true;
dict = dict[v]; if (v == "___") {
dict = tabulate(dict.html);
} else {
dict = dict[v.replace("_"," ")];
}
return null; return null;
}); });
return dict || ''; return dict || '';
+3 -3
View File
@@ -191,13 +191,13 @@ Stats:
CHA $Stats.CHA MP Max $Stats.MP_Max CHA $Stats.CHA MP Max $Stats.MP_Max
Equipment: Equipment:
$Equips.___ $Equips.___
Spell Book: Spell Book:
$Spells.___ $Spells.___
Inventory ($EncumBar.Hint): Inventory ($EncumBar.Hint):
$Inventory.___ $Inventory.___
-- $date -- $date
-- Progress Quest 6.3.web - http://progressquest.com/ -- Progress Quest 6.3.web - http://progressquest.com/