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-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 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 var API = (function() | 18 var API = (function() |
19 { | 19 { |
20 var Filter = require("filterClasses").Filter; | 20 var Filter = require("filterClasses").Filter; |
21 var Subscription = require("subscriptionClasses").Subscription; | 21 var Subscription = require("subscriptionClasses").Subscription; |
22 var SpecialSubscription = require("subscriptionClasses").SpecialSubscription; | 22 var SpecialSubscription = require("subscriptionClasses").SpecialSubscription; |
23 var FilterStorage = require("filterStorage").FilterStorage; | 23 var FilterStorage = require("filterStorage").FilterStorage; |
24 var defaultMatcher = require("matcher").defaultMatcher; | 24 var defaultMatcher = require("matcher").defaultMatcher; |
25 var ElemHide = require("elemHide").ElemHide; | 25 var ElemHide = require("elemHide").ElemHide; |
26 var Synchronizer = require("synchronizer").Synchronizer; | 26 var Synchronizer = require("synchronizer").Synchronizer; |
27 var Prefs = require("prefs").Prefs; | 27 var Prefs = require("prefs").Prefs; |
28 var checkForUpdates = require("updater").checkForUpdates; | 28 var checkForUpdates = require("updater").checkForUpdates; |
| 29 var Notification = require("notification").Notification; |
29 | 30 |
30 return { | 31 return { |
31 getFilterFromText: function(text) | 32 getFilterFromText: function(text) |
32 { | 33 { |
33 text = Filter.normalize(text); | 34 text = Filter.normalize(text); |
34 if (!text) | 35 if (!text) |
35 throw "Attempted to create a filter from empty text"; | 36 throw "Attempted to create a filter from empty text"; |
36 return Filter.fromText(text); | 37 return Filter.fromText(text); |
37 }, | 38 }, |
38 | 39 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 130 |
130 // These aren't normally properties of a Subscription object | 131 // These aren't normally properties of a Subscription object |
131 subscription.author = subscriptions[i].author; | 132 subscription.author = subscriptions[i].author; |
132 subscription.prefixes = subscriptions[i].prefixes; | 133 subscription.prefixes = subscriptions[i].prefixes; |
133 subscription.specialization = subscriptions[i].specialization; | 134 subscription.specialization = subscriptions[i].specialization; |
134 result.push(subscription); | 135 result.push(subscription); |
135 } | 136 } |
136 return result; | 137 return result; |
137 }, | 138 }, |
138 | 139 |
| 140 getNextNotificationToShow: function(url) |
| 141 { |
| 142 return Notification.getNextToShow(url); |
| 143 }, |
| 144 |
| 145 getNotificationTexts: function(notification, locale) |
| 146 { |
| 147 return Notification.getLocalizedTexts(notification, locale); |
| 148 }, |
| 149 |
| 150 addNotification: function(notification) |
| 151 { |
| 152 return Notification.addNotification(notification); |
| 153 }, |
| 154 |
| 155 removeNotification: function(notification) |
| 156 { |
| 157 return Notification.removeNotification(notification); |
| 158 }, |
| 159 |
| 160 markNotificationAsShown: function(id) |
| 161 { |
| 162 Notification.markAsShown(id); |
| 163 }, |
139 checkFilterMatch: function(url, contentType, documentUrl) | 164 checkFilterMatch: function(url, contentType, documentUrl) |
140 { | 165 { |
141 var requestHost = extractHostFromURL(url); | 166 var requestHost = extractHostFromURL(url); |
142 var documentHost = extractHostFromURL(documentUrl); | 167 var documentHost = extractHostFromURL(documentUrl); |
143 var thirdParty = isThirdParty(requestHost, documentHost); | 168 var thirdParty = isThirdParty(requestHost, documentHost); |
144 return defaultMatcher.matchesAny(url, contentType, documentHost, thirdPart
y); | 169 return defaultMatcher.matchesAny(url, contentType, documentHost, thirdPart
y); |
145 }, | 170 }, |
146 | 171 |
147 getElementHidingSelectors: function(domain) | 172 getElementHidingSelectors: function(domain) |
148 { | 173 { |
(...skipping 19 matching lines...) Expand all Loading... |
168 { | 193 { |
169 return extractHostFromURL(url); | 194 return extractHostFromURL(url); |
170 }, | 195 }, |
171 | 196 |
172 compareVersions: function(v1, v2) | 197 compareVersions: function(v1, v2) |
173 { | 198 { |
174 return Services.vc.compare(v1, v2); | 199 return Services.vc.compare(v1, v2); |
175 } | 200 } |
176 }; | 201 }; |
177 })(); | 202 })(); |
OLD | NEW |