Skip to content

Commit 30fb890

Browse files
committed
Remove widget replacement toggle
Part of #3007
1 parent a54bdce commit 30fb890

File tree

5 files changed

+13
-65
lines changed

5 files changed

+13
-65
lines changed

src/_locales/en_US/messages.json

-4
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,6 @@
491491
"message": "When blocking social buttons and other potentially useful (video, audio, comments) widgets, Privacy Badger can replace them with click-to-activate placeholders.",
492492
"description": "Introduction to the Widget Replacement tab on the options page"
493493
},
494-
"options_social_widgets_checkbox": {
495-
"message": "Enable widget replacement",
496-
"description": "Checkbox label on the Widget Replacement tab"
497-
},
498494
"options_widget_exceptions_header": {
499495
"message": "Widget Exceptions",
500496
"description": "Header text on the Widget Replacement tab"

src/js/background.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,6 @@ Badger.prototype = {
768768
showExpandedTrackingSection: false,
769769
showIntroPage: true,
770770
showNonTrackingDomains: false,
771-
socialWidgetReplacementEnabled: true,
772771
widgetReplacementExceptions: [],
773772
widgetSiteAllowlist: {},
774773
},
@@ -845,6 +844,7 @@ Badger.prototype = {
845844
"migrationLevel",
846845
"preventWebRTCIPLeak",
847846
"showTrackingDomains",
847+
"socialWidgetReplacementEnabled",
848848
"webRTCIPProtection",
849849
].forEach(item => {
850850
if (settings.hasItem(item)) { settings.deleteItem(item); }

src/js/options.js

-39
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ function loadOptions() {
113113
$("#removeAllData").button("option", "icons", {primary: "ui-icon-closethick"});
114114
$("#show_counter_checkbox").on("click", updateShowCounter);
115115
$("#show_counter_checkbox").prop("checked", OPTIONS_DATA.settings.showCounter);
116-
$("#replace-widgets-checkbox")
117-
.on("click", updateWidgetReplacement)
118-
.prop("checked", OPTIONS_DATA.settings.socialWidgetReplacementEnabled);
119116
$("#enable_dnt_checkbox").on("click", updateDNTCheckboxClicked);
120117
$("#enable_dnt_checkbox").prop("checked", OPTIONS_DATA.settings.sendDNTSignal);
121118
$("#check_dnt_policy_checkbox").on("click", updateCheckingDNTPolicy);
@@ -264,23 +261,6 @@ function loadOptions() {
264261

265262
const $widgetExceptions = $("#hide-widgets-select");
266263

267-
// disable Widget Replacement form elements when widget replacement is off
268-
function _disable_widget_forms(enable) {
269-
if (enable) {
270-
$widgetExceptions.prop("disabled", false);
271-
$("#widget-site-exceptions-select").prop("disabled", false);
272-
$('#widget-site-exceptions-remove-button').button("option", "disabled", false);
273-
} else {
274-
$widgetExceptions.prop("disabled", "disabled");
275-
$("#widget-site-exceptions-select").prop("disabled", "disabled");
276-
$('#widget-site-exceptions-remove-button').button("option", "disabled", true);
277-
}
278-
}
279-
_disable_widget_forms(OPTIONS_DATA.settings.socialWidgetReplacementEnabled);
280-
$("#replace-widgets-checkbox").on("change", function () {
281-
_disable_widget_forms($(this).is(":checked"));
282-
});
283-
284264
// Initialize Select2 and populate options
285265
$widgetExceptions.select2({
286266
width: '100%'
@@ -295,12 +275,6 @@ function loadOptions() {
295275
$widgetExceptions.on('select2:unselect', updateWidgetReplacementExceptions);
296276
$widgetExceptions.on('select2:clear', updateWidgetReplacementExceptions);
297277

298-
// hide the deprecated widget replacement toggle
299-
// unless the user previously checked it
300-
if (!OPTIONS_DATA.settings.socialWidgetReplacementEnabled) {
301-
$('#widget-replacement-toggle').show();
302-
}
303-
304278
reloadDisabledSites();
305279
reloadTrackingDomainsTab();
306280
reloadWidgetSiteExceptions();
@@ -467,19 +441,6 @@ function updateShowCounter() {
467441
});
468442
}
469443

470-
/**
471-
* Update setting for whether or not to replace
472-
* social buttons/video players/commenting widgets.
473-
*/
474-
function updateWidgetReplacement() {
475-
const socialWidgetReplacementEnabled = $("#replace-widgets-checkbox").prop("checked");
476-
477-
chrome.runtime.sendMessage({
478-
type: "updateSettings",
479-
data: { socialWidgetReplacementEnabled }
480-
});
481-
}
482-
483444
/**
484445
* Update DNT checkbox clicked
485446
*/

src/js/webrequest.js

+12-15
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function onBeforeRequest(details) {
179179

180180
if (utils.hasOwn(surrogates.WIDGET_SURROGATES, request_host)) {
181181
let settings = badger.getSettings();
182-
if (settings.getItem("socialWidgetReplacementEnabled") && !settings.getItem('widgetReplacementExceptions').includes(surrogates.WIDGET_SURROGATES[request_host].widgetName)) {
182+
if (!settings.getItem('widgetReplacementExceptions').includes(surrogates.WIDGET_SURROGATES[request_host].widgetName)) {
183183
surrogate = surrogates.getSurrogateUri(url, request_host);
184184
}
185185

@@ -625,19 +625,17 @@ function hideBlockedFrame(tab_id, parent_frame_id, frame_url, frame_host) {
625625
}
626626

627627
// don't hide widget frames
628-
if (badger.getSettings().getItem("socialWidgetReplacementEnabled")) {
629-
let exceptions = badger.getSettings().getItem('widgetReplacementExceptions');
630-
for (let widget of badger.widgetList) {
631-
if (exceptions.includes(widget.name)) {
632-
continue;
633-
}
634-
for (let domain of widget.domains) {
635-
if (domain == frame_host) {
628+
let exceptions = badger.getSettings().getItem('widgetReplacementExceptions');
629+
for (let widget of badger.widgetList) {
630+
if (exceptions.includes(widget.name)) {
631+
continue;
632+
}
633+
for (let domain of widget.domains) {
634+
if (domain == frame_host) {
635+
return;
636+
} else if (domain[0] == "*") { // leading wildcard domain
637+
if (frame_host.endsWith(domain.slice(1))) {
636638
return;
637-
} else if (domain[0] == "*") { // leading wildcard domain
638-
if (frame_host.endsWith(domain.slice(1))) {
639-
return;
640-
}
641639
}
642640
}
643641
}
@@ -1370,8 +1368,7 @@ function dispatcher(request, sender, sendResponse) {
13701368
let response = false,
13711369
tab_host = extractHostFromURL(sender.tab.url);
13721370

1373-
if (badger.isPrivacyBadgerEnabled(tab_host) &&
1374-
badger.getSettings().getItem("socialWidgetReplacementEnabled")) {
1371+
if (badger.isPrivacyBadgerEnabled(tab_host)) {
13751372
response = getWidgetList(sender.tab.id);
13761373
response.frameId = sender.frameId;
13771374
}

src/skin/options.html

-6
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,6 @@ <h4 class="i18n_options_advanced_settings"></h4>
254254

255255
<div id="tab-manage-widgets">
256256
<p><span class="i18n_options_widget_replacement_desc"></span></p>
257-
<p id="widget-replacement-toggle" style="display:none">
258-
<label>
259-
<input type="checkbox" id="replace-widgets-checkbox">
260-
<span class="i18n_options_social_widgets_checkbox"></span>
261-
</label>
262-
</p>
263257

264258
<h4 class="i18n_options_widget_exceptions_header"></h4>
265259

0 commit comments

Comments
 (0)