| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 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 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |
| 869 // Get platform specific links | |
| 870 Promise.all([getPromisedInfo("platform"), getPromisedInfo("application")]) | |
|
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]) => | |
| 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 | |
| 869 // Advanced tab | 887 // Advanced tab |
| 870 let customize = document.querySelectorAll("#customize li[data-pref]"); | 888 let customize = document.querySelectorAll("#customize li[data-pref]"); |
| 871 customize = Array.prototype.map.call(customize, (checkbox) => | 889 customize = Array.prototype.map.call(customize, (checkbox) => |
| 872 { | 890 { |
| 873 return checkbox.getAttribute("data-pref"); | 891 return checkbox.getAttribute("data-pref"); |
| 874 }); | 892 }); |
| 875 for (let key of customize) | 893 for (let key of customize) |
| 876 { | 894 { |
| 877 getPref(key, (value) => | 895 getPref(key, (value) => |
| 878 { | 896 { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 907 setLinks("report-issue", link); | 925 setLinks("report-issue", link); |
| 908 }); | 926 }); |
| 909 getDocLink("adblock_plus_report_ad", (link) => | 927 getDocLink("adblock_plus_report_ad", (link) => |
| 910 { | 928 { |
| 911 setLinks("report-ad", link); | 929 setLinks("report-ad", link); |
| 912 }); | 930 }); |
| 913 getDocLink("adblock_plus_report_bug", (link) => | 931 getDocLink("adblock_plus_report_bug", (link) => |
| 914 { | 932 { |
| 915 setLinks("report-bug", link); | 933 setLinks("report-bug", link); |
| 916 }); | 934 }); |
| 917 getDocLink("reporter_other_link", (link) => | |
| 918 { | |
| 919 setLinks("report-forum", link); | |
| 920 }); | |
| 921 getDocLink("social_twitter", (link) => | 935 getDocLink("social_twitter", (link) => |
| 922 { | 936 { |
| 923 E("twitter").setAttribute("href", link); | 937 E("twitter").setAttribute("href", link); |
| 924 }); | 938 }); |
| 925 getDocLink("social_facebook", (link) => | 939 getDocLink("social_facebook", (link) => |
| 926 { | 940 { |
| 927 E("facebook").setAttribute("href", link); | 941 E("facebook").setAttribute("href", link); |
| 928 }); | 942 }); |
| 929 getDocLink("social_gplus", (link) => | 943 getDocLink("social_gplus", (link) => |
| 930 { | 944 { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1035 if (subscription.recommended == "privacy") | 1049 if (subscription.recommended == "privacy") |
| 1036 { | 1050 { |
| 1037 privacyList = subscription; | 1051 privacyList = subscription; |
| 1038 break; | 1052 break; |
| 1039 } | 1053 } |
| 1040 } | 1054 } |
| 1041 return acceptableAdsList && acceptableAdsList.disabled == false && | 1055 return acceptableAdsList && acceptableAdsList.disabled == false && |
| 1042 privacyList && privacyList.disabled == false; | 1056 privacyList && privacyList.disabled == false; |
| 1043 } | 1057 } |
| 1044 | 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 } | |
| 1069 | |
| 1045 function populateLists() | 1070 function populateLists() |
| 1046 { | 1071 { |
| 1047 subscriptionsMap = Object.create(null); | 1072 subscriptionsMap = Object.create(null); |
| 1048 filtersMap = Object.create(null); | 1073 filtersMap = Object.create(null); |
| 1049 | 1074 |
| 1050 // Empty collections and lists | 1075 // Empty collections and lists |
| 1051 for (let property in collections) | 1076 for (let property in collections) |
| 1052 collections[property].clearAll(); | 1077 collections[property].clearAll(); |
| 1053 | 1078 |
| 1054 ext.backgroundPage.sendMessage({ | 1079 ext.backgroundPage.sendMessage({ |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1377 }); | 1402 }); |
| 1378 ext.backgroundPage.sendMessage({ | 1403 ext.backgroundPage.sendMessage({ |
| 1379 type: "subscriptions.listen", | 1404 type: "subscriptions.listen", |
| 1380 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1405 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
| 1381 "title", "downloadStatus", "downloading"] | 1406 "title", "downloadStatus", "downloading"] |
| 1382 }); | 1407 }); |
| 1383 | 1408 |
| 1384 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1409 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 1385 window.addEventListener("hashchange", onHashChange, false); | 1410 window.addEventListener("hashchange", onHashChange, false); |
| 1386 } | 1411 } |
| OLD | NEW |