Reduce size of save by half or so

This commit is contained in:
Eric Fredricksen
2010-07-09 21:06:54 -07:00
parent cd7f62fd7d
commit 39061d3460
3 changed files with 86 additions and 45 deletions
+9 -5
View File
@@ -1,11 +1,15 @@
// TODO These code bits don't really belong here, but this is the only shared bit of js
function tabulate(html) {
function tabulate(list) {
var result = '';
$("<table>").html(html).find("tr").each(function () {
result += " " + $(this).children().first().text() + ": " +
$(this).children().last().text() + "\n";
$.each(list, function (index) {
if (this.length == 2) {
if (this[1].length)
result += " " + this[0] + ": " + this[1] + "\n";
} else {
result += " " + this + "\n";
}
});
return result;
}
@@ -17,7 +21,7 @@ function template(tmpl, data) {
$.each(p1.split("."), function (i,v) {
if (!dict) return true;
if (v == "___") {
dict = tabulate(dict.html);
dict = tabulate(dict);
} else {
dict = dict[v.replace("_"," ")];
}