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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 "use strict"; | 18 "use strict"; |
19 | 19 |
| 20 var majorApplicationVersion = parseInt(navigator.userAgent.match(/Version\/([\d]
+)/)[1]); |
| 21 |
20 /** | 22 /** |
21 * Creates a wrapping function used to conveniently send a type of message. | 23 * Creates a wrapping function used to conveniently send a type of message. |
22 * | 24 * |
23 * @param {Object} baseMessage The part of the message that's always sent | 25 * @param {Object} baseMessage The part of the message that's always sent |
24 * @param {..string} paramKeys Any message keys that have dynamic values. The | 26 * @param {..string} paramKeys Any message keys that have dynamic values. The |
25 * returned function will take the corresponding | 27 * returned function will take the corresponding |
26 * values as arguments. | 28 * values as arguments. |
27 * @return The generated messaging function, optionally taking any values as | 29 * @return The generated messaging function, optionally taking any values as |
28 * specified by the paramKeys and finally an optional callback. | 30 * specified by the paramKeys and finally an optional callback. |
29 * (Although the value arguments are optional their index must be | 31 * (Although the value arguments are optional their index must be |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 153 |
152 getInfo("features", function(features) | 154 getInfo("features", function(features) |
153 { | 155 { |
154 if (!features.devToolsPanel) | 156 if (!features.devToolsPanel) |
155 document.getElementById("showDevtoolsPanelContainer").hidden = true; | 157 document.getElementById("showDevtoolsPanelContainer").hidden = true; |
156 | 158 |
157 // Only show the option for Safari content blocking API if the user is | 159 // Only show the option for Safari content blocking API if the user is |
158 // running Safari and both the legacy and content blocking APIs are | 160 // running Safari and both the legacy and content blocking APIs are |
159 // available. | 161 // available. |
160 document.getElementById("safariContentBlockerContainer").hidden = !( | 162 document.getElementById("safariContentBlockerContainer").hidden = !( |
161 features.safariContentBlocker && | 163 majorApplicationVersion >= 12 || ( |
162 typeof safari != "undefined" && | 164 features.safariContentBlocker && |
163 "canLoad" in safari.self.tab && | 165 typeof safari != "undefined" && |
164 "onbeforeload" in Element.prototype | 166 "canLoad" in safari.self.tab && |
| 167 "onbeforeload" in Element.prototype |
| 168 ) |
165 ); | 169 ); |
| 170 document.getElementById("safariContentBlocker").disabled = majorApplicationV
ersion >= 12; |
166 }); | 171 }); |
167 getPref("notifications_showui", function(notifications_showui) | 172 getPref("notifications_showui", function(notifications_showui) |
168 { | 173 { |
169 if (!notifications_showui) | 174 if (!notifications_showui) |
170 document.getElementById("shouldShowNotificationsContainer").hidden = true; | 175 document.getElementById("shouldShowNotificationsContainer").hidden = true; |
171 }); | 176 }); |
172 | 177 |
173 // Register listeners in the background message responder | 178 // Register listeners in the background message responder |
174 ext.backgroundPage.sendMessage({ | 179 ext.backgroundPage.sendMessage({ |
175 type: "app.listen", | 180 type: "app.listen", |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 onFilterMessage(message.action, message.args[0]); | 772 onFilterMessage(message.action, message.args[0]); |
768 break; | 773 break; |
769 case "prefs.respond": | 774 case "prefs.respond": |
770 onPrefMessage(message.action, message.args[0]); | 775 onPrefMessage(message.action, message.args[0]); |
771 break; | 776 break; |
772 case "subscriptions.respond": | 777 case "subscriptions.respond": |
773 onSubscriptionMessage(message.action, message.args[0]); | 778 onSubscriptionMessage(message.action, message.args[0]); |
774 break; | 779 break; |
775 } | 780 } |
776 }); | 781 }); |
OLD | NEW |