Index: new-options.js |
=================================================================== |
--- a/new-options.js |
+++ b/new-options.js |
@@ -27,6 +27,7 @@ |
let acceptableAdsUrl = null; |
let acceptableAdsPrivacyUrl = null; |
let isCustomFiltersLoaded = false; |
+ let isSubscriptionsLoaded = false; |
let {getMessage} = ext.i18n; |
let customFilters = []; |
let filterErrors = new Map([ |
@@ -1008,6 +1009,18 @@ |
return url == acceptableAdsUrl || url == acceptableAdsPrivacyUrl; |
} |
+ function isPrivacyAndAdsEnabled() |
+ { |
+ let isAcceptableAds = subscriptionsMap[acceptableAdsUrl]; |
+ isAcceptableAds = isAcceptableAds && isAcceptableAds.disabled == false; |
+ for (let url in subscriptionsMap) |
+ { |
+ let subscription = subscriptionsMap[url]; |
+ if (subscription.recommended == "privacy") |
+ return subscription.disabled == false && isAcceptableAds; |
+ } |
+ } |
+ |
function populateLists() |
{ |
subscriptionsMap = Object.create(null); |
@@ -1070,6 +1083,7 @@ |
{ |
for (let subscription of subscriptions) |
onSubscriptionMessage("added", subscription); |
+ isSubscriptionsLoaded = true; |
}); |
}); |
}); |
@@ -1171,14 +1185,27 @@ |
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 == acceptableAdsPrivacyUrl) |
+ { |
+ if (!navigator.doNotTrack) |
+ setDntNotification(true); |
+ } |
+ |
+ if (url == acceptableAdsUrl || subscription.recommended == "privacy") |
+ { |
+ if (isSubscriptionsLoaded && isPrivacyAndAdsEnabled()) |
+ openDialog("tracking"); |
+ } |
+ |
collections.filterLists.addItem(subscription); |
break; |
case "removed": |