diff -r 79b222c29887 -r f655dafb741e web/res/js/tracemanager.js --- a/web/res/js/tracemanager.js Thu Apr 12 17:55:56 2012 +0200 +++ b/web/res/js/tracemanager.js Fri Apr 13 19:19:53 2012 +0200 @@ -43,7 +43,7 @@ // Swap " (very frequent, which will be // serialized into %22) and ; (rather rare), this // saves some bytes - data = data.replace(/[;"]/g, function(s){ return s == ';' ? '"' : ';'; }).replace(/#/g, '%23'); + data = data.replace(/[;"#]/g, function(s){ return s == ';' ? '"' : ( s == '"' ? ';' : '%23'); }); // FIXME: check data length (< 2K is safe) var request=$('').error( function() { this.failureCount += 1; }) .load( function() { this.failureCount = 0; }) @@ -347,7 +347,7 @@ list_attribute_types: function() { var result = []; for (var prop in this.attributes) { - if (this.hasOwnProperty(prop)) + if (this.attributes.hasOwnProperty(prop)) result.push(prop); } /* FIXME: we return URIs here instead of AttributeType elements */ @@ -420,7 +420,7 @@ "subject": this.subject }; for (var prop in this.attributes) { - if (this.hasOwnProperty(prop)) + if (this.attributes.hasOwnProperty(prop)) r[prop] = this.attributes[prop]; } return r; @@ -432,7 +432,6 @@ */ toCompactJSON: function() { var r = { - "@i": this.id, "@t": (this.trace.shorthands.hasOwnProperty(this.type) ? this.trace.shorthands[this.type] : this.type), "@b": this.begin, "@s": this.subject @@ -441,8 +440,12 @@ if (this.begin !== this.end) r["@d"] = this.end - this.begin; + // Store id only if != "" + if (this.id !== "") + r["@i"] = this.id; + for (var prop in this.attributes) { - if (this.hasOwnProperty(prop)) + if (this.attributes.hasOwnProperty(prop)) { var v = this.attributes[prop]; r[prop] = this.trace.shorthands.hasOwnProperty(v) ? this.trace.shorthands[v] : v;