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

Delta Between Two Patch Sets: new-options.js

Issue 29555782: Issue 5701 - Inconsistent forum links and DNT link (Closed)
Left Patch Set: Created Sept. 25, 2017, 3:30 p.m.
Right Patch Set: Created Sept. 25, 2017, 9:26 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 | « new-options.html ('k') | no next file » | 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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 }, false); 858 }, false);
859 859
860 getDocLink("contribute", (link) => 860 getDocLink("contribute", (link) =>
861 { 861 {
862 E("contribute").href = link; 862 E("contribute").href = link;
863 }); 863 });
864 getDocLink("acceptable_ads_criteria", (link) => 864 getDocLink("acceptable_ads_criteria", (link) =>
865 { 865 {
866 setLinks("enable-aa-description", link); 866 setLinks("enable-aa-description", link);
867 }); 867 });
868 868 getDocLink("adblock_plus_{browser}_dnt", url =>
869 // Get platform specific links 869 {
870 Promise.all([getPromisedInfo("platform"), getPromisedInfo("application")]) 870 setLinks("dnt", url);
Sebastian Noack 2017/09/25 16:12:48 Perhaps it would be simpler to move this logic int
saroyanm 2017/09/25 16:34:23 I agree that sending two messages is not a good id
871 .then(([platform, application]) => 871 });
872 {
saroyanm 2017/09/25 15:59:50 I wonder if we need to check for the "gecko" and a
Sebastian Noack 2017/09/25 16:05:55 That is an excellent idea. Though in practice it w
saroyanm 2017/09/25 16:34:23 Done.
873 if (platform == "chromium" && application != "opera")
874 application = "chrome";
875
876 getDocLink(application + "_support", url =>
877 {
878 setLinks("visit-forum", url);
879 });
880
881 getDocLink("adblock_plus_" + application + "_dnt", url =>
882 {
883 setLinks("dnt", url);
884 });
885 });
886 872
887 // Advanced tab 873 // Advanced tab
888 let customize = document.querySelectorAll("#customize li[data-pref]"); 874 let customize = document.querySelectorAll("#customize li[data-pref]");
889 customize = Array.prototype.map.call(customize, (checkbox) => 875 customize = Array.prototype.map.call(customize, (checkbox) =>
890 { 876 {
891 return checkbox.getAttribute("data-pref"); 877 return checkbox.getAttribute("data-pref");
892 }); 878 });
893 for (let key of customize) 879 for (let key of customize)
894 { 880 {
895 getPref(key, (value) => 881 getPref(key, (value) =>
(...skipping 28 matching lines...) Expand all
924 { 910 {
925 setLinks("report-issue", link); 911 setLinks("report-issue", link);
926 }); 912 });
927 getDocLink("adblock_plus_report_ad", (link) => 913 getDocLink("adblock_plus_report_ad", (link) =>
928 { 914 {
929 setLinks("report-ad", link); 915 setLinks("report-ad", link);
930 }); 916 });
931 getDocLink("adblock_plus_report_bug", (link) => 917 getDocLink("adblock_plus_report_bug", (link) =>
932 { 918 {
933 setLinks("report-bug", link); 919 setLinks("report-bug", link);
920 });
921 getDocLink("{browser}_support", url =>
922 {
923 setLinks("visit-forum", url);
934 }); 924 });
935 getDocLink("social_twitter", (link) => 925 getDocLink("social_twitter", (link) =>
936 { 926 {
937 E("twitter").setAttribute("href", link); 927 E("twitter").setAttribute("href", link);
938 }); 928 });
939 getDocLink("social_facebook", (link) => 929 getDocLink("social_facebook", (link) =>
940 { 930 {
941 E("facebook").setAttribute("href", link); 931 E("facebook").setAttribute("href", link);
942 }); 932 });
943 getDocLink("social_gplus", (link) => 933 getDocLink("social_gplus", (link) =>
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 { 1037 {
1048 let subscription = subscriptionsMap[url]; 1038 let subscription = subscriptionsMap[url];
1049 if (subscription.recommended == "privacy") 1039 if (subscription.recommended == "privacy")
1050 { 1040 {
1051 privacyList = subscription; 1041 privacyList = subscription;
1052 break; 1042 break;
1053 } 1043 }
1054 } 1044 }
1055 return acceptableAdsList && acceptableAdsList.disabled == false && 1045 return acceptableAdsList && acceptableAdsList.disabled == false &&
1056 privacyList && privacyList.disabled == false; 1046 privacyList && privacyList.disabled == false;
1057 }
1058
1059 function getPromisedInfo(info)
1060 {
1061 return new Promise((resolve, reject) =>
1062 {
1063 ext.backgroundPage.sendMessage({
1064 type: "app.get",
1065 what: info
1066 }, resolve);
1067 });
1068 } 1047 }
1069 1048
1070 function populateLists() 1049 function populateLists()
1071 { 1050 {
1072 subscriptionsMap = Object.create(null); 1051 subscriptionsMap = Object.create(null);
1073 filtersMap = Object.create(null); 1052 filtersMap = Object.create(null);
1074 1053
1075 // Empty collections and lists 1054 // Empty collections and lists
1076 for (let property in collections) 1055 for (let property in collections)
1077 collections[property].clearAll(); 1056 collections[property].clearAll();
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 }); 1381 });
1403 ext.backgroundPage.sendMessage({ 1382 ext.backgroundPage.sendMessage({
1404 type: "subscriptions.listen", 1383 type: "subscriptions.listen",
1405 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1384 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1406 "title", "downloadStatus", "downloading"] 1385 "title", "downloadStatus", "downloading"]
1407 }); 1386 });
1408 1387
1409 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1388 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1410 window.addEventListener("hashchange", onHashChange, false); 1389 window.addEventListener("hashchange", onHashChange, false);
1411 } 1390 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld