This commit is contained in:
gorhill 2016-01-04 10:48:28 -05:00
parent 98cf38d9e5
commit 7fbde83a28
6 changed files with 11 additions and 2 deletions

View File

@ -183,7 +183,7 @@ body.off #switch .fa {
position: relative;
}
#extraTools > span > span.badge {
color: #666;
color: #222;
bottom: 0;
font: 10.5px sans-serif;
position: absolute;

View File

@ -294,6 +294,7 @@ var popupDataFromTabId = function(tabId, tabTitle) {
pageDomain: tabContext.rootDomain,
pageAllowedRequestCount: 0,
pageBlockedRequestCount: 0,
popupBlockedCount: 0,
tabId: tabId,
tabTitle: tabTitle,
tooltipsDisabled: µb.userSettings.tooltipsDisabled
@ -313,6 +314,7 @@ var popupDataFromTabId = function(tabId, tabTitle) {
r.noCosmeticFiltering = µb.hnSwitches.evaluateZ('no-cosmetic-filtering', tabContext.rootHostname);
r.noRemoteFonts = µb.hnSwitches.evaluateZ('no-remote-fonts', tabContext.rootHostname);
r.remoteFontCount = pageStore.remoteFontCount;
r.popupBlockedCount = pageStore.popupBlockedCount;
} else {
r.hostnameDict = {};
r.firewallRules = getFirewallRules();

View File

@ -304,6 +304,7 @@ PageStore.prototype.init = function(tabId) {
this.perLoadAllowedRequestCount = 0;
this.hiddenElementCount = ''; // Empty string means "unknown"
this.remoteFontCount = 0;
this.popupBlockedCount = 0;
this.netFilteringCache = NetFilteringResultCache.factory();
// Support `elemhide` filter option. Called at this point so the required

View File

@ -463,6 +463,11 @@ var renderPopup = function() {
uDom.nodeFromId('no-cosmetic-filtering').classList.toggle('on', popupData.noCosmeticFiltering === true);
uDom.nodeFromId('no-remote-fonts').classList.toggle('on', popupData.noRemoteFonts === true);
// Report blocked popup count on badge
total = popupData.popupBlockedCount;
uDom.nodeFromSelector('#no-popups > span.badge')
.textContent = total ? total.toLocaleString() : '';
// Report remote font count on badge
total = popupData.remoteFontCount;
uDom.nodeFromSelector('#no-remote-fonts > span.badge')

View File

@ -663,6 +663,7 @@ vAPI.tabs.onPopupUpdated = (function() {
var pageStore = µb.pageStoreFromTabId(openerTabId);
if ( pageStore ) {
pageStore.logRequest(context, result);
pageStore.popupBlockedCount += 1;
}
// Blocked

View File

@ -27,7 +27,7 @@
<h2 data-i18n="popupHitDomainCountPrompt">&nbsp;</h2>
<p class="statValue" id="popupHitDomainCount">&nbsp;</p>
<div id="extraTools">
<span id="no-popups" class="hnSwitch fa" data-i18n-tip="popupTipNoPopups">&#xf0c5;<span></span></span>
<span id="no-popups" class="hnSwitch fa" data-i18n-tip="popupTipNoPopups">&#xf0c5;<span class="badge"></span><span></span></span>
<span id="no-strict-blocking" class="hnSwitch fa" data-i18n-tip="popupTipNoStrictBlocking">&#xf071;<span></span></span>
<span id="no-cosmetic-filtering" class="hnSwitch fa" data-i18n-tip="popupTipNoCosmeticFiltering">&#xf070;<span class="badge"></span><span></span></span>
<span id="no-remote-fonts" class="hnSwitch fa" data-i18n-tip="popupTipNoRemoteFonts">&#xf031;<span class="badge"></span><span></span></span>