From 304a69bb271bac3f3a4d33bb714cd205458a05fc Mon Sep 17 00:00:00 2001
From: ablanathtanalba
Date: Thu, 11 Feb 2021 09:42:56 -0800
Subject: [PATCH 01/10] add default setting to hide expanded tracker info
section in popup
---
src/js/background.js | 1 +
src/js/popup.js | 2 +-
src/js/webrequest.js | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/js/background.js b/src/js/background.js
index dd223139e6..bd3566bc8c 100644
--- a/src/js/background.js
+++ b/src/js/background.js
@@ -815,6 +815,7 @@ Badger.prototype = {
seenComic: false,
sendDNTSignal: true,
showCounter: true,
+ showExpandedTrackingSection: false,
showIntroPage: true,
showNonTrackingDomains: false,
showTrackingDomains: false,
diff --git a/src/js/popup.js b/src/js/popup.js
index 37f6728929..b007c36fe7 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -585,7 +585,7 @@ function refreshPopup() {
$("#instructions-no-trackers").css("margin", "10px 0");
}
- if (printable.length) {
+ if (printable.length && POPUP_DATA.showExpandedTrackingSection) {
// get containing HTML for domain list along with toggle legend icons
$("#blockedResources")[0].innerHTML = htmlUtils.getTrackerContainerHtml();
}
diff --git a/src/js/webrequest.js b/src/js/webrequest.js
index 49648232e4..88e7396fb8 100644
--- a/src/js/webrequest.js
+++ b/src/js/webrequest.js
@@ -1039,6 +1039,7 @@ function dispatcher(request, sender, sendResponse) {
noTabData: false,
origins,
seenComic: badger.getSettings().getItem("seenComic"),
+ showExpandedTrackingSection: badger.getSettings().getItem("showExpandedTrackingSection"),
showLearningPrompt: badger.getPrivateSettings().getItem("showLearningPrompt"),
showNonTrackingDomains: badger.getSettings().getItem("showNonTrackingDomains"),
tabHost: tab_host,
From bea170f67b1693364e48e3aef8367b5a775f2848 Mon Sep 17 00:00:00 2001
From: ablanathtanalba
Date: Thu, 11 Feb 2021 10:28:16 -0800
Subject: [PATCH 02/10] add locale messages and html placeholders for toggling
blocked resources on popup
---
src/_locales/en_US/messages.json | 8 ++++++++
src/skin/popup.html | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/src/_locales/en_US/messages.json b/src/_locales/en_US/messages.json
index 53fc47f061..f2aaf4c55c 100644
--- a/src/_locales/en_US/messages.json
+++ b/src/_locales/en_US/messages.json
@@ -451,6 +451,14 @@
"message": "There are no third party resources on this page. Hooray for privacy!",
"description": "Text shown in the popup when showing non-tracking domains is enabled, and there are no third-party domains on the page."
},
+ "popup_show_more": {
+ "message": "Show more",
+ "description": "Instructions to click to expand the blocked resources container on the popup"
+ },
+ "popup_show_less": {
+ "message": "Show less",
+ "description": "Instructions to click to collapse the blocked resources container on the popup"
+ },
"intro_by_eff": {
"message": "A project of the Electronic Frontier Foundation",
"description": ""
diff --git a/src/skin/popup.html b/src/skin/popup.html
index c38fd60f4e..d82917726c 100644
--- a/src/skin/popup.html
+++ b/src/skin/popup.html
@@ -131,6 +131,10 @@
+
+
+
+
From 02319c49ba6e01c35bd39bfaab4e3953ad155e6a Mon Sep 17 00:00:00 2001
From: ablanathtanalba
Date: Thu, 18 Feb 2021 11:18:35 -0800
Subject: [PATCH 03/10] stubbed click handlers for toggling showing blocked
resources in popup
---
src/js/popup.js | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/src/js/popup.js b/src/js/popup.js
index b007c36fe7..db92860c81 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -189,6 +189,9 @@ function init() {
$('#blockedResourcesContainer').on('change', 'input:radio', updateOrigin);
$('#blockedResourcesContainer').on('click', '.userset .honeybadgerPowered', revertDomainControl);
+ $('#expand-blocked-resources-text').on('click', showBlockedResourcesHandler)
+ $('#collapse-blocked-resources-text').on('click', hideBlockedResourcesHandler)
+
$("#version").text(
chrome.i18n.getMessage("version", chrome.runtime.getManifest().version)
);
@@ -452,6 +455,28 @@ function revertDomainControl(event) {
});
}
+/**
+ * Click handler for expanding the blocked resources section
+ */
+function showBlockedResourcesHandler() {
+ $("#collapse-blocked-resources-text").show();
+ $("#expand-blocked-resources-text").hide();
+ chrome.runtime.sendMessage({
+ type: "showTrackingDomainsSection"
+ })
+}
+
+/**
+ * Click handler for hiding the blocked resources section
+ */
+function hideBlockedResourcesHandler() {
+ $("#collapse-blocked-resources-text").hide();
+ $("#expand-blocked-resources-text").show();
+ chrome.runtime.sendMessage({
+ type: "hideTrackingDomainsSection"
+ })
+}
+
/**
* Refresh the content of the popup window
*
From 67819bca83461330f4302a9c2555f4553d1d1d3c Mon Sep 17 00:00:00 2001
From: ablanathtanalba
Date: Thu, 18 Feb 2021 11:20:53 -0800
Subject: [PATCH 04/10] add webrequest handlers for toggling badger option to
show/hide blocked resources in popup
---
src/js/webrequest.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/js/webrequest.js b/src/js/webrequest.js
index 88e7396fb8..59523b70be 100644
--- a/src/js/webrequest.js
+++ b/src/js/webrequest.js
@@ -1127,6 +1127,18 @@ function dispatcher(request, sender, sendResponse) {
break;
}
+ case "showTrackingDomainsSection": {
+ badger.getSettings().setItem("showExpandedTrackingSection", true);
+ sendResponse();
+ break;
+ }
+
+ case "hideTrackingDomainsSection": {
+ badger.getSettings().setItem("showExpandedTrackingSection", false);
+ sendResponse();
+ break;
+ }
+
case "downloadCloud": {
chrome.storage.sync.get("disabledSites", function (store) {
if (chrome.runtime.lastError) {
From 99bdeb03399910207dd687bf9f4676940c5528d9 Mon Sep 17 00:00:00 2001
From: ablanathtanalba
Date: Thu, 18 Feb 2021 11:21:50 -0800
Subject: [PATCH 05/10] ui layout for hiding/showing blocked resources section
---
src/skin/popup.css | 4 ++++
src/skin/popup.html | 8 ++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/skin/popup.css b/src/skin/popup.css
index 2c45cd3352..45933d5e8d 100644
--- a/src/skin/popup.css
+++ b/src/skin/popup.css
@@ -173,6 +173,10 @@ font-size: 16px;
min-height: 70px;
}
+#toggleBlockedResourcesContainer {
+ text-align: center;
+}
+
#intro-reminder-btn, #critical-error-link, #learning-prompt-btn {
background-color: #ff641c;
border: 2px solid #ff641c;
diff --git a/src/skin/popup.html b/src/skin/popup.html
index d82917726c..cef2365e27 100644
--- a/src/skin/popup.html
+++ b/src/skin/popup.html
@@ -129,12 +129,12 @@
+
+
+
+
-
-
-
-
From 6be886f267a3dcbe4dfba1fb7a188a5f1ab94ccb Mon Sep 17 00:00:00 2001
From: ablanathtanalba
Date: Thu, 18 Feb 2021 11:23:14 -0800
Subject: [PATCH 06/10] lint
---
src/js/popup.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/js/popup.js b/src/js/popup.js
index db92860c81..d917fa04d0 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -189,8 +189,8 @@ function init() {
$('#blockedResourcesContainer').on('change', 'input:radio', updateOrigin);
$('#blockedResourcesContainer').on('click', '.userset .honeybadgerPowered', revertDomainControl);
- $('#expand-blocked-resources-text').on('click', showBlockedResourcesHandler)
- $('#collapse-blocked-resources-text').on('click', hideBlockedResourcesHandler)
+ $('#expand-blocked-resources-text').on('click', showBlockedResourcesHandler);
+ $('#collapse-blocked-resources-text').on('click', hideBlockedResourcesHandler);
$("#version").text(
chrome.i18n.getMessage("version", chrome.runtime.getManifest().version)
@@ -463,7 +463,7 @@ function showBlockedResourcesHandler() {
$("#expand-blocked-resources-text").hide();
chrome.runtime.sendMessage({
type: "showTrackingDomainsSection"
- })
+ });
}
/**
@@ -474,7 +474,7 @@ function hideBlockedResourcesHandler() {
$("#expand-blocked-resources-text").show();
chrome.runtime.sendMessage({
type: "hideTrackingDomainsSection"
- })
+ });
}
/**
From 01bde37f51847dd7738af524c06d6945cc979472 Mon Sep 17 00:00:00 2001
From: ablanathtanalba
Date: Sun, 21 Feb 2021 13:35:15 -0800
Subject: [PATCH 07/10] show/hide blocked resources on click in popup
---
src/js/popup.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/js/popup.js b/src/js/popup.js
index d917fa04d0..87ea3190b2 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -192,6 +192,16 @@ function init() {
$('#expand-blocked-resources-text').on('click', showBlockedResourcesHandler);
$('#collapse-blocked-resources-text').on('click', hideBlockedResourcesHandler);
+ if (POPUP_DATA.showExpandedTrackingSection) {
+ $('#expand-blocked-resources-text').hide();
+ $('#collapse-blocked-resources-text').show();
+ $('#blockedResources').show();
+ } else if (!POPUP_DATA.showExpandedTrackingSection) {
+ $('#expand-blocked-resources-text').show();
+ $('#collapse-blocked-resources-text').hide();
+ $('#blockedResources').hide();
+ }
+
$("#version").text(
chrome.i18n.getMessage("version", chrome.runtime.getManifest().version)
);
@@ -461,6 +471,7 @@ function revertDomainControl(event) {
function showBlockedResourcesHandler() {
$("#collapse-blocked-resources-text").show();
$("#expand-blocked-resources-text").hide();
+ $("#blockedResources").show();
chrome.runtime.sendMessage({
type: "showTrackingDomainsSection"
});
@@ -472,6 +483,7 @@ function showBlockedResourcesHandler() {
function hideBlockedResourcesHandler() {
$("#collapse-blocked-resources-text").hide();
$("#expand-blocked-resources-text").show();
+ $("#blockedResources").hide();
chrome.runtime.sendMessage({
type: "hideTrackingDomainsSection"
});
From bfbed5bcedb1146523b7b462cabf503cb66b57c3 Mon Sep 17 00:00:00 2001
From: ablanathtanalba
Date: Mon, 22 Feb 2021 09:43:20 -0800
Subject: [PATCH 08/10] removed unnecessary check in building blocked resources
div
---
src/js/popup.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/js/popup.js b/src/js/popup.js
index 87ea3190b2..35925ef034 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -622,7 +622,7 @@ function refreshPopup() {
$("#instructions-no-trackers").css("margin", "10px 0");
}
- if (printable.length && POPUP_DATA.showExpandedTrackingSection) {
+ if (printable.length) {
// get containing HTML for domain list along with toggle legend icons
$("#blockedResources")[0].innerHTML = htmlUtils.getTrackerContainerHtml();
}
From d9cf215be1128718ba1f33aaef1365775528ef6f Mon Sep 17 00:00:00 2001
From: ablanathtanalba
Date: Tue, 23 Feb 2021 14:33:14 -0800
Subject: [PATCH 09/10] make sure selenium popup selenium test expands blocked
resources section
---
tests/selenium/popup_test.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/selenium/popup_test.py b/tests/selenium/popup_test.py
index e2f1c56c41..844dbdb4e1 100644
--- a/tests/selenium/popup_test.py
+++ b/tests/selenium/popup_test.py
@@ -230,6 +230,9 @@ def test_reverting_control(self):
self.open_popup(origins={DOMAIN:"cookieblock"})
+ # make sure the 'see more' blocked resources container is expanded
+ self.driver.find_element_by_id("expand-blocked-resources-text").click()
+
# set the domain to user control
# click input with JavaScript to avoid "Element ... is not clickable" /
# "Other element would receive the click" Selenium limitation
From 492014ce1c1133eef2f4624c85d1f82615062b74 Mon Sep 17 00:00:00 2001
From: ablanathtanalba
Date: Tue, 23 Feb 2021 14:56:52 -0800
Subject: [PATCH 10/10] ensure hiding the toggle sliders visibility area when
there are no trackers on page
---
src/js/popup.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/js/popup.js b/src/js/popup.js
index 35925ef034..ec52f378c1 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -543,9 +543,10 @@ function refreshPopup() {
}
if (!originsArr.length) {
- // hide the number of trackers and slider instructions message
+ // hide the number of trackers, slider instructions messages
// if no sliders will be displayed
$("#instructions-many-trackers").hide();
+ $("#toggleBlockedResourcesContainer").hide();
// show "no trackers" message
$("#instructions-no-trackers").show();