| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 { | 702 { |
| 703 return checkbox.getAttribute("data-pref"); | 703 return checkbox.getAttribute("data-pref"); |
| 704 }); | 704 }); |
| 705 tweaks.forEach(function(key) | 705 tweaks.forEach(function(key) |
| 706 { | 706 { |
| 707 getPref(key, function(value) | 707 getPref(key, function(value) |
| 708 { | 708 { |
| 709 onPrefMessage(key, value); | 709 onPrefMessage(key, value); |
| 710 }); | 710 }); |
| 711 }); | 711 }); |
| 712 ext.backgroundPage.sendMessage( |
| 713 { |
| 714 type: "app.get", |
| 715 what: "features" |
| 716 }, |
| 717 function(features) |
| 718 { |
| 719 hidePref("show_devtools_panel", !features.devToolsPanel); |
| 720 hidePref("safari_contentblocker", !features.safariContentBlocker); |
| 721 }); |
| 712 | 722 |
| 713 var filterTextbox = document.querySelector("#custom-filters-add input"); | 723 var filterTextbox = document.querySelector("#custom-filters-add input"); |
| 714 placeholderValue = getMessage("options_customFilters_textbox_placeholder"); | 724 placeholderValue = getMessage("options_customFilters_textbox_placeholder"); |
| 715 filterTextbox.setAttribute("placeholder", placeholderValue); | 725 filterTextbox.setAttribute("placeholder", placeholderValue); |
| 716 function addCustomFilters() | 726 function addCustomFilters() |
| 717 { | 727 { |
| 718 var filterText = filterTextbox.value; | 728 var filterText = filterTextbox.value; |
| 719 sendMessageHandleErrors( | 729 sendMessageHandleErrors( |
| 720 { | 730 { |
| 721 type: "filters.add", | 731 type: "filters.add", |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 getPref.checkNone = function(callback) | 1010 getPref.checkNone = function(callback) |
| 1001 { | 1011 { |
| 1002 callback(true); | 1012 callback(true); |
| 1003 }; | 1013 }; |
| 1004 | 1014 |
| 1005 getPref.checks = | 1015 getPref.checks = |
| 1006 { | 1016 { |
| 1007 notifications_ignoredcategories: function(callback) | 1017 notifications_ignoredcategories: function(callback) |
| 1008 { | 1018 { |
| 1009 getPref("notifications_showui", callback); | 1019 getPref("notifications_showui", callback); |
| 1010 }, | |
| 1011 safari_contentblocker: function(callback) | |
| 1012 { | |
| 1013 ext.backgroundPage.sendMessage( | |
| 1014 { | |
| 1015 type: "app.get", | |
| 1016 what: "features" | |
| 1017 }, | |
| 1018 function(features) | |
| 1019 { | |
| 1020 callback(features.safariContentBlocker); | |
| 1021 }); | |
| 1022 } | 1020 } |
| 1023 }; | 1021 }; |
| 1024 | 1022 |
| 1025 function onPrefMessage(key, value) | 1023 function onPrefMessage(key, value) |
| 1026 { | 1024 { |
| 1027 var checkbox = document.querySelector("[data-pref='" + key + "'] button[role
='checkbox']"); | 1025 var checkbox = document.querySelector("[data-pref='" + key + "'] button[role
='checkbox']"); |
| 1028 if (checkbox) | 1026 if (checkbox) |
| 1029 { | 1027 { |
| 1030 if (key == "notifications_ignoredcategories") | 1028 if (key == "notifications_ignoredcategories") |
| 1031 value = (value.indexOf("*") == -1); | 1029 value = (value.indexOf("*") == -1); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 }); | 1107 }); |
| 1110 ext.backgroundPage.sendMessage( | 1108 ext.backgroundPage.sendMessage( |
| 1111 { | 1109 { |
| 1112 type: "filters.listen", | 1110 type: "filters.listen", |
| 1113 filter: ["added", "loaded", "removed"] | 1111 filter: ["added", "loaded", "removed"] |
| 1114 }); | 1112 }); |
| 1115 ext.backgroundPage.sendMessage( | 1113 ext.backgroundPage.sendMessage( |
| 1116 { | 1114 { |
| 1117 type: "prefs.listen", | 1115 type: "prefs.listen", |
| 1118 filter: ["notifications_ignoredcategories", "notifications_showui", | 1116 filter: ["notifications_ignoredcategories", "notifications_showui", |
| 1119 "safari_contentblocker", "shouldShowBlockElementMenu"] | 1117 "safari_contentblocker", "show_devtools_panel", |
| 1118 "shouldShowBlockElementMenu"] |
| 1120 }); | 1119 }); |
| 1121 ext.backgroundPage.sendMessage( | 1120 ext.backgroundPage.sendMessage( |
| 1122 { | 1121 { |
| 1123 type: "subscriptions.listen", | 1122 type: "subscriptions.listen", |
| 1124 filter: ["added", "disabled", "homepage", "lastDownload", "removed", "title"
] | 1123 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
| 1124 "title"] |
| 1125 }); | 1125 }); |
| 1126 | 1126 |
| 1127 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1127 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
| 1128 })(); | 1128 })(); |
| LEFT | RIGHT |