| Index: new-options.js |
| =================================================================== |
| --- a/new-options.js |
| +++ b/new-options.js |
| @@ -29,6 +29,7 @@ |
| let isCustomFiltersLoaded = false; |
| let {getMessage} = ext.i18n; |
| let customFilters = []; |
| + let showTrackingWarning = true; |
|
Thomas Greiner
2017/09/15 16:15:24
This value needs to come from the preferences. Oth
saroyanm
2017/09/15 18:37:35
Well spotted, thanks. Done.
|
| let filterErrors = new Map([ |
| ["synchronize_invalid_url", |
| "options_filterList_lastDownload_invalidURL"], |
| @@ -579,6 +580,9 @@ |
| case "close-dialog": |
| closeDialog(); |
| break; |
| + case "disallow-tracking": |
| + execAction("switch-acceptable-ads", {value: "privacy"}); |
| + break; |
| case "edit-custom-filters": |
| setCustomFiltersView("write"); |
| break; |
| @@ -1008,6 +1012,23 @@ |
| return url == acceptableAdsUrl || url == acceptableAdsPrivacyUrl; |
| } |
| + function hasPrivacyConflict() |
| + { |
| + let acceptableAdsList = subscriptionsMap[acceptableAdsUrl]; |
| + let privacyList = null; |
| + for (let url in subscriptionsMap) |
| + { |
| + let subscription = subscriptionsMap[url]; |
| + if (subscription.recommended == "privacy") |
| + { |
| + privacyList = subscription; |
| + break; |
| + } |
| + } |
| + return acceptableAdsList && acceptableAdsList.disabled == false && |
| + privacyList && privacyList.disabled == false && showTrackingWarning; |
|
Thomas Greiner
2017/09/15 16:15:24
Based on its name, the purpose of this function is
saroyanm
2017/09/15 18:37:35
Agree, Done.
|
| + } |
| + |
| function populateLists() |
| { |
| subscriptionsMap = Object.create(null); |
| @@ -1171,14 +1192,21 @@ |
| updateSubscription(subscription); |
| break; |
| case "added": |
| - if (subscription.url in subscriptionsMap) |
| + let url = subscription.url; |
| + if (url in subscriptionsMap) |
| updateSubscription(subscription); |
| else |
| addSubscription(subscription); |
| - if (isAcceptableAds(subscription.url)) |
| + if (isAcceptableAds(url)) |
| setAcceptableAds(); |
| + if (url == acceptableAdsUrl || subscription.recommended == "privacy") |
| + { |
| + if (hasPrivacyConflict()) |
| + openDialog("tracking"); |
| + } |
| + |
| collections.filterLists.addItem(subscription); |
| break; |
| case "removed": |
| @@ -1254,6 +1282,10 @@ |
| case "notifications_showui": |
| hidePref("notifications_ignoredcategories", !value); |
| break; |
| + |
| + case "ui_warn_tracking": |
| + showTrackingWarning = value; |
| + break; |
| } |
| let checkbox = document.querySelector( |
| @@ -1328,7 +1360,8 @@ |
| ext.backgroundPage.sendMessage({ |
| type: "prefs.listen", |
| filter: ["notifications_ignoredcategories", "notifications_showui", |
| - "show_devtools_panel", "shouldShowBlockElementMenu"] |
| + "show_devtools_panel", "shouldShowBlockElementMenu", |
| + "ui_warn_tracking"] |
| }); |
| ext.backgroundPage.sendMessage({ |
| type: "subscriptions.listen", |