Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: js/desktop-options.js

Issue 29733668: Handle disabled state of AA
Patch Set: Fixed disabled state Created March 26, 2018, 9:12 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « css/desktop-options.scss ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: js/desktop-options.js
===================================================================
--- a/js/desktop-options.js
+++ b/js/desktop-options.js
@@ -232,20 +232,16 @@
element.setAttribute("aria-label", title);
if (this.details[i].searchable)
element.setAttribute("data-search", title.toLowerCase());
let controls = element.querySelectorAll(".control[role='checkbox']");
for (let control of controls)
{
control.setAttribute("aria-checked", item.disabled == false);
- if (isAcceptableAds(item.url) && this == collections.filterLists)
- {
- control.disabled = true;
- }
}
if (additionalSubscriptions.includes(item.url))
{
element.classList.add("preconfigured");
let disablePreconfigures =
element.querySelectorAll("[data-disable~='preconfigured']");
for (let disablePreconfigure of disablePreconfigures)
disablePreconfigure.disabled = true;
@@ -1074,22 +1070,24 @@
{
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);
acceptableAdsPrivacy.setAttribute("tabindex", 0);
- if (acceptableAdsUrl in subscriptionsMap)
+ if (acceptableAdsUrl in subscriptionsMap &&
+ !subscriptionsMap[acceptableAdsUrl].disabled)
{
acceptableAds.setAttribute("aria-checked", true);
acceptableAdsPrivacy.setAttribute("aria-disabled", false);
}
- else if (acceptableAdsPrivacyUrl in subscriptionsMap)
+ else if (acceptableAdsPrivacyUrl in subscriptionsMap &&
+ !subscriptionsMap[acceptableAdsPrivacyUrl].disabled)
{
acceptableAds.setAttribute("aria-checked", true);
acceptableAdsPrivacy.setAttribute("aria-checked", true);
acceptableAdsPrivacy.setAttribute("aria-disabled", false);
// Edge uses window instead of navigator.
// Prefer navigator first since it's the standard.
if ((navigator.doNotTrack || window.doNotTrack) != 1)
@@ -1287,16 +1285,19 @@
}
subscription = knownSubscription;
}
switch (action)
{
case "disabled":
updateSubscription(subscription);
setPrivacyConflict();
+
+ if (isAcceptableAds(subscription.url))
+ setAcceptableAds();
break;
case "downloading":
case "downloadStatus":
case "homepage":
case "lastDownload":
case "title":
updateSubscription(subscription);
break;
« no previous file with comments | « css/desktop-options.scss ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld