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-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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 }); | 711 }); |
712 }); | 712 }); |
713 ext.backgroundPage.sendMessage( | 713 ext.backgroundPage.sendMessage( |
714 { | 714 { |
715 type: "app.get", | 715 type: "app.get", |
716 what: "features" | 716 what: "features" |
717 }, | 717 }, |
718 function(features) | 718 function(features) |
719 { | 719 { |
720 hidePref("show_devtools_panel", !features.devToolsPanel); | 720 hidePref("show_devtools_panel", !features.devToolsPanel); |
721 hidePref("safari_contentblocker", !features.safariContentBlocker); | 721 |
722 // Only show option to switch between Safari Content Blockers | |
723 // and event based blocking if both are available. | |
724 hidePref("safari_contentblocker", !( | |
725 features.safariContentBlocker && | |
726 "canLoad" in safari.self.tab && | |
727 "onbeforeload" in Element.prototype | |
728 )); | |
722 }); | 729 }); |
723 | 730 |
724 var filterTextbox = document.querySelector("#custom-filters-add input"); | 731 var filterTextbox = document.querySelector("#custom-filters-add input"); |
725 placeholderValue = getMessage("options_customFilters_textbox_placeholder"); | 732 placeholderValue = getMessage("options_customFilters_textbox_placeholder"); |
726 filterTextbox.setAttribute("placeholder", placeholderValue); | 733 filterTextbox.setAttribute("placeholder", placeholderValue); |
727 function addCustomFilters() | 734 function addCustomFilters() |
728 { | 735 { |
729 var filterText = filterTextbox.value; | 736 var filterText = filterTextbox.value; |
730 sendMessageHandleErrors( | 737 sendMessageHandleErrors( |
731 { | 738 { |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1073 | 1080 |
1074 for (var i = 0; i < shareResources.length; i++) | 1081 for (var i = 0; i < shareResources.length; i++) |
1075 checkShareResource(shareResources[i], onResult); | 1082 checkShareResource(shareResources[i], onResult); |
1076 } | 1083 } |
1077 | 1084 |
1078 ext.onMessage.addListener(function(message) | 1085 ext.onMessage.addListener(function(message) |
1079 { | 1086 { |
1080 switch (message.type) | 1087 switch (message.type) |
1081 { | 1088 { |
1082 case "app.respond": | 1089 case "app.respond": |
1083 if (message.action == "addSubscription") | 1090 switch (message.action) |
1084 { | 1091 { |
1085 var subscription = message.args[0]; | 1092 case "addSubscription": |
1086 var dialog = E("dialog-content-predefined"); | 1093 var subscription = message.args[0]; |
1087 dialog.querySelector("h3").textContent = subscription.title || ""; | 1094 var dialog = E("dialog-content-predefined"); |
1088 dialog.querySelector(".url").textContent = subscription.url; | 1095 dialog.querySelector("h3").textContent = subscription.title || ""; |
1089 openDialog("predefined"); | 1096 dialog.querySelector(".url").textContent = subscription.url; |
1097 openDialog("predefined"); | |
1098 break; | |
1099 case "safariRestartRequired": | |
1100 E("restart-safari").setAttribute("aria-hidden", !message.args[0]); | |
Thomas Greiner
2016/03/31 14:24:57
Why do we even need the background page for that?
Sebastian Noack
2016/03/31 14:45:37
We should only indicate that restarting Safari is
Sebastian Noack
2016/03/31 15:14:31
Frankly, I don't have a strong opinion here. Patch
Thomas Greiner
2016/03/31 16:29:17
I do agree that we should somehow indicate to the
Sebastian Noack
2016/03/31 17:09:24
FWIW, I just begun to prefer the new patch set wit
Thomas Greiner
2016/03/31 17:17:06
You're right.
| |
1101 break; | |
1090 } | 1102 } |
1091 break; | 1103 break; |
1092 case "filters.respond": | 1104 case "filters.respond": |
1093 onFilterMessage(message.action, message.args[0]); | 1105 onFilterMessage(message.action, message.args[0]); |
1094 break; | 1106 break; |
1095 case "prefs.respond": | 1107 case "prefs.respond": |
1096 onPrefMessage(message.action, message.args[0]); | 1108 onPrefMessage(message.action, message.args[0]); |
1097 break; | 1109 break; |
1098 case "subscriptions.respond": | 1110 case "subscriptions.respond": |
1099 onSubscriptionMessage(message.action, message.args[0]); | 1111 onSubscriptionMessage(message.action, message.args[0]); |
1100 break; | 1112 break; |
1101 } | 1113 } |
1102 }); | 1114 }); |
1103 | 1115 |
1104 ext.backgroundPage.sendMessage( | 1116 ext.backgroundPage.sendMessage( |
1105 { | 1117 { |
1106 type: "app.listen", | 1118 type: "app.listen", |
1107 filter: ["addSubscription"] | 1119 filter: ["addSubscription", "safariRestartRequired"] |
1108 }); | 1120 }); |
1109 ext.backgroundPage.sendMessage( | 1121 ext.backgroundPage.sendMessage( |
1110 { | 1122 { |
1111 type: "filters.listen", | 1123 type: "filters.listen", |
1112 filter: ["added", "loaded", "removed"] | 1124 filter: ["added", "loaded", "removed"] |
1113 }); | 1125 }); |
1114 ext.backgroundPage.sendMessage( | 1126 ext.backgroundPage.sendMessage( |
1115 { | 1127 { |
1116 type: "prefs.listen", | 1128 type: "prefs.listen", |
1117 filter: ["notifications_ignoredcategories", "notifications_showui", | 1129 filter: ["notifications_ignoredcategories", "notifications_showui", |
1118 "safari_contentblocker", "show_devtools_panel", | 1130 "safari_contentblocker", "show_devtools_panel", |
1119 "shouldShowBlockElementMenu"] | 1131 "shouldShowBlockElementMenu"] |
1120 }); | 1132 }); |
1121 ext.backgroundPage.sendMessage( | 1133 ext.backgroundPage.sendMessage( |
1122 { | 1134 { |
1123 type: "subscriptions.listen", | 1135 type: "subscriptions.listen", |
1124 filter: ["added", "disabled", "homepage", "lastDownload", "removed", | 1136 filter: ["added", "disabled", "homepage", "lastDownload", "removed", |
1125 "title"] | 1137 "title"] |
1126 }); | 1138 }); |
1127 | 1139 |
1128 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); | 1140 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); |
1129 })(); | 1141 })(); |
OLD | NEW |