Frontend tweaks

This commit is contained in:
Dan Sosedoff
2014-10-13 19:49:43 -05:00
parent e78499551e
commit 5dd26cd8d0
5 changed files with 79 additions and 38 deletions

View File

@@ -30,6 +30,14 @@ function loadTables() {
});
}
function escapeHtml(str) {
if (str != null || str != undefined) {
return jQuery("<div/>").text(str).html();
}
return "<span class='null'>null</span>";
}
function buildTable(results) {
$("#results").text("").removeClass("empty");
@@ -54,7 +62,7 @@ function buildTable(results) {
results.rows.forEach(function(row) {
var r = "";
for (i in row) { r += "<td>" + row[i] + "</td>"; }
for (i in row) { r += "<td><div>" + escapeHtml(row[i]) + "</div></td>"; }
rows += "<tr>" + r + "</tr>";
});