Browse Source

add partiness column in logger

pull/2/head
Raymond Hill 6 years ago
parent
commit
6b8be2ca43
No known key found for this signature in database GPG Key ID: 25E1490B761470C2
  1. 6
      src/css/logger-ui.css
  2. 85
      src/js/logger-ui.js
  3. 3
      src/logger-ui.html

6
src/css/logger-ui.css

@ -101,7 +101,10 @@ input:focus {
width: 5.4em;
}
#content table > colgroup > col:nth-of-type(5) {
width: calc(100% - 4.6em - 30% - 2.2em - 5.4em);
width: calc(100% - 4.6em - 30% - 2.2em - 5.4em - 1.8em);
}
#content table > colgroup > col:nth-of-type(6) {
width: 1.8em;
}
#content table tr {
background-color: #fafafa;
@ -152,6 +155,7 @@ body.compactView #content tr:not(.vExpanded) td {
white-space: nowrap;
}
#content table tr td:nth-of-type(2):not([colspan]) {
direction: rtl;
text-align: right;
}
#content table tr.tab:not(.canMtx) {

85
src/js/logger-ui.js

@ -33,7 +33,8 @@ var tbody = document.querySelector('#content tbody');
var trJunkyard = [];
var tdJunkyard = [];
var firstVarDataCol = 1; // currently, column 2 (0-based index)
var lastVarDataIndex = 4; // currently, 5 columns at most
var lastVarDataIndex =
document.querySelector('#content colgroup').childElementCount - 1;
var maxEntries = 0;
var noTabId = '';
var pageStores = new Map();
@ -85,6 +86,44 @@ let prependChild = function(parent, child) {
/******************************************************************************/
// We will lookup domains locally.
let domainFromSrcHostname = (function() {
let srcHn = '', srcDn = '';
return function(hn) {
if ( hn !== srcHn ) {
srcHn = hn;
srcDn = publicSuffixList.getDomain(hn);
}
return srcDn;
};
})();
let domainFromDesHostname = (function() {
let desHn = '', desDn = '';
return function(hn) {
if ( hn !== desHn ) {
desHn = hn;
desDn = publicSuffixList.getDomain(hn);
}
return desDn;
};
})();
let is3rdParty = function(srcHn, desHn) {
return domainFromSrcHostname(srcHn) !== domainFromDesHostname(desHn);
};
vAPI.messaging.send(
'logger-ui.js',
{ what: 'getPublicSuffixListData' },
response => {
publicSuffixList.fromSelfie(response);
}
);
/******************************************************************************/
// Emphasize hostname and cookie name.
var emphasizeCookie = function(s) {
@ -249,7 +288,7 @@ var renderLogEntry = function(entry) {
tr.cells[fvdc].textContent = details.info;
}
} else if ( details.srcHn !== undefined && details.desHn !== undefined ) {
tr = createRow('1111');
tr = createRow('11111');
tr.classList.add('canMtx');
tr.classList.add('cat_net');
tr.setAttribute('data-srchn', details.srcHn);
@ -267,14 +306,17 @@ var renderLogEntry = function(entry) {
} else {
tr.cells[fvdc+1].textContent = '';
}
tr.cells[fvdc+2].textContent = (prettyRequestTypes[details.type] || details.type);
tr.cells[fvdc+2].textContent =
prettyRequestTypes[details.type] || details.type;
if ( dontEmphasizeSet.has(details.type) ) {
tr.cells[fvdc+3].textContent = details.desURL;
} else {
tr.cells[fvdc+3].appendChild(emphasizeHostname(details.desURL));
}
tr.cells[fvdc+4].textContent =
is3rdParty(details.srcHn, details.desHn) ? '3p' : '';
} else if ( details.header ) {
tr = createRow('1111');
tr = createRow('11111');
tr.classList.add('canMtx');
tr.classList.add('cat_net');
tr.cells[fvdc+0].textContent = details.srcHn || '';
@ -286,6 +328,7 @@ var renderLogEntry = function(entry) {
}
tr.cells[fvdc+2].textContent = details.header.name;
tr.cells[fvdc+3].textContent = details.header.value;
tr.cells[fvdc+4].textContent = '';
} else {
tr = createRow('1');
tr.cells[fvdc].textContent = 'huh?';
@ -1033,40 +1076,6 @@ window.addEventListener('beforeunload', releaseView);
/******************************************************************************/
// We will lookup domains locally.
let domainFromSrcHostname = (function() {
let srcHn = '', srcDn = '';
return function(hn) {
if ( hn !== srcHn ) {
srcHn = hn;
srcDn = publicSuffixList.getDomain(hn);
}
return srcDn;
};
})();
let domainFromDesHostname = (function() {
let desHn = '', desDn = '';
return function(hn) {
if ( hn !== desHn ) {
desHn = hn;
desDn = publicSuffixList.getDomain(hn);
}
return desDn;
};
})();
vAPI.messaging.send(
'logger-ui.js',
{ what: 'getPublicSuffixListData' },
response => {
publicSuffixList.fromSelfie(response);
}
);
/******************************************************************************/
readLogBuffer();
uDom('#pageSelector').on('change', pageSelectorChanged);

3
src/logger-ui.html

@ -30,9 +30,8 @@
<div id="content">
<style id="tabFilterer"></style>
<style id="popupFilterer"></style>
<table>
<colgroup><col><col><col><col><col></colgroup>
<colgroup><col><col><col><col><col><col></colgroup>
<tbody></tbody>
</table>
</div>

Loading…
Cancel
Save