LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 __proto__: Filter.prototype, | 232 __proto__: Filter.prototype, |
233 | 233 |
234 _disabled: false, | 234 _disabled: false, |
235 _hitCount: 0, | 235 _hitCount: 0, |
236 _lastHit: 0, | 236 _lastHit: 0, |
237 | 237 |
238 /** | 238 /** |
239 * Defines whether the filter is disabled | 239 * Defines whether the filter is disabled |
240 * @type Boolean | 240 * @type Boolean |
241 */ | 241 */ |
242 get disabled() { | 242 get disabled() |
| 243 { |
243 return this._disabled; | 244 return this._disabled; |
244 }, | 245 }, |
245 set disabled(value) | 246 set disabled(value) |
246 { | 247 { |
247 if (value != this._disabled) | 248 if (value != this._disabled) |
248 { | 249 { |
249 let oldValue = this._disabled; | 250 let oldValue = this._disabled; |
250 this._disabled = value; | 251 this._disabled = value; |
251 FilterNotifier.triggerListeners("filter.disabled", this, value, oldValue); | 252 FilterNotifier.triggerListeners("filter.disabled", this, value, oldValue); |
252 } | 253 } |
253 return this._disabled; | 254 return this._disabled; |
254 }, | 255 }, |
255 | 256 |
256 /** | 257 /** |
257 * Number of hits on the filter since the last reset | 258 * Number of hits on the filter since the last reset |
258 * @type Number | 259 * @type Number |
259 */ | 260 */ |
260 get hitCount() { | 261 get hitCount() |
| 262 { |
261 return this._hitCount; | 263 return this._hitCount; |
262 }, | 264 }, |
263 set hitCount(value) | 265 set hitCount(value) |
264 { | 266 { |
265 if (value != this._hitCount) | 267 if (value != this._hitCount) |
266 { | 268 { |
267 let oldValue = this._hitCount; | 269 let oldValue = this._hitCount; |
268 this._hitCount = value; | 270 this._hitCount = value; |
269 FilterNotifier.triggerListeners("filter.hitCount", this, value, oldValue); | 271 FilterNotifier.triggerListeners("filter.hitCount", this, value, oldValue); |
270 } | 272 } |
271 return this._hitCount; | 273 return this._hitCount; |
272 }, | 274 }, |
273 | 275 |
274 /** | 276 /** |
275 * Last time the filter had a hit (in milliseconds since the beginning of the
epoch) | 277 * Last time the filter had a hit (in milliseconds since the beginning of the
epoch) |
276 * @type Number | 278 * @type Number |
277 */ | 279 */ |
278 get lastHit() { | 280 get lastHit() |
| 281 { |
279 return this._lastHit; | 282 return this._lastHit; |
280 }, | 283 }, |
281 set lastHit(value) | 284 set lastHit(value) |
282 { | 285 { |
283 if (value != this._lastHit) | 286 if (value != this._lastHit) |
284 { | 287 { |
285 let oldValue = this._lastHit; | 288 let oldValue = this._lastHit; |
286 this._lastHit = value; | 289 this._lastHit = value; |
287 FilterNotifier.triggerListeners("filter.lastHit", this, value, oldValue); | 290 FilterNotifier.triggerListeners("filter.lastHit", this, value, oldValue); |
288 } | 291 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 this.contentType = contentType; | 466 this.contentType = contentType; |
464 if (matchCase) | 467 if (matchCase) |
465 this.matchCase = matchCase; | 468 this.matchCase = matchCase; |
466 if (thirdParty != null) | 469 if (thirdParty != null) |
467 this.thirdParty = thirdParty; | 470 this.thirdParty = thirdParty; |
468 | 471 |
469 if (regexpSource.length >= 2 && regexpSource[0] == "/" && regexpSource[regexpS
ource.length - 1] == "/") | 472 if (regexpSource.length >= 2 && regexpSource[0] == "/" && regexpSource[regexpS
ource.length - 1] == "/") |
470 { | 473 { |
471 // The filter is a regular expression - convert it immediately to catch synt
ax errors | 474 // The filter is a regular expression - convert it immediately to catch synt
ax errors |
472 let regexp = new RegExp(regexpSource.substr(1, regexpSource.length - 2), thi
s.matchCase ? "" : "i"); | 475 let regexp = new RegExp(regexpSource.substr(1, regexpSource.length - 2), thi
s.matchCase ? "" : "i"); |
473 this.__defineGetter__("regexp", function() { return regexp; }); | 476 this.__defineGetter__("regexp", () => regexp); |
474 } | 477 } |
475 else | 478 else |
476 { | 479 { |
477 // No need to convert this filter to regular expression yet, do it on demand | 480 // No need to convert this filter to regular expression yet, do it on demand |
478 this.regexpSource = regexpSource; | 481 this.regexpSource = regexpSource; |
479 } | 482 } |
480 } | 483 } |
481 exports.RegExpFilter = RegExpFilter; | 484 exports.RegExpFilter = RegExpFilter; |
482 | 485 |
483 RegExpFilter.prototype = | 486 RegExpFilter.prototype = |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 .replace(/\\\^/g, "(?:[\\x00-\\x24\\x26-\\x2C\\x2F\\x3A-\\x40\\x5B-\\x5E\\
x60\\x7B-\\x7F]|$)") | 524 .replace(/\\\^/g, "(?:[\\x00-\\x24\\x26-\\x2C\\x2F\\x3A-\\x40\\x5B-\\x5E\\
x60\\x7B-\\x7F]|$)") |
522 .replace(/^\\\|\\\|/, "^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?") // process
extended anchor at expression start | 525 .replace(/^\\\|\\\|/, "^[\\w\\-]+:\\/+(?!\\/)(?:[^\\/]+\\.)?") // process
extended anchor at expression start |
523 .replace(/^\\\|/, "^") // process anchor at expression start | 526 .replace(/^\\\|/, "^") // process anchor at expression start |
524 .replace(/\\\|$/, "$") // process anchor at expression end | 527 .replace(/\\\|$/, "$") // process anchor at expression end |
525 .replace(/^(\.\*)/, "") // remove leading wildcards | 528 .replace(/^(\.\*)/, "") // remove leading wildcards |
526 .replace(/(\.\*)$/, ""); // remove trailing wildcards | 529 .replace(/(\.\*)$/, ""); // remove trailing wildcards |
527 | 530 |
528 let regexp = new RegExp(source, this.matchCase ? "" : "i"); | 531 let regexp = new RegExp(source, this.matchCase ? "" : "i"); |
529 | 532 |
530 delete this.regexpSource; | 533 delete this.regexpSource; |
531 this.__defineGetter__("regexp", function() { return regexp; }); | 534 this.__defineGetter__("regexp", () => regexp); |
532 return this.regexp; | 535 return this.regexp; |
533 }, | 536 }, |
534 /** | 537 /** |
535 * Content types the filter applies to, combination of values from RegExpFilte
r.typeMap | 538 * Content types the filter applies to, combination of values from RegExpFilte
r.typeMap |
536 * @type Number | 539 * @type Number |
537 */ | 540 */ |
538 contentType: 0x7FFFFFFF, | 541 contentType: 0x7FFFFFFF, |
539 /** | 542 /** |
540 * Defines whether the filter should distinguish between lower and upper case
letters | 543 * Defines whether the filter should distinguish between lower and upper case
letters |
541 * @type Boolean | 544 * @type Boolean |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 function ElemHideException(text, domains, selector) | 891 function ElemHideException(text, domains, selector) |
889 { | 892 { |
890 ElemHideBase.call(this, text, domains, selector); | 893 ElemHideBase.call(this, text, domains, selector); |
891 } | 894 } |
892 exports.ElemHideException = ElemHideException; | 895 exports.ElemHideException = ElemHideException; |
893 | 896 |
894 ElemHideException.prototype = | 897 ElemHideException.prototype = |
895 { | 898 { |
896 __proto__: ElemHideBase.prototype | 899 __proto__: ElemHideBase.prototype |
897 }; | 900 }; |
LEFT | RIGHT |