Index: desktop-options.js |
=================================================================== |
--- a/desktop-options.js |
+++ b/desktop-options.js |
@@ -652,18 +652,23 @@ |
case "show-more-filters-section": |
E("more-filters").setAttribute("aria-hidden", false); |
break; |
- case "switch-acceptable-ads": |
+ case "switch-acceptable-ads": { |
+ let isChecked = element.getAttribute("aria-checked") == "true"; |
let value = element.value || element.dataset.value; |
+ let isAcceptableAds = value == "ads"; |
+ |
browser.runtime.sendMessage({ |
- type: value == "privacy" ? "subscriptions.add" : |
+ type: isAcceptableAds != isChecked ? "subscriptions.add" : |
"subscriptions.remove", |
+ url: acceptableAdsUrl |
+ }); |
+ browser.runtime.sendMessage({ |
+ type: isAcceptableAds || isChecked ? "subscriptions.remove" : |
+ "subscriptions.add", |
url: acceptableAdsPrivacyUrl |
}); |
- browser.runtime.sendMessage({ |
- type: value == "ads" ? "subscriptions.add" : "subscriptions.remove", |
- url: acceptableAdsUrl |
- }); |
break; |
+ } |
case "switch-tab": |
switchTab(element.getAttribute("href").substr(1)); |
break; |
@@ -889,7 +894,11 @@ |
}); |
getDocLink("acceptable_ads_criteria", (link) => |
{ |
- setLinks("enable-aa-description", link); |
+ setLinks("enable-acceptable-ads-description", link); |
+ }); |
+ getDocLink("privacy_friendly_ads", (link) => |
+ { |
+ setLinks("enable-acceptable-ads-privacy-description", link); |
}); |
getDocLink("adblock_plus_{browser}_dnt", url => |
{ |
@@ -1034,20 +1043,30 @@ |
function setAcceptableAds() |
{ |
- let option = "none"; |
- document.forms["acceptable-ads"].classList.remove("show-dnt-notification"); |
+ let acceptableAdsForm = E("acceptable-ads"); |
+ let acceptableAds = E("acceptable-ads-allow"); |
+ let acceptableAdsPrivacy = E("acceptable-ads-privacy-allow"); |
+ acceptableAdsForm.classList.remove("show-dnt-notification"); |
+ acceptableAds.setAttribute("aria-checked", false); |
+ acceptableAdsPrivacy.setAttribute("aria-checked", false); |
if (acceptableAdsUrl in subscriptionsMap) |
{ |
- option = "ads"; |
+ acceptableAds.setAttribute("aria-checked", true); |
+ acceptableAdsPrivacy.disabled = false; |
} |
else if (acceptableAdsPrivacyUrl in subscriptionsMap) |
{ |
- option = "privacy"; |
+ acceptableAds.setAttribute("aria-checked", true); |
+ acceptableAdsPrivacy.setAttribute("aria-checked", true); |
+ acceptableAdsPrivacy.disabled = false; |
- if (!navigator.doNotTrack) |
- document.forms["acceptable-ads"].classList.add("show-dnt-notification"); |
+ if (navigator.doNotTrack != 1) |
+ acceptableAdsForm.classList.add("show-dnt-notification"); |
} |
- document.forms["acceptable-ads"]["acceptable-ads"].value = option; |
+ else |
+ { |
+ acceptableAdsPrivacy.disabled = true; |
+ } |
} |
function isAcceptableAds(url) |