From 2e459a3982fa268813e8104c7e0b4d896243474e Mon Sep 17 00:00:00 2001 From: ablanathtanalba Date: Wed, 28 Jul 2021 14:44:03 -0700 Subject: [PATCH] basic toggling visibility of widgets section in popup --- src/js/popup.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/js/popup.js b/src/js/popup.js index 99e3d15d88..24894a6a50 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -220,6 +220,9 @@ function init() { // add event listeners for click-to-expand first party protections popup section $('#firstparty-protections-header').on('click', toggleFirstPartyInfoHandler); + // add event listeners for click-to-expand widgets section + $('#replaced-widgets-header').on('click', toggleWidgetsSectionHandler); + // show firstparty protections message if current tab is in our content scripts if (POPUP_DATA.enabled && POPUP_DATA.isOnFirstParty) { $("#firstparty-protections-container").show(); @@ -508,6 +511,21 @@ function toggleFirstPartyInfoHandler() { } } +/** + * Click handler for showing/hiding the replaced widgets section + */ +function toggleWidgetsSectionHandler() { + if ($('#collapse-widgets-popup').is(":visible")) { + $("#collapse-widgets-popup").hide(); + $("#expand-widgets-popup").show(); + $("#instructions-widgets-description").slideUp(); + } else { + $("#collapse-widgets-popup").show(); + $("#expand-widgets-popup").hide(); + $("#instructions-widgets-description").slideDown(); + } +} + /** * Handler to undo user selection for a tracker */