code review: fix quirks introduced with 2256552899

pull/2/head
Raymond Hill 6 years ago
parent 7c63d2b03d
commit 77a7b8febe
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

@ -238,8 +238,10 @@ var createRow = function(layout) {
if ( !td ) { break; } if ( !td ) { break; }
tdJunkyard.push(tr.removeChild(td)); tdJunkyard.push(tr.removeChild(td));
} }
tr.removeAttribute('data-tabid');
tr.removeAttribute('data-srchn'); tr.removeAttribute('data-srchn');
tr.removeAttribute('data-deshn'); tr.removeAttribute('data-deshn');
tr.removeAttribute('data-type');
return tr; return tr;
}; };
@ -256,7 +258,7 @@ var createGap = function(tabId, url) {
tr.classList.add('doc'); tr.classList.add('doc');
tr.classList.add('tab'); tr.classList.add('tab');
tr.classList.add('canMtx'); tr.classList.add('canMtx');
tr.classList.add('tab_' + tabId); tr.setAttribute('data-tabid', tabId);
tr.cells[firstVarDataCol].textContent = url; tr.cells[firstVarDataCol].textContent = url;
tbody.insertBefore(tr, tbody.firstChild); tbody.insertBefore(tr, tbody.firstChild);
}; };
@ -398,15 +400,13 @@ var renderLogEntries = function(response) {
/******************************************************************************/ /******************************************************************************/
var synchronizeTabIds = function(newPageStores) { var synchronizeTabIds = function(newPageStores) {
var oldPageStores = pageStores; let oldPageStores = pageStores;
var autoDeleteVoidRows = !!vAPI.localStorage.getItem('loggerAutoDeleteVoidRows'); let autoDeleteVoidRows = !!vAPI.localStorage.getItem('loggerAutoDeleteVoidRows');
var rowVoided = false; let rowVoided = false;
var trs; for ( let tabId of oldPageStores.keys() ) {
for ( let entry of oldPageStores ) {
let tabId = entry[0];
if ( newPageStores.has(tabId) ) { continue; } if ( newPageStores.has(tabId) ) { continue; }
// Mark or remove voided rows // Mark or remove voided rows
trs = uDom('.tab_' + tabId); let trs = uDom('[data-tabid="' + tabId + '"]');
if ( autoDeleteVoidRows ) { if ( autoDeleteVoidRows ) {
toJunkyard(trs); toJunkyard(trs);
} else { } else {
@ -415,16 +415,15 @@ var synchronizeTabIds = function(newPageStores) {
} }
} }
var select = document.getElementById('pageSelector'); let select = document.getElementById('pageSelector');
var selectValue = select.value; let selectValue = select.value;
var tabIds = Array.from(newPageStores.keys()).sort(function(a, b) { let tabIds = Array.from(newPageStores.keys()).sort(function(a, b) {
return newPageStores.get(a).localeCompare(newPageStores.get(b)); return newPageStores.get(a).localeCompare(newPageStores.get(b));
}); });
var option;
for ( var i = 0, j = 2; i < tabIds.length; i++ ) { for ( var i = 0, j = 2; i < tabIds.length; i++ ) {
let tabId = tabIds[i]; let tabId = tabIds[i];
if ( tabId === noTabId ) { continue; } if ( tabId === noTabId ) { continue; }
option = select.options[j]; let option = select.options[j];
j += 1; j += 1;
if ( !option ) { if ( !option ) {
option = document.createElement('option'); option = document.createElement('option');
@ -1085,7 +1084,7 @@ uDom('#clean').on('click', cleanBuffer);
uDom('#clear').on('click', clearBuffer); uDom('#clear').on('click', clearBuffer);
uDom('#maxEntries').on('change', onMaxEntriesChanged); uDom('#maxEntries').on('change', onMaxEntriesChanged);
uDom('#content table').on('click', 'tr > td:nth-of-type(1)', toggleCompactRow); uDom('#content table').on('click', 'tr > td:nth-of-type(1)', toggleCompactRow);
uDom('#content table').on('click', 'tr.canMtx > td:nth-of-type(3)', ruleEditor.start); uDom('#content table').on('click', 'tr[data-srchn][data-deshn][data-type] > td:nth-of-type(3)', ruleEditor.start);
/******************************************************************************/ /******************************************************************************/

Loading…
Cancel
Save