From 3489fe0cf42199d214db8683d4c54ed844de69c7 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 2 Nov 2016 16:17:56 +0000 Subject: [PATCH] Better toggling between raw/string views of buffers --- nodes/core/core/lib/debug/debug-utils.js | 11 +++++------ nodes/core/core/lib/debug/style.css | 6 ++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/nodes/core/core/lib/debug/debug-utils.js b/nodes/core/core/lib/debug/debug-utils.js index 04c81805c..5466622a4 100644 --- a/nodes/core/core/lib/debug/debug-utils.js +++ b/nodes/core/core/lib/debug/debug-utils.js @@ -288,13 +288,14 @@ RED.debug = (function() { if (originalLength > 0) { $(' ').prependTo(header); var arrayRows = $('
').appendTo(element); + element.addClass('debug-message-buffer-raw'); makeExpandable(header,function() { if (!key) { headerHead = $('').html(typeHint||(type+'['+originalLength+']')).appendTo(header); } if (type === 'buffer') { - var stringRow = $('').hide().appendTo(element); - var sr = $('
').appendTo(stringRow); + var stringRow = $('
').appendTo(element); + var sr = $('').appendTo(stringRow); var stringEncoding = ""; try { stringEncoding = String.fromCharCode.apply(null, new Uint16Array(data)) @@ -306,12 +307,10 @@ RED.debug = (function() { $('').addClass('selected').html('raw').appendTo(bufferOpts).click(function(e) { if ($(this).text() === 'raw') { $(this).text('string'); - arrayRows.hide(); - stringRow.show(); + element.addClass('debug-message-buffer-string').removeClass('debug-message-buffer-raw'); } else { $(this).text('raw'); - arrayRows.show(); - stringRow.hide(); + element.removeClass('debug-message-buffer-string').addClass('debug-message-buffer-raw'); } e.preventDefault(); e.stopPropagation(); diff --git a/nodes/core/core/lib/debug/style.css b/nodes/core/core/lib/debug/style.css index b2ac04eff..9cdb27d54 100644 --- a/nodes/core/core/lib/debug/style.css +++ b/nodes/core/core/lib/debug/style.css @@ -163,3 +163,9 @@ border: 1px solid #999; background: #f3f3f3; } +.debug-message-buffer-raw > .debug-message-string-rows { + display: none; +} +.debug-message-buffer-string > .debug-message-array-rows { + display: none; +}