1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-04 01:59:38 +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;
text-align: center;
}
#content table tr.docBoundary > td:nth-of-type(1) {
#content table tr.docBoundary > td:first-child {
padding: 1em 0;
}
#content table tr.blocked {

View File

@ -37,7 +37,8 @@ var inspectedTabId = '';
var doc = document;
var body = doc.body;
var tbody = doc.querySelector('#content tbody');
var rowJunkyard = [];
var row1Junkyard = [];
var row4Junkyard = [];
var reFilter = null;
var filterTargetTestResult = true;
var maxEntries = 0;
@ -106,7 +107,7 @@ var renderURL = function(url, filter) {
/******************************************************************************/
var createRow = function() {
var tr = rowJunkyard.pop();
var tr = row4Junkyard.pop();
if ( tr ) {
tr.className = '';
return tr;
@ -121,13 +122,15 @@ var createRow = function() {
/******************************************************************************/
var insertGap = function(url) {
var tr = doc.createElement('tr');
tr.classList.add('docBoundary');
var td = doc.createElement('td');
td.setAttribute('colspan', '4');
td.textContent = url;
tr.appendChild(td);
var createGap = function(url) {
var tr = row1Junkyard.pop();
if ( !tr ) {
tr = doc.createElement('tr');
tr.classList.add('docBoundary');
tr.appendChild(doc.createElement('td'));
tr.cells[0].setAttribute('colspan', '4');
}
tr.cells[0].textContent = url;
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
// in order to visually separate entries for different documents.
if ( entry.type === 'main_frame' ) {
insertGap(entry.url);
createGap(entry.url);
tr.classList.add('maindoc');
}
@ -229,8 +232,17 @@ var truncateLog = function(size) {
size = 25000;
}
size = Math.min(size, 25000);
var tr;
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 tr;
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);
}
};