1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-15 15:32:28 +02:00
This commit is contained in:
gorhill 2015-04-25 09:33:43 -04:00
parent 5197bf1a57
commit 782ea0a337
2 changed files with 34 additions and 13 deletions

View File

@ -60,7 +60,7 @@ input:focus {
color: white; color: white;
text-align: center; text-align: center;
} }
#content table tr.docBoundary > td:nth-of-type(1) { #content table tr.docBoundary > td:first-child {
padding: 1em 0; padding: 1em 0;
} }
#content table tr.blocked { #content table tr.blocked {

View File

@ -37,7 +37,8 @@ var inspectedTabId = '';
var doc = document; var doc = document;
var body = doc.body; var body = doc.body;
var tbody = doc.querySelector('#content tbody'); var tbody = doc.querySelector('#content tbody');
var rowJunkyard = []; var row1Junkyard = [];
var row4Junkyard = [];
var reFilter = null; var reFilter = null;
var filterTargetTestResult = true; var filterTargetTestResult = true;
var maxEntries = 0; var maxEntries = 0;
@ -106,7 +107,7 @@ var renderURL = function(url, filter) {
/******************************************************************************/ /******************************************************************************/
var createRow = function() { var createRow = function() {
var tr = rowJunkyard.pop(); var tr = row4Junkyard.pop();
if ( tr ) { if ( tr ) {
tr.className = ''; tr.className = '';
return tr; return tr;
@ -121,13 +122,15 @@ var createRow = function() {
/******************************************************************************/ /******************************************************************************/
var insertGap = function(url) { var createGap = function(url) {
var tr = doc.createElement('tr'); var tr = row1Junkyard.pop();
tr.classList.add('docBoundary'); if ( !tr ) {
var td = doc.createElement('td'); tr = doc.createElement('tr');
td.setAttribute('colspan', '4'); tr.classList.add('docBoundary');
td.textContent = url; tr.appendChild(doc.createElement('td'));
tr.appendChild(td); tr.cells[0].setAttribute('colspan', '4');
}
tr.cells[0].textContent = url;
tbody.insertBefore(tr, tbody.firstChild); tbody.insertBefore(tr, tbody.firstChild);
}; };
@ -139,7 +142,7 @@ var renderLogEntry = function(entry) {
// If the request is that of a root frame, insert a gap in the table // If the request is that of a root frame, insert a gap in the table
// in order to visually separate entries for different documents. // in order to visually separate entries for different documents.
if ( entry.type === 'main_frame' ) { if ( entry.type === 'main_frame' ) {
insertGap(entry.url); createGap(entry.url);
tr.classList.add('maindoc'); tr.classList.add('maindoc');
} }
@ -229,8 +232,17 @@ var truncateLog = function(size) {
size = 25000; size = 25000;
} }
size = Math.min(size, 25000); size = Math.min(size, 25000);
var tr;
while ( tbody.childElementCount > size ) { while ( tbody.childElementCount > size ) {
rowJunkyard.push(tbody.removeChild(tbody.lastElementChild)); tr = tbody.lastElementChild;
// https://github.com/gorhill/uBlock/issues/123
// Triage according to row type.
if ( tr.cells.length === 1 ) {
row1Junkyard.push(tr);
} else {
row4Junkyard.push(tr);
}
tbody.removeChild(tr);
} }
}; };
@ -254,8 +266,17 @@ var readLogBuffer = function() {
/******************************************************************************/ /******************************************************************************/
var clearBuffer = function() { var clearBuffer = function() {
var tr;
while ( tbody.firstChild !== null ) { while ( tbody.firstChild !== null ) {
rowJunkyard.push(tbody.removeChild(tbody.firstChild)); tr = tbody.lastElementChild;
// https://github.com/gorhill/uBlock/issues/123
// Triage according to row type.
if ( tr.cells.length === 1 ) {
row1Junkyard.push(tr);
} else {
row4Junkyard.push(tr);
}
tbody.removeChild(tr);
} }
}; };