From ad4ac59a27e4a3441de2ddb5b4e8a8b65b0ce059 Mon Sep 17 00:00:00 2001 From: Lapo Luchini Date: Fri, 28 Aug 2009 18:39:02 +0000 Subject: [PATCH] Preview value (and add correct overflow value at head while we're at it). --- asn1.js | 8 +++++++- main.css | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) 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 */ -- 2.51.2