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 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 } | 139 } |
140 } | 140 } |
141 }; | 141 }; |
142 | 142 |
143 modules.filterClasses = { | 143 modules.filterClasses = { |
144 BlockingFilter: function() {}, | 144 BlockingFilter: function() {}, |
145 Filter: function(text) | 145 Filter: function(text) |
146 { | 146 { |
147 this.text = text; | 147 this.text = text; |
148 this.disabled = false; | 148 this.disabled = false; |
| 149 }, |
| 150 WhitelistFilter: function(text) |
| 151 { |
| 152 modules.filterClasses.Filter.call(this, text); |
149 } | 153 } |
150 }; | 154 }; |
151 modules.filterClasses.Filter.fromText = function(text) | 155 modules.filterClasses.Filter.fromText = function(text) |
152 { | 156 { |
| 157 if (text.indexOf("@@") == 0) |
| 158 return new modules.filterClasses.WhitelistFilter(text); |
153 return new modules.filterClasses.Filter(text); | 159 return new modules.filterClasses.Filter(text); |
154 }; | 160 }; |
155 | 161 |
| 162 modules.filterValidation = |
| 163 { |
| 164 FilterParsingError: function(type, details) |
| 165 { |
| 166 this.type = type; |
| 167 if (details) |
| 168 { |
| 169 if ("reason" in details) |
| 170 this.reason = details.reason; |
| 171 if ("selector" in details) |
| 172 this.selector = details.selector; |
| 173 } |
| 174 }, |
| 175 parseFilter: function(text) |
| 176 { |
| 177 if (text) |
| 178 { |
| 179 if (text[0] == "[") |
| 180 return {error: new modules.filterValidation.FilterParsingError("unexpe
cted-filter-list-header")}; |
| 181 } |
| 182 return {filter: modules.filterClasses.Filter.fromText(text)}; |
| 183 }, |
| 184 parseFilters: function(text) |
| 185 { |
| 186 var lines = text.split("\n"); |
| 187 var filters = []; |
| 188 var errors = []; |
| 189 |
| 190 for (var i = 0; i < lines.length; i++) |
| 191 { |
| 192 var parseResult = modules.filterValidation.parseFilter(lines[i]); |
| 193 if (parseResult.error) |
| 194 errors.push(parseResult.error); |
| 195 else |
| 196 filters.push(parseResult.filter); |
| 197 } |
| 198 |
| 199 return {filters: filters, errors: errors}; |
| 200 } |
| 201 }; |
| 202 |
156 modules.synchronizer = { | 203 modules.synchronizer = { |
157 Synchronizer: {} | 204 Synchronizer: {} |
158 }; | 205 }; |
159 | 206 |
160 modules.matcher = { | 207 modules.matcher = { |
161 defaultMatcher: { | 208 defaultMatcher: { |
162 matchesAny: function(url, requestType, docDomain, thirdParty) | 209 matchesAny: function(url, requestType, docDomain, thirdParty) |
163 { | 210 { |
164 var params = {blockedURLs: ""}; | 211 var params = {blockedURLs: ""}; |
165 updateFromURL(params); | 212 updateFromURL(params); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 { | 261 { |
215 return parseFloat(v1) - parseFloat(v2); | 262 return parseFloat(v1) - parseFloat(v2); |
216 } | 263 } |
217 } | 264 } |
218 }; | 265 }; |
219 | 266 |
220 var filters = [ | 267 var filters = [ |
221 "@@||alternate.de^$document", | 268 "@@||alternate.de^$document", |
222 "@@||der.postillion.com^$document", | 269 "@@||der.postillion.com^$document", |
223 "@@||taz.de^$document", | 270 "@@||taz.de^$document", |
224 "@@||amazon.de^$document" | 271 "@@||amazon.de^$document", |
| 272 "||biglemon.am/bg_poster/banner.jpg", |
| 273 "winfuture.de###header_logo_link", |
| 274 "###WerbungObenRechts10_GesamtDIV", |
| 275 "###WerbungObenRechts8_GesamtDIV", |
| 276 "###WerbungObenRechts9_GesamtDIV", |
| 277 "###WerbungUntenLinks4_GesamtDIV", |
| 278 "###WerbungUntenLinks7_GesamtDIV", |
| 279 "###WerbungUntenLinks8_GesamtDIV", |
| 280 "###WerbungUntenLinks9_GesamtDIV", |
| 281 "###Werbung_Sky", |
| 282 "###Werbung_Wide", |
| 283 "###__ligatus_placeholder__", |
| 284 "###ad-bereich1-08", |
| 285 "###ad-bereich1-superbanner", |
| 286 "###ad-bereich2-08", |
| 287 "###ad-bereich2-skyscrapper" |
225 ]; | 288 ]; |
226 var knownFilters = filters.map(modules.filterClasses.Filter.fromText); | 289 var knownFilters = filters.map(modules.filterClasses.Filter.fromText); |
227 | 290 |
228 var subscriptions = [ | 291 var subscriptions = [ |
229 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt", | 292 "https://easylist-downloads.adblockplus.org/easylistgermany+easylist.txt", |
230 "https://easylist-downloads.adblockplus.org/exceptionrules.txt", | 293 "https://easylist-downloads.adblockplus.org/exceptionrules.txt", |
231 "https://easylist-downloads.adblockplus.org/fanboy-social.txt", | 294 "https://easylist-downloads.adblockplus.org/fanboy-social.txt", |
232 "~user~786254" | 295 "~user~786254" |
233 ]; | 296 ]; |
234 var knownSubscriptions = Object.create(null); | 297 var knownSubscriptions = Object.create(null); |
(...skipping 18 matching lines...) Expand all Loading... |
253 type: "message", | 316 type: "message", |
254 payload: { | 317 payload: { |
255 title: "Custom subscription", | 318 title: "Custom subscription", |
256 url: "http://example.com/custom.txt", | 319 url: "http://example.com/custom.txt", |
257 type: "add-subscription" | 320 type: "add-subscription" |
258 } | 321 } |
259 }, "*"); | 322 }, "*"); |
260 }, 1000); | 323 }, 1000); |
261 } | 324 } |
262 })(this); | 325 })(this); |
OLD | NEW |