From 41a90bd55e8c12626012ce835958289663e5c82b Mon Sep 17 00:00:00 2001 From: gorhill Date: Sun, 14 Jun 2015 20:11:25 -0400 Subject: [PATCH] this fixes #345 --- src/js/logger-ui.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/js/logger-ui.js b/src/js/logger-ui.js index d34d49771..3246c9681 100644 --- a/src/js/logger-ui.js +++ b/src/js/logger-ui.js @@ -1534,14 +1534,25 @@ var toJunkyard = function(trs) { /******************************************************************************/ var clearBuffer = function() { + var tabId = uDom.nodeFromId('pageSelector').value || null; var tbody = document.querySelector('#content tbody'); - var tr; - while ( tbody.firstChild !== null ) { - tr = tbody.lastElementChild; - trJunkyard.push(tbody.removeChild(tr)); + var tr = tbody.lastElementChild; + var trPrevious; + while ( tr !== null ) { + trPrevious = tr.previousElementSibling; + if ( tabId === null || tr.classList.contains(tabId) ) { + trJunkyard.push(tbody.removeChild(tr)); + } + tr = trPrevious; } - uDom('#clear').addClass('disabled'); - uDom('#clean').addClass('disabled'); + uDom.nodeFromId('clear').classList.toggle( + 'disabled', + tbody.childElementCount === 0 + ); + uDom.nodeFromId('clean').classList.toggle( + 'disabled', + tbody.querySelector('tr.tab:not(.canMtx)') === null + ); }; /******************************************************************************/