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

Side by Side Diff: js/desktop-options.js

Issue 29733668: Handle disabled state of AA
Patch Set: Hide toggle button when AA is enabled (Manvel Suggestion) Created March 26, 2018, 9 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « css/desktop-options.scss ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 displays[j].textContent = title; 230 displays[j].textContent = title;
231 } 231 }
232 232
233 element.setAttribute("aria-label", title); 233 element.setAttribute("aria-label", title);
234 if (this.details[i].searchable) 234 if (this.details[i].searchable)
235 element.setAttribute("data-search", title.toLowerCase()); 235 element.setAttribute("data-search", title.toLowerCase());
236 let controls = element.querySelectorAll(".control[role='checkbox']"); 236 let controls = element.querySelectorAll(".control[role='checkbox']");
237 for (let control of controls) 237 for (let control of controls)
238 { 238 {
239 control.setAttribute("aria-checked", item.disabled == false); 239 control.setAttribute("aria-checked", item.disabled == false);
240 if (isAcceptableAds(item.url) && this == collections.filterLists) 240 if (isAcceptableAds(item.url) && this == collections.filterLists &&
241 !item.disabled)
241 { 242 {
242 control.disabled = true; 243 control.disabled = true;
243 } 244 }
244 } 245 }
245 if (additionalSubscriptions.includes(item.url)) 246 if (additionalSubscriptions.includes(item.url))
246 { 247 {
247 element.classList.add("preconfigured"); 248 element.classList.add("preconfigured");
248 let disablePreconfigures = 249 let disablePreconfigures =
249 element.querySelectorAll("[data-disable~='preconfigured']"); 250 element.querySelectorAll("[data-disable~='preconfigured']");
250 for (let disablePreconfigure of disablePreconfigures) 251 for (let disablePreconfigure of disablePreconfigures)
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 1073
1073 function setAcceptableAds() 1074 function setAcceptableAds()
1074 { 1075 {
1075 let acceptableAdsForm = E("acceptable-ads"); 1076 let acceptableAdsForm = E("acceptable-ads");
1076 let acceptableAds = E("acceptable-ads-allow"); 1077 let acceptableAds = E("acceptable-ads-allow");
1077 let acceptableAdsPrivacy = E("acceptable-ads-privacy-allow"); 1078 let acceptableAdsPrivacy = E("acceptable-ads-privacy-allow");
1078 acceptableAdsForm.classList.remove("show-dnt-notification"); 1079 acceptableAdsForm.classList.remove("show-dnt-notification");
1079 acceptableAds.setAttribute("aria-checked", false); 1080 acceptableAds.setAttribute("aria-checked", false);
1080 acceptableAdsPrivacy.setAttribute("aria-checked", false); 1081 acceptableAdsPrivacy.setAttribute("aria-checked", false);
1081 acceptableAdsPrivacy.setAttribute("tabindex", 0); 1082 acceptableAdsPrivacy.setAttribute("tabindex", 0);
1082 if (acceptableAdsUrl in subscriptionsMap) 1083 if (acceptableAdsUrl in subscriptionsMap && !acceptableAdsUrl.disabled)
1083 { 1084 {
1084 acceptableAds.setAttribute("aria-checked", true); 1085 acceptableAds.setAttribute("aria-checked", true);
1085 acceptableAdsPrivacy.setAttribute("aria-disabled", false); 1086 acceptableAdsPrivacy.setAttribute("aria-disabled", false);
1086 } 1087 }
1087 else if (acceptableAdsPrivacyUrl in subscriptionsMap) 1088 else if (acceptableAdsPrivacyUrl in subscriptionsMap &&
1089 !acceptableAdsPrivacyUrl.disabled)
1088 { 1090 {
1089 acceptableAds.setAttribute("aria-checked", true); 1091 acceptableAds.setAttribute("aria-checked", true);
1090 acceptableAdsPrivacy.setAttribute("aria-checked", true); 1092 acceptableAdsPrivacy.setAttribute("aria-checked", true);
1091 acceptableAdsPrivacy.setAttribute("aria-disabled", false); 1093 acceptableAdsPrivacy.setAttribute("aria-disabled", false);
1092 1094
1093 // Edge uses window instead of navigator. 1095 // Edge uses window instead of navigator.
1094 // Prefer navigator first since it's the standard. 1096 // Prefer navigator first since it's the standard.
1095 if ((navigator.doNotTrack || window.doNotTrack) != 1) 1097 if ((navigator.doNotTrack || window.doNotTrack) != 1)
1096 acceptableAdsForm.classList.add("show-dnt-notification"); 1098 acceptableAdsForm.classList.add("show-dnt-notification");
1097 } 1099 }
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 "ui_warn_tracking"] 1499 "ui_warn_tracking"]
1498 }); 1500 });
1499 port.postMessage({ 1501 port.postMessage({
1500 type: "subscriptions.listen", 1502 type: "subscriptions.listen",
1501 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1503 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1502 "title", "downloadStatus", "downloading"] 1504 "title", "downloadStatus", "downloading"]
1503 }); 1505 });
1504 1506
1505 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1507 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1506 window.addEventListener("hashchange", onHashChange, false); 1508 window.addEventListener("hashchange", onHashChange, false);
OLDNEW
« 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