diff --git a/asn1.js b/asn1.js index 84f2f6a..7e16c04 100644 --- a/asn1.js +++ b/asn1.js @@ -246,6 +246,13 @@ ASN1.prototype.toDOM = function() { head.className = "head"; var s = this.typeName(); head.innerHTML = s; + var content = this.content(); //TODO: escape HTML + if (content != null) { + var preview = document.createElement("span"); + preview.className = "preview"; + preview.innerHTML = content; + head.appendChild(preview); + } node.appendChild(head); this.node = node; this.head = head; @@ -261,7 +268,6 @@ ASN1.prototype.toDOM = function() { s += "
(constructed)"; else if (((this.tag == 0x03) || (this.tag == 0x04)) && (this.sub != null)) s += "
(encapsulates)"; - var content = this.content(); if (content != null) { s += "
Value:
" + content + ""; if ((typeof(oids) == 'object') && (this.tag == 0x06)) { diff --git a/main.css b/main.css index d33ae5b..1850ba7 100644 --- a/main.css +++ b/main.css @@ -11,6 +11,7 @@ html, body { } .head { height: 1em; + overflow: hidden; } .node:hover > .head, .node.hover > .head { color: darkblue; @@ -37,6 +38,11 @@ html, body { .head:hover + .value { display: block; } +.preview { + margin-left: 1em; + color: #404040; + font-weight: normal; +} #tree { font-family: monospace; margin-right: 32em; /* this is approximate, TODO: find a way to know the exact width of #dump */