| 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 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1043 document.forms["acceptable-ads"].classList.add("show-dnt-notification"); | 1043 document.forms["acceptable-ads"].classList.add("show-dnt-notification"); |
| 1044 } | 1044 } |
| 1045 document.forms["acceptable-ads"]["acceptable-ads"].value = option; | 1045 document.forms["acceptable-ads"]["acceptable-ads"].value = option; |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 function isAcceptableAds(url) | 1048 function isAcceptableAds(url) |
| 1049 { | 1049 { |
| 1050 return url == acceptableAdsUrl || url == acceptableAdsPrivacyUrl; | 1050 return url == acceptableAdsUrl || url == acceptableAdsPrivacyUrl; |
| 1051 } | 1051 } |
| 1052 | 1052 |
| 1053 function hasPrivacyConflict() | |
| 1054 { | |
| 1055 let acceptableAdsList = subscriptionsMap[acceptableAdsUrl]; | |
| 1056 let privacyList = null; | |
| 1057 for (let url in subscriptionsMap) | |
| 1058 { | |
| 1059 let subscription = subscriptionsMap[url]; | |
| 1060 if (subscription.recommended == "privacy") | |
| 1061 { | |
| 1062 privacyList = subscription; | |
| 1063 break; | |
| 1064 } | |
| 1065 } | |
| 1066 return acceptableAdsList && acceptableAdsList.disabled == false && | |
| 1067 privacyList && privacyList.disabled == false; | |
| 1068 } | |
| 1069 | |
| 1070 function populateLists() | 1053 function populateLists() |
| 1071 { | 1054 { |
| 1072 subscriptionsMap = Object.create(null); | 1055 subscriptionsMap = Object.create(null); |
| 1073 filtersMap = Object.create(null); | 1056 filtersMap = Object.create(null); |
| 1074 | 1057 |
| 1075 // Empty collections and lists | 1058 // Empty collections and lists |
| 1076 for (let property in collections) | 1059 for (let property in collections) |
| 1077 collections[property].clearAll(); | 1060 collections[property].clearAll(); |
| 1078 | 1061 |
| 1079 setCustomFiltersView("empty"); | 1062 setCustomFiltersView("empty"); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 return; | 1216 return; |
| 1234 } | 1217 } |
| 1235 else if (url in subscriptionsMap) | 1218 else if (url in subscriptionsMap) |
| 1236 updateSubscription(subscription); | 1219 updateSubscription(subscription); |
| 1237 else | 1220 else |
| 1238 addSubscription(subscription); | 1221 addSubscription(subscription); |
| 1239 | 1222 |
| 1240 if (isAcceptableAds(url)) | 1223 if (isAcceptableAds(url)) |
| 1241 setAcceptableAds(); | 1224 setAcceptableAds(); |
| 1242 | 1225 |
| 1243 if ((url == acceptableAdsUrl || recommended == "privacy") && | |
| 1244 hasPrivacyConflict()) | |
| 1245 { | |
| 1246 getPref("ui_warn_tracking", (showTrackingWarning) => | |
| 1247 { | |
| 1248 if (showTrackingWarning) | |
| 1249 openDialog("tracking"); | |
| 1250 }); | |
| 1251 } | |
| 1252 | |
| 1253 collections.filterLists.addItem(subscription); | 1226 collections.filterLists.addItem(subscription); |
| 1254 break; | 1227 break; |
| 1255 case "removed": | 1228 case "removed": |
| 1256 if (subscription.recommended) | 1229 if (subscription.recommended) |
| 1257 { | 1230 { |
| 1258 subscription.disabled = true; | 1231 subscription.disabled = true; |
| 1259 onSubscriptionMessage("disabled", subscription); | 1232 onSubscriptionMessage("disabled", subscription); |
| 1260 } | 1233 } |
| 1261 else | 1234 else |
| 1262 { | 1235 { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 type: "app.listen", | 1364 type: "app.listen", |
| 1392 filter: ["addSubscription", "focusSection"] | 1365 filter: ["addSubscription", "focusSection"] |
| 1393 }); | 1366 }); |
| 1394 ext.backgroundPage.sendMessage({ | 1367 ext.backgroundPage.sendMessage({ |
| 1395 type: "filters.listen", | 1368 type: "filters.listen", |
| 1396 filter: ["added", "loaded", "removed"] | 1369 filter: ["added", "loaded", "removed"] |
| 1397 }); | 1370 }); |
| 1398 ext.backgroundPage.sendMessage({ | 1371 ext.backgroundPage.sendMessage({ |
| 1399 type: "prefs.listen", | 1372 type: "prefs.listen", |
| 1400 filter: ["notifications_ignoredcategories", "notifications_showui", | 1373 filter: ["notifications_ignoredcategories", "notifications_showui", |
| 1401 "show_devtools_panel", "shouldShowBlockElementMenu", | 1374 "show_devtools_panel", "shouldShowBlockElementMenu"] |
| 1402 "ui_warn_tracking"] | |
| 1403 }); | 1375 }); |
| 1404 ext.backgroundPage.sendMessage({ | 1376 ext.backgroundPage.sendMessage({ |
| 1405 type: "subscriptions.listen", | 1377 type: "subscriptions.listen", |
| 1406 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1378 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
| 1407 "title", "downloadStatus", "downloading"] | 1379 "title", "downloadStatus", "downloading"] |
| 1408 }); | 1380 }); |
| 1409 | 1381 |
| 1410 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1382 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 1411 window.addEventListener("hashchange", onHashChange, false); | 1383 window.addEventListener("hashchange", onHashChange, false); |
| 1412 } | 1384 } |
| OLD | NEW |