1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-07 03:12:33 +01:00
This commit is contained in:
gorhill 2015-03-25 10:12:56 -04:00
parent 6450afefda
commit 6f155d55f8
3 changed files with 38 additions and 23 deletions

View File

@ -4,9 +4,9 @@ body {
float: left;
font: 13px sans-serif;
margin: 0;
overflow: hidden;
padding: 0;
white-space: nowrap;
overflow: hidden;
}
h2 {
background-color: #eee;
@ -210,6 +210,7 @@ body.dirty #refresh:hover {
#firewallContainer > div > span:nth-of-type(1) {
border-right: 1px solid white;
padding-right: 2px;
position: relative;
text-overflow: ellipsis;
width: 70%;
}
@ -245,14 +246,30 @@ body.dirty #refresh:hover {
#firewallContainer.minimized > div.isDomain > span:nth-of-type(4) {
display: inline-block;
}
#firewallContainer > div.allowed > span:nth-of-type(1) {
background-color: rgba(0, 160, 0, 0.1);
#firewallContainer > div.allowed > span:nth-of-type(1):before,
#firewallContainer > div.blocked > span:nth-of-type(1):before,
#firewallContainer.minimized > div.isDomain.totalAllowed > span:nth-of-type(1):before,
#firewallContainer.minimized > div.isDomain.totalBlocked > span:nth-of-type(1):before {
box-sizing: border-box;
content: '';
display: inline-block;
height: 100%;
left: 0;
opacity: 0.4;
position: absolute;
width: 7px;
}
#firewallContainer > div.blocked > span:nth-of-type(1) {
background-color: rgba(192, 0, 0, 0.1);
#firewallContainer > div.allowed > span:nth-of-type(1):before,
#firewallContainer.minimized > div.isDomain.totalAllowed > span:nth-of-type(1):before {
background-color: rgb(0, 160, 0);
}
#firewallContainer > div.allowed.blocked > span:nth-of-type(1) {
background-color: rgba(192, 160, 0, 0.1);
#firewallContainer > div.blocked > span:nth-of-type(1):before,
#firewallContainer.minimized > div.isDomain.totalBlocked > span:nth-of-type(1):before {
background-color: rgb(192, 0, 0);
}
#firewallContainer > div.allowed.blocked > span:nth-of-type(1):before,
#firewallContainer.minimized > div.isDomain.totalAllowed.totalBlocked > span:nth-of-type(1):before {
background-color: rgb(192, 160, 0);
}
#firewallContainer > div > span.aRule {
background-color: rgba(0, 160, 0, 0.3);

View File

@ -217,6 +217,7 @@ var getStats = function(tabId, tabTitle) {
};
var pageStore = µb.pageStoreFromTabId(tabId);
if ( pageStore ) {
r.rawURL = pageStore.rawURL;
r.pageURL = pageStore.pageURL;
r.pageDomain = pageStore.pageDomain;
r.pageHostname = pageStore.pageHostname;

View File

@ -83,6 +83,7 @@ var rowsToRecycle = uDom();
var cachedPopupHash = '';
var statsStr = vAPI.i18n('popupBlockedStats');
var domainsHitStr = vAPI.i18n('popupHitDomainCount');
var reNetworkRelatedURL = /^(?:ftps?|https?|wss?):\/\//;
/******************************************************************************/
@ -183,12 +184,14 @@ var addFirewallRow = function(des) {
row.descendants('span:nth-of-type(1)').text(punycode.toUnicode(des));
var hnDetails = popupData.hostnameDict[des] || {};
var isDomain = des === hnDetails.domain;
row.toggleClass('isDomain', isDomain);
row.toggleClass('isSubDomain', !isDomain);
row.toggleClass('allowed', hnDetails.allowCount !== 0);
row.toggleClass('blocked', hnDetails.blockCount !== 0);
row.toggleClass('isDomain', isDomain)
.toggleClass('isSubDomain', !isDomain)
.toggleClass('allowed', hnDetails.allowCount !== 0)
.toggleClass('blocked', hnDetails.blockCount !== 0)
.toggleClass('totalAllowed', hnDetails.totalAllowCount !== 0)
.toggleClass('totalBlocked', hnDetails.totalBlockCount !== 0);
row.appendTo('#firewallContainer');
return row;
@ -362,22 +365,16 @@ var renderPrivacyExposure = function() {
desHostnameDone[des] = true;
}
// Domain of the page must always be included
if ( allDomains.hasOwnProperty(popupData.pageDomain) === false ) {
// Domain of the page must always be included (if there is one)
if (
allDomains.hasOwnProperty(popupData.pageDomain) === false &&
reNetworkRelatedURL.test(popupData.rawURL)
) {
allHostnameRows.push(popupData.pageDomain);
allDomains[popupData.pageDomain] = false;
allDomainCount += 1;
}
// The root page domain must always be counted as connected: that's from
// where the root document was fetched.
// https://github.com/gorhill/uBlock/issues/759
// The root page domain must be counted if and only if it was actually
// obtained through a network request.
//if ( allDomainCount !== 0 && allDomains[popupData.pageDomain] === false ) {
// touchedDomainCount += 1;
//}
var summary = domainsHitStr.replace('{{count}}', touchedDomainCount.toLocaleString())
.replace('{{total}}', allDomainCount.toLocaleString());
uDom('#popupHitDomainCount').text(summary);