First pass at charsheet

This commit is contained in:
Eric Fredricksen
2010-07-06 00:04:37 -07:00
parent a5295df3ce
commit 73fe1bf0a7
4 changed files with 48 additions and 58 deletions
+14
View File
@@ -1,6 +1,20 @@
// TODO These code bits don't really belong here, but this is the only shared bit of js
function template(id, data) {
var tmpl = $("#" + id).html();
var brag = tmpl.replace(/\$([_A-Za-z.]+)/g, function (str, p1) {
var dict = data;
$.each(p1.split("."), function (i,v) {
if (!dict) return true;
dict = dict[v];
return null;
});
return dict || '';
});
return brag;
}
// From http://baagoe.com/en/RandomMusings/javascript/
// Johannes Baagøe <baagoe@baagoe.com>, 2010
function Mash() {