| LEFT | RIGHT |
| 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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 | 966 |
| 967 // Help tab | 967 // Help tab |
| 968 getDocLink("adblock_plus_report_bug", (link) => | 968 getDocLink("adblock_plus_report_bug", (link) => |
| 969 { | 969 { |
| 970 setLinks("report-bug", link); | 970 setLinks("report-bug", link); |
| 971 }); | 971 }); |
| 972 getDocLink("{browser}_support", url => | 972 getDocLink("{browser}_support", url => |
| 973 { | 973 { |
| 974 setLinks("visit-forum", url); | 974 setLinks("visit-forum", url); |
| 975 }); | 975 }); |
| 976 getDocLink("adblock_plus_report_issue", (link) => | |
| 977 { | |
| 978 setLinks("report-issue", "mailto:support@adblockplus.org"); | |
| 979 }); | |
| 980 getDocLink("social_twitter", (link) => | 976 getDocLink("social_twitter", (link) => |
| 981 { | 977 { |
| 982 E("twitter").setAttribute("href", link); | 978 E("twitter").setAttribute("href", link); |
| 983 }); | 979 }); |
| 984 getDocLink("social_facebook", (link) => | 980 getDocLink("social_facebook", (link) => |
| 985 { | 981 { |
| 986 E("facebook").setAttribute("href", link); | 982 E("facebook").setAttribute("href", link); |
| 987 }); | 983 }); |
| 988 getDocLink("social_gplus", (link) => | 984 getDocLink("social_gplus", (link) => |
| 989 { | 985 { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1107 if (subscription.recommended == "privacy") | 1103 if (subscription.recommended == "privacy") |
| 1108 { | 1104 { |
| 1109 privacyList = subscription; | 1105 privacyList = subscription; |
| 1110 break; | 1106 break; |
| 1111 } | 1107 } |
| 1112 } | 1108 } |
| 1113 return acceptableAdsList && acceptableAdsList.disabled == false && | 1109 return acceptableAdsList && acceptableAdsList.disabled == false && |
| 1114 privacyList && privacyList.disabled == false; | 1110 privacyList && privacyList.disabled == false; |
| 1115 } | 1111 } |
| 1116 | 1112 |
| 1113 function setPrivacyConflict() |
| 1114 { |
| 1115 let acceptableAdsForm = E("acceptable-ads"); |
| 1116 if (hasPrivacyConflict()) |
| 1117 { |
| 1118 getPref("ui_warn_tracking", (showTrackingWarning) => |
| 1119 { |
| 1120 acceptableAdsForm.classList.toggle("show-warning", showTrackingWarning); |
| 1121 }); |
| 1122 } |
| 1123 else |
| 1124 { |
| 1125 acceptableAdsForm.classList.remove("show-warning"); |
| 1126 } |
| 1127 } |
| 1128 |
| 1117 function populateLists() | 1129 function populateLists() |
| 1118 { | 1130 { |
| 1119 subscriptionsMap = Object.create(null); | 1131 subscriptionsMap = Object.create(null); |
| 1120 filtersMap = Object.create(null); | 1132 filtersMap = Object.create(null); |
| 1121 | 1133 |
| 1122 // Empty collections and lists | 1134 // Empty collections and lists |
| 1123 for (let property in collections) | 1135 for (let property in collections) |
| 1124 collections[property].clearAll(); | 1136 collections[property].clearAll(); |
| 1125 | 1137 |
| 1126 setCustomFiltersView("empty"); | 1138 setCustomFiltersView("empty"); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1256 knownSubscription.originalTitle = subscription.title; | 1268 knownSubscription.originalTitle = subscription.title; |
| 1257 else | 1269 else |
| 1258 knownSubscription[property] = subscription[property]; | 1270 knownSubscription[property] = subscription[property]; |
| 1259 } | 1271 } |
| 1260 subscription = knownSubscription; | 1272 subscription = knownSubscription; |
| 1261 } | 1273 } |
| 1262 switch (action) | 1274 switch (action) |
| 1263 { | 1275 { |
| 1264 case "disabled": | 1276 case "disabled": |
| 1265 updateSubscription(subscription); | 1277 updateSubscription(subscription); |
| 1278 setPrivacyConflict(); |
| 1266 break; | 1279 break; |
| 1267 case "downloading": | 1280 case "downloading": |
| 1268 case "downloadStatus": | 1281 case "downloadStatus": |
| 1269 case "homepage": | 1282 case "homepage": |
| 1270 case "lastDownload": | 1283 case "lastDownload": |
| 1271 case "title": | 1284 case "title": |
| 1272 updateSubscription(subscription); | 1285 updateSubscription(subscription); |
| 1273 break; | 1286 break; |
| 1274 case "added": | 1287 case "added": |
| 1275 let {url, recommended} = subscription; | 1288 let {url, recommended} = subscription; |
| 1276 // Handle custom subscription | 1289 // Handle custom subscription |
| 1277 if (/^~user/.test(url)) | 1290 if (/^~user/.test(url)) |
| 1278 { | 1291 { |
| 1279 loadCustomFilters(subscription.filters); | 1292 loadCustomFilters(subscription.filters); |
| 1280 return; | 1293 return; |
| 1281 } | 1294 } |
| 1282 else if (url in subscriptionsMap) | 1295 else if (url in subscriptionsMap) |
| 1283 updateSubscription(subscription); | 1296 updateSubscription(subscription); |
| 1284 else | 1297 else |
| 1285 addSubscription(subscription); | 1298 addSubscription(subscription); |
| 1286 | 1299 |
| 1287 if (isAcceptableAds(url)) | 1300 if (isAcceptableAds(url)) |
| 1288 setAcceptableAds(); | 1301 setAcceptableAds(); |
| 1289 | 1302 |
| 1290 if ((url == acceptableAdsUrl || recommended == "privacy") && | |
| 1291 hasPrivacyConflict()) | |
| 1292 { | |
| 1293 getPref("ui_warn_tracking", (showTrackingWarning) => | |
| 1294 { | |
| 1295 if (showTrackingWarning) | |
| 1296 E("acceptable-ads").classList.add("show-warning"); | |
| 1297 }); | |
| 1298 } | |
| 1299 | |
| 1300 collections.filterLists.addItem(subscription); | 1303 collections.filterLists.addItem(subscription); |
| 1304 setPrivacyConflict(); |
| 1301 break; | 1305 break; |
| 1302 case "removed": | 1306 case "removed": |
| 1303 if (subscription.recommended) | 1307 if (subscription.recommended) |
| 1304 { | 1308 { |
| 1305 subscription.disabled = true; | 1309 subscription.disabled = true; |
| 1306 onSubscriptionMessage("disabled", subscription); | 1310 onSubscriptionMessage("disabled", subscription); |
| 1307 } | 1311 } |
| 1308 else | 1312 else |
| 1309 { | 1313 { |
| 1310 delete subscriptionsMap[subscription.url]; | 1314 delete subscriptionsMap[subscription.url]; |
| 1311 if (isAcceptableAds(subscription.url)) | 1315 if (isAcceptableAds(subscription.url)) |
| 1312 { | 1316 { |
| 1313 setAcceptableAds(); | 1317 setAcceptableAds(); |
| 1314 } | 1318 } |
| 1315 else | 1319 else |
| 1316 { | 1320 { |
| 1317 collections.more.removeItem(subscription); | 1321 collections.more.removeItem(subscription); |
| 1318 } | 1322 } |
| 1319 } | 1323 } |
| 1324 |
| 1320 collections.filterLists.removeItem(subscription); | 1325 collections.filterLists.removeItem(subscription); |
| 1326 setPrivacyConflict(); |
| 1321 break; | 1327 break; |
| 1322 } | 1328 } |
| 1323 } | 1329 } |
| 1324 | 1330 |
| 1325 function hidePref(key, value) | 1331 function hidePref(key, value) |
| 1326 { | 1332 { |
| 1327 let element = document.querySelector("[data-pref='" + key + "']"); | 1333 let element = document.querySelector("[data-pref='" + key + "']"); |
| 1328 if (element) | 1334 if (element) |
| 1329 element.setAttribute("aria-hidden", value); | 1335 element.setAttribute("aria-hidden", value); |
| 1330 } | 1336 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 switch (key) | 1371 switch (key) |
| 1366 { | 1372 { |
| 1367 case "notifications_ignoredcategories": | 1373 case "notifications_ignoredcategories": |
| 1368 value = value.indexOf("*") == -1; | 1374 value = value.indexOf("*") == -1; |
| 1369 break; | 1375 break; |
| 1370 | 1376 |
| 1371 case "notifications_showui": | 1377 case "notifications_showui": |
| 1372 hidePref("notifications_ignoredcategories", !value); | 1378 hidePref("notifications_ignoredcategories", !value); |
| 1373 break; | 1379 break; |
| 1374 case "ui_warn_tracking": | 1380 case "ui_warn_tracking": |
| 1375 let showWarning = (value && hasPrivacyConflict()); | 1381 setPrivacyConflict(); |
| 1376 E("acceptable-ads").classList.toggle("show-warning", showWarning); | |
| 1377 break; | 1382 break; |
| 1378 } | 1383 } |
| 1379 | 1384 |
| 1380 let checkbox = document.querySelector( | 1385 let checkbox = document.querySelector( |
| 1381 "[data-pref='" + key + "'] button[role='checkbox']" | 1386 "[data-pref='" + key + "'] button[role='checkbox']" |
| 1382 ); | 1387 ); |
| 1383 if (checkbox) | 1388 if (checkbox) |
| 1384 checkbox.setAttribute("aria-checked", value); | 1389 checkbox.setAttribute("aria-checked", value); |
| 1385 } | 1390 } |
| 1386 | 1391 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 }); | 1459 }); |
| 1455 browser.runtime.sendMessage({ | 1460 browser.runtime.sendMessage({ |
| 1456 type: "subscriptions.listen", | 1461 type: "subscriptions.listen", |
| 1457 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1462 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
| 1458 "title", "downloadStatus", "downloading"] | 1463 "title", "downloadStatus", "downloading"] |
| 1459 }); | 1464 }); |
| 1460 | 1465 |
| 1461 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1466 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 1462 window.addEventListener("hashchange", onHashChange, false); | 1467 window.addEventListener("hashchange", onHashChange, false); |
| 1463 } | 1468 } |
| LEFT | RIGHT |