| 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 10 matching lines...) Expand all Loading... |
| 21 "use strict"; | 21 "use strict"; |
| 22 | 22 |
| 23 { | 23 { |
| 24 let subscriptionsMap = Object.create(null); | 24 let subscriptionsMap = Object.create(null); |
| 25 let filtersMap = Object.create(null); | 25 let filtersMap = Object.create(null); |
| 26 let collections = Object.create(null); | 26 let collections = Object.create(null); |
| 27 let acceptableAdsUrl = null; | 27 let acceptableAdsUrl = null; |
| 28 let acceptableAdsPrivacyUrl = null; | 28 let acceptableAdsPrivacyUrl = null; |
| 29 let isCustomFiltersLoaded = false; | 29 let isCustomFiltersLoaded = false; |
| 30 let {getMessage} = browser.i18n; | 30 let {getMessage} = browser.i18n; |
| 31 let {setElementText} = ext.i18n; |
| 31 let customFilters = []; | 32 let customFilters = []; |
| 32 let filterErrors = new Map([ | 33 let filterErrors = new Map([ |
| 33 ["synchronize_invalid_url", | 34 ["synchronize_invalid_url", |
| 34 "options_filterList_lastDownload_invalidURL"], | 35 "options_filterList_lastDownload_invalidURL"], |
| 35 ["synchronize_connection_error", | 36 ["synchronize_connection_error", |
| 36 "options_filterList_lastDownload_connectionError"], | 37 "options_filterList_lastDownload_connectionError"], |
| 37 ["synchronize_invalid_data", | 38 ["synchronize_invalid_data", |
| 38 "options_filterList_lastDownload_invalidData"], | 39 "options_filterList_lastDownload_invalidData"], |
| 39 ["synchronize_checksum_mismatch", | 40 ["synchronize_checksum_mismatch", |
| 40 "options_filterList_lastDownload_checksumMismatch"] | 41 "options_filterList_lastDownload_checksumMismatch"] |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 break; | 601 break; |
| 601 case "edit-custom-filters": | 602 case "edit-custom-filters": |
| 602 setCustomFiltersView("write"); | 603 setCustomFiltersView("write"); |
| 603 break; | 604 break; |
| 604 case "hide-more-filters-section": | 605 case "hide-more-filters-section": |
| 605 E("more-filters").setAttribute("aria-hidden", true); | 606 E("more-filters").setAttribute("aria-hidden", true); |
| 606 break; | 607 break; |
| 607 case "hide-notification": | 608 case "hide-notification": |
| 608 hideNotification(); | 609 hideNotification(); |
| 609 break; | 610 break; |
| 610 case "hide-tracking-notification": | |
| 611 E("acceptable-ads").classList.remove("show-notification"); | |
| 612 break; | |
| 613 case "import-subscription": { | 611 case "import-subscription": { |
| 614 let url = E("blockingList-textbox").value; | 612 let url = E("blockingList-textbox").value; |
| 615 addEnableSubscription(url); | 613 addEnableSubscription(url); |
| 616 closeDialog(); | 614 closeDialog(); |
| 617 break; | 615 break; |
| 618 } | 616 } |
| 619 case "open-context-menu": { | 617 case "open-context-menu": { |
| 620 let listItem = findParentData(element, "access", true); | 618 let listItem = findParentData(element, "access", true); |
| 621 if (listItem && !listItem.classList.contains("show-context-menu")) | 619 if (listItem && !listItem.classList.contains("show-context-menu")) |
| 622 listItem.classList.add("show-context-menu"); | 620 listItem.classList.add("show-context-menu"); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 | 901 |
| 904 // General tab | 902 // General tab |
| 905 getDocLink("contribute", (link) => | 903 getDocLink("contribute", (link) => |
| 906 { | 904 { |
| 907 E("contribute").href = link; | 905 E("contribute").href = link; |
| 908 }); | 906 }); |
| 909 getDocLink("acceptable_ads_criteria", (link) => | 907 getDocLink("acceptable_ads_criteria", (link) => |
| 910 { | 908 { |
| 911 setLinks("enable-acceptable-ads-description", link); | 909 setLinks("enable-acceptable-ads-description", link); |
| 912 }); | 910 }); |
| 911 setElementText(E("tracking-warning-1"), "options_tracking_warning_1", |
| 912 [getMessage("common_feature_privacy_title"), |
| 913 getMessage("options_acceptableAds_ads_label")]); |
| 914 setElementText(E("tracking-warning-3"), "options_tracking_warning_3", |
| 915 [getMessage("options_acceptableAds_privacy_label")]); |
| 916 |
| 913 getDocLink("privacy_friendly_ads", (link) => | 917 getDocLink("privacy_friendly_ads", (link) => |
| 914 { | 918 { |
| 915 E("enable-acceptable-ads-privacy-description").href = link; | 919 E("enable-acceptable-ads-privacy-description").href = link; |
| 916 }); | 920 }); |
| 917 getDocLink("adblock_plus_{browser}_dnt", url => | 921 getDocLink("adblock_plus_{browser}_dnt", url => |
| 918 { | 922 { |
| 919 setLinks("dnt", url); | 923 setLinks("dnt", url); |
| 920 }); | 924 }); |
| 921 | 925 |
| 922 // Whitelisted tab | 926 // Whitelisted tab |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 | 1290 |
| 1287 if (isAcceptableAds(url)) | 1291 if (isAcceptableAds(url)) |
| 1288 setAcceptableAds(); | 1292 setAcceptableAds(); |
| 1289 | 1293 |
| 1290 if ((url == acceptableAdsUrl || recommended == "privacy") && | 1294 if ((url == acceptableAdsUrl || recommended == "privacy") && |
| 1291 hasPrivacyConflict()) | 1295 hasPrivacyConflict()) |
| 1292 { | 1296 { |
| 1293 getPref("ui_warn_tracking", (showTrackingWarning) => | 1297 getPref("ui_warn_tracking", (showTrackingWarning) => |
| 1294 { | 1298 { |
| 1295 if (showTrackingWarning) | 1299 if (showTrackingWarning) |
| 1296 E("acceptable-ads").classList.add("show-notification"); | 1300 E("acceptable-ads").classList.add("show-warning"); |
| 1297 }); | 1301 }); |
| 1298 } | 1302 } |
| 1299 | 1303 |
| 1300 collections.filterLists.addItem(subscription); | 1304 collections.filterLists.addItem(subscription); |
| 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); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 function onPrefMessage(key, value, initial) | 1367 function onPrefMessage(key, value, initial) |
| 1364 { | 1368 { |
| 1365 switch (key) | 1369 switch (key) |
| 1366 { | 1370 { |
| 1367 case "notifications_ignoredcategories": | 1371 case "notifications_ignoredcategories": |
| 1368 value = value.indexOf("*") == -1; | 1372 value = value.indexOf("*") == -1; |
| 1369 break; | 1373 break; |
| 1370 | 1374 |
| 1371 case "notifications_showui": | 1375 case "notifications_showui": |
| 1372 hidePref("notifications_ignoredcategories", !value); | 1376 hidePref("notifications_ignoredcategories", !value); |
| 1377 break; |
| 1378 case "ui_warn_tracking": |
| 1379 let showWarning = (value && hasPrivacyConflict()); |
| 1380 E("acceptable-ads").classList.toggle("show-warning", showWarning); |
| 1373 break; | 1381 break; |
| 1374 } | 1382 } |
| 1375 | 1383 |
| 1376 let checkbox = document.querySelector( | 1384 let checkbox = document.querySelector( |
| 1377 "[data-pref='" + key + "'] button[role='checkbox']" | 1385 "[data-pref='" + key + "'] button[role='checkbox']" |
| 1378 ); | 1386 ); |
| 1379 if (checkbox) | 1387 if (checkbox) |
| 1380 checkbox.setAttribute("aria-checked", value); | 1388 checkbox.setAttribute("aria-checked", value); |
| 1381 } | 1389 } |
| 1382 | 1390 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1450 }); | 1458 }); |
| 1451 browser.runtime.sendMessage({ | 1459 browser.runtime.sendMessage({ |
| 1452 type: "subscriptions.listen", | 1460 type: "subscriptions.listen", |
| 1453 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1461 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
| 1454 "title", "downloadStatus", "downloading"] | 1462 "title", "downloadStatus", "downloading"] |
| 1455 }); | 1463 }); |
| 1456 | 1464 |
| 1457 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1465 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 1458 window.addEventListener("hashchange", onHashChange, false); | 1466 window.addEventListener("hashchange", onHashChange, false); |
| 1459 } | 1467 } |
| LEFT | RIGHT |