This commit is contained in:
gorhill 2015-06-14 20:11:25 -04:00
parent eeca7cb41f
commit 41a90bd55e
1 changed files with 17 additions and 6 deletions

View File

@ -1534,14 +1534,25 @@ var toJunkyard = function(trs) {
/******************************************************************************/ /******************************************************************************/
var clearBuffer = function() { var clearBuffer = function() {
var tabId = uDom.nodeFromId('pageSelector').value || null;
var tbody = document.querySelector('#content tbody'); var tbody = document.querySelector('#content tbody');
var tr; var tr = tbody.lastElementChild;
while ( tbody.firstChild !== null ) { var trPrevious;
tr = tbody.lastElementChild; while ( tr !== null ) {
trPrevious = tr.previousElementSibling;
if ( tabId === null || tr.classList.contains(tabId) ) {
trJunkyard.push(tbody.removeChild(tr)); trJunkyard.push(tbody.removeChild(tr));
} }
uDom('#clear').addClass('disabled'); tr = trPrevious;
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
);
}; };
/******************************************************************************/ /******************************************************************************/