From 7fbde83a28a8be60d98ae3e72cad78e81782534e Mon Sep 17 00:00:00 2001 From: gorhill Date: Mon, 4 Jan 2016 10:48:28 -0500 Subject: [PATCH] this fixes #912 --- src/css/popup.css | 2 +- src/js/messaging.js | 2 ++ src/js/pagestore.js | 1 + src/js/popup.js | 5 +++++ src/js/tab.js | 1 + src/popup.html | 2 +- 6 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/css/popup.css b/src/css/popup.css index ad849a29a..c2accd096 100644 --- a/src/css/popup.css +++ b/src/css/popup.css @@ -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; diff --git a/src/js/messaging.js b/src/js/messaging.js index 847e12f9e..c76e6360a 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -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(); diff --git a/src/js/pagestore.js b/src/js/pagestore.js index 39198d9af..8ed1103d3 100644 --- a/src/js/pagestore.js +++ b/src/js/pagestore.js @@ -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 diff --git a/src/js/popup.js b/src/js/popup.js index a9f826828..d2776b2e7 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -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') diff --git a/src/js/tab.js b/src/js/tab.js index 05611fdf0..72c03b797 100644 --- a/src/js/tab.js +++ b/src/js/tab.js @@ -663,6 +663,7 @@ vAPI.tabs.onPopupUpdated = (function() { var pageStore = µb.pageStoreFromTabId(openerTabId); if ( pageStore ) { pageStore.logRequest(context, result); + pageStore.popupBlockedCount += 1; } // Blocked diff --git a/src/popup.html b/src/popup.html index 34f0a48b2..87f061d7d 100644 --- a/src/popup.html +++ b/src/popup.html @@ -27,7 +27,7 @@

 

 

- +