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

Delta Between Two Patch Sets: desktop-options.js

Issue 29584714: Issue 5874 - Sync strings with the agencies translations (Closed)
Left Patch Set: Created Oct. 20, 2017, 9:10 p.m.
Right Patch Set: Updated Fanboy's list tooltip description Created Oct. 23, 2017, 4:30 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « desktop-options.html ('k') | locale/en_US/common.json » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 }); 553 });
554 } 554 }
555 555
556 function switchTab(id) 556 function switchTab(id)
557 { 557 {
558 location.hash = id; 558 location.hash = id;
559 } 559 }
560 560
561 function execAction(action, element) 561 function execAction(action, element)
562 { 562 {
563 if (element.getAttribute("aria-disabled") == "true")
564 return;
565
563 switch (action) 566 switch (action)
564 { 567 {
565 case "add-domain-exception": 568 case "add-domain-exception":
566 addWhitelistedDomain(); 569 addWhitelistedDomain();
567 break; 570 break;
568 case "add-language-subscription": 571 case "add-language-subscription":
569 addEnableSubscription(findParentData(element, "access", false)); 572 addEnableSubscription(findParentData(element, "access", false));
570 break; 573 break;
571 case "add-predefined-subscription": { 574 case "add-predefined-subscription": {
572 let dialog = E("dialog-content-predefined"); 575 let dialog = E("dialog-content-predefined");
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 () => 651 () =>
649 { 652 {
650 setCustomFiltersView("read"); 653 setCustomFiltersView("read");
651 }); 654 });
652 break; 655 break;
653 case "show-more-filters-section": 656 case "show-more-filters-section":
654 E("more-filters").setAttribute("aria-hidden", false); 657 E("more-filters").setAttribute("aria-hidden", false);
655 break; 658 break;
656 case "switch-acceptable-ads": 659 case "switch-acceptable-ads":
657 let value = element.value || element.dataset.value; 660 let value = element.value || element.dataset.value;
661 // User check the checkbox
662 let shouldCheck = element.getAttribute("aria-checked") != "true";
663 let installAcceptableAds = false;
664 let installAcceptableAdsPrivacy = false;
665 // Acceptable Ads checkbox clicked
666 if (value == "ads")
667 {
668 installAcceptableAds = shouldCheck;
669 }
670 // Privacy Friendly Acceptable Ads checkbox clicked
671 else
672 {
673 installAcceptableAdsPrivacy = shouldCheck;
674 installAcceptableAds = !shouldCheck;
675 }
676
658 browser.runtime.sendMessage({ 677 browser.runtime.sendMessage({
659 type: value == "privacy" ? "subscriptions.add" : 678 type: installAcceptableAds ? "subscriptions.add" :
679 "subscriptions.remove",
680 url: acceptableAdsUrl
681 });
682 browser.runtime.sendMessage({
683 type: installAcceptableAdsPrivacy ? "subscriptions.add" :
660 "subscriptions.remove", 684 "subscriptions.remove",
661 url: acceptableAdsPrivacyUrl 685 url: acceptableAdsPrivacyUrl
662 });
663 browser.runtime.sendMessage({
664 type: value == "ads" ? "subscriptions.add" : "subscriptions.remove",
665 url: acceptableAdsUrl
666 }); 686 });
667 break; 687 break;
668 case "switch-tab": 688 case "switch-tab":
669 switchTab(element.getAttribute("href").substr(1)); 689 switchTab(element.getAttribute("href").substr(1));
670 break; 690 break;
671 case "toggle-disable-subscription": 691 case "toggle-disable-subscription":
672 browser.runtime.sendMessage({ 692 browser.runtime.sendMessage({
673 type: "subscriptions.toggle", 693 type: "subscriptions.toggle",
674 keepInstalled: true, 694 keepInstalled: true,
675 url: findParentData(element, "access", false) 695 url: findParentData(element, "access", false)
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 E("whitelisting-add-button").disabled = !e.target.value; 904 E("whitelisting-add-button").disabled = !e.target.value;
885 }, false); 905 }, false);
886 906
887 // General tab 907 // General tab
888 getDocLink("contribute", (link) => 908 getDocLink("contribute", (link) =>
889 { 909 {
890 E("contribute").href = link; 910 E("contribute").href = link;
891 }); 911 });
892 getDocLink("acceptable_ads_criteria", (link) => 912 getDocLink("acceptable_ads_criteria", (link) =>
893 { 913 {
894 setLinks("enable-aa-description", link); 914 setLinks("enable-acceptable-ads-description", link);
915 });
916 getDocLink("privacy_friendly_ads", (link) =>
917 {
918 E("enable-acceptable-ads-privacy-description").href = link;
895 }); 919 });
896 getDocLink("adblock_plus_{browser}_dnt", url => 920 getDocLink("adblock_plus_{browser}_dnt", url =>
897 { 921 {
898 setLinks("dnt", url); 922 setLinks("dnt", url);
899 }); 923 });
900 924
901 // Whitelisted tab 925 // Whitelisted tab
902 getDocLink("whitelist", (link) => 926 getDocLink("whitelist", (link) =>
903 { 927 {
904 setLinks("whitelist-description", link); 928 E("whitelist-learn-more").href = link;
905 }); 929 });
906 930
907 // Advanced tab 931 // Advanced tab
908 let customize = document.querySelectorAll("#customize li[data-pref]"); 932 let customize = document.querySelectorAll("#customize li[data-pref]");
909 customize = Array.prototype.map.call(customize, (checkbox) => 933 customize = Array.prototype.map.call(customize, (checkbox) =>
910 { 934 {
911 return checkbox.getAttribute("data-pref"); 935 return checkbox.getAttribute("data-pref");
912 }); 936 });
913 for (let key of customize) 937 for (let key of customize)
914 { 938 {
(...skipping 11 matching lines...) Expand all
926 hidePref("show_devtools_panel", !features.devToolsPanel); 950 hidePref("show_devtools_panel", !features.devToolsPanel);
927 }); 951 });
928 952
929 getDocLink("filterdoc", (link) => 953 getDocLink("filterdoc", (link) =>
930 { 954 {
931 E("link-filters").setAttribute("href", link); 955 E("link-filters").setAttribute("href", link);
932 }); 956 });
933 957
934 getDocLink("subscriptions", (link) => 958 getDocLink("subscriptions", (link) =>
935 { 959 {
936 setLinks("filter-lists-description", link); 960 E("filter-lists-learn-more").setAttribute("href", link);
937 }); 961 });
938 962
939 E("custom-filters-raw").setAttribute("placeholder", 963 E("custom-filters-raw").setAttribute("placeholder",
940 getMessage("options_customFilters_edit_placeholder", ["/ads/track/*"])); 964 getMessage("options_customFilters_edit_placeholder", ["/ads/track/*"]));
941 965
942 // Help tab 966 // Help tab
943 getDocLink("adblock_plus_report_issue", (link) => 967 getDocLink("adblock_plus_report_issue", (link) =>
944 { 968 {
945 setLinks("report-issue", link); 969 setLinks("report-issue", link);
946 }); 970 });
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 } 1059 }
1036 1060
1037 function hideNotification() 1061 function hideNotification()
1038 { 1062 {
1039 E("notification").setAttribute("aria-hidden", true); 1063 E("notification").setAttribute("aria-hidden", true);
1040 E("notification-text").textContent = ""; 1064 E("notification-text").textContent = "";
1041 } 1065 }
1042 1066
1043 function setAcceptableAds() 1067 function setAcceptableAds()
1044 { 1068 {
1045 let option = "none"; 1069 let acceptableAdsForm = E("acceptable-ads");
1046 document.forms["acceptable-ads"].classList.remove("show-dnt-notification"); 1070 let acceptableAds = E("acceptable-ads-allow");
1071 let acceptableAdsPrivacy = E("acceptable-ads-privacy-allow");
1072 acceptableAdsForm.classList.remove("show-dnt-notification");
1073 acceptableAds.setAttribute("aria-checked", false);
1074 acceptableAdsPrivacy.setAttribute("aria-checked", false);
1075 acceptableAdsPrivacy.setAttribute("tabindex", 0);
1047 if (acceptableAdsUrl in subscriptionsMap) 1076 if (acceptableAdsUrl in subscriptionsMap)
1048 { 1077 {
1049 option = "ads"; 1078 acceptableAds.setAttribute("aria-checked", true);
1079 acceptableAdsPrivacy.setAttribute("aria-disabled", false);
1050 } 1080 }
1051 else if (acceptableAdsPrivacyUrl in subscriptionsMap) 1081 else if (acceptableAdsPrivacyUrl in subscriptionsMap)
1052 { 1082 {
1053 option = "privacy"; 1083 acceptableAds.setAttribute("aria-checked", true);
1054 1084 acceptableAdsPrivacy.setAttribute("aria-checked", true);
1055 if (!navigator.doNotTrack) 1085 acceptableAdsPrivacy.setAttribute("aria-disabled", false);
1056 document.forms["acceptable-ads"].classList.add("show-dnt-notification"); 1086
1057 } 1087 if (navigator.doNotTrack != 1)
1058 document.forms["acceptable-ads"]["acceptable-ads"].value = option; 1088 acceptableAdsForm.classList.add("show-dnt-notification");
1089 }
1090 else
1091 {
1092 // Using aria-disabled in order to keep the focus
1093 acceptableAdsPrivacy.setAttribute("aria-disabled", true);
1094 acceptableAdsPrivacy.setAttribute("tabindex", -1);
1095 }
1059 } 1096 }
1060 1097
1061 function isAcceptableAds(url) 1098 function isAcceptableAds(url)
1062 { 1099 {
1063 return url == acceptableAdsUrl || url == acceptableAdsPrivacyUrl; 1100 return url == acceptableAdsUrl || url == acceptableAdsPrivacyUrl;
1064 } 1101 }
1065 1102
1066 function populateLists() 1103 function populateLists()
1067 { 1104 {
1068 subscriptionsMap = Object.create(null); 1105 subscriptionsMap = Object.create(null);
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 }); 1425 });
1389 browser.runtime.sendMessage({ 1426 browser.runtime.sendMessage({
1390 type: "subscriptions.listen", 1427 type: "subscriptions.listen",
1391 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1428 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1392 "title", "downloadStatus", "downloading"] 1429 "title", "downloadStatus", "downloading"]
1393 }); 1430 });
1394 1431
1395 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1432 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1396 window.addEventListener("hashchange", onHashChange, false); 1433 window.addEventListener("hashchange", onHashChange, false);
1397 } 1434 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld