OLD | NEW |
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 filters: null, | 61 filters: null, |
62 | 62 |
63 _title: null, | 63 _title: null, |
64 _fixedTitle: false, | 64 _fixedTitle: false, |
65 _disabled: false, | 65 _disabled: false, |
66 | 66 |
67 /** | 67 /** |
68 * Title of the filter subscription | 68 * Title of the filter subscription |
69 * @type String | 69 * @type String |
70 */ | 70 */ |
71 get title() this._title, | 71 get title() |
| 72 { |
| 73 return this._title; |
| 74 }, |
72 set title(value) | 75 set title(value) |
73 { | 76 { |
74 if (value != this._title) | 77 if (value != this._title) |
75 { | 78 { |
76 let oldValue = this._title; | 79 let oldValue = this._title; |
77 this._title = value; | 80 this._title = value; |
78 FilterNotifier.triggerListeners("subscription.title", this, value, oldValu
e); | 81 FilterNotifier.triggerListeners("subscription.title", this, value, oldValu
e); |
79 } | 82 } |
80 return this._title; | 83 return this._title; |
81 }, | 84 }, |
82 | 85 |
83 /** | 86 /** |
84 * Determines whether the title should be editable | 87 * Determines whether the title should be editable |
85 * @type Boolean | 88 * @type Boolean |
86 */ | 89 */ |
87 get fixedTitle() this._fixedTitle, | 90 get fixedTitle() |
| 91 { |
| 92 return this._fixedTitle; |
| 93 }, |
88 set fixedTitle(value) | 94 set fixedTitle(value) |
89 { | 95 { |
90 if (value != this._fixedTitle) | 96 if (value != this._fixedTitle) |
91 { | 97 { |
92 let oldValue = this._fixedTitle; | 98 let oldValue = this._fixedTitle; |
93 this._fixedTitle = value; | 99 this._fixedTitle = value; |
94 FilterNotifier.triggerListeners("subscription.fixedTitle", this, value, ol
dValue); | 100 FilterNotifier.triggerListeners("subscription.fixedTitle", this, value, ol
dValue); |
95 } | 101 } |
96 return this._fixedTitle; | 102 return this._fixedTitle; |
97 }, | 103 }, |
98 | 104 |
99 /** | 105 /** |
100 * Defines whether the filters in the subscription should be disabled | 106 * Defines whether the filters in the subscription should be disabled |
101 * @type Boolean | 107 * @type Boolean |
102 */ | 108 */ |
103 get disabled() this._disabled, | 109 get disabled() |
| 110 { |
| 111 return this._disabled; |
| 112 }, |
104 set disabled(value) | 113 set disabled(value) |
105 { | 114 { |
106 if (value != this._disabled) | 115 if (value != this._disabled) |
107 { | 116 { |
108 let oldValue = this._disabled; | 117 let oldValue = this._disabled; |
109 this._disabled = value; | 118 this._disabled = value; |
110 FilterNotifier.triggerListeners("subscription.disabled", this, value, oldV
alue); | 119 FilterNotifier.triggerListeners("subscription.disabled", this, value, oldV
alue); |
111 } | 120 } |
112 return this._disabled; | 121 return this._disabled; |
113 }, | 122 }, |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 return false; | 295 return false; |
287 }, | 296 }, |
288 | 297 |
289 /** | 298 /** |
290 * See Subscription.serialize() | 299 * See Subscription.serialize() |
291 */ | 300 */ |
292 serialize: function(buffer) | 301 serialize: function(buffer) |
293 { | 302 { |
294 Subscription.prototype.serialize.call(this, buffer); | 303 Subscription.prototype.serialize.call(this, buffer); |
295 if (this.defaults && this.defaults.length) | 304 if (this.defaults && this.defaults.length) |
296 buffer.push("defaults=" + this.defaults.filter(function(type) type in Spec
ialSubscription.defaultsMap).join(" ")); | 305 buffer.push("defaults=" + this.defaults.filter((type) => type in SpecialSu
bscription.defaultsMap).join(" ")); |
297 if (this._lastDownload) | 306 if (this._lastDownload) |
298 buffer.push("lastDownload=" + this._lastDownload); | 307 buffer.push("lastDownload=" + this._lastDownload); |
299 } | 308 } |
300 }; | 309 }; |
301 | 310 |
302 SpecialSubscription.defaultsMap = { | 311 SpecialSubscription.defaultsMap = { |
303 __proto__: null, | 312 __proto__: null, |
304 "whitelist": WhitelistFilter, | 313 "whitelist": WhitelistFilter, |
305 "blocking": BlockingFilter, | 314 "blocking": BlockingFilter, |
306 "elemhide": ElemHideBase | 315 "elemhide": ElemHideBase |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 { | 368 { |
360 __proto__: Subscription.prototype, | 369 __proto__: Subscription.prototype, |
361 | 370 |
362 _homepage: null, | 371 _homepage: null, |
363 _lastDownload: 0, | 372 _lastDownload: 0, |
364 | 373 |
365 /** | 374 /** |
366 * Filter subscription homepage if known | 375 * Filter subscription homepage if known |
367 * @type String | 376 * @type String |
368 */ | 377 */ |
369 get homepage() this._homepage, | 378 get homepage() |
| 379 { |
| 380 return this._homepage; |
| 381 }, |
370 set homepage(value) | 382 set homepage(value) |
371 { | 383 { |
372 if (value != this._homepage) | 384 if (value != this._homepage) |
373 { | 385 { |
374 let oldValue = this._homepage; | 386 let oldValue = this._homepage; |
375 this._homepage = value; | 387 this._homepage = value; |
376 FilterNotifier.triggerListeners("subscription.homepage", this, value, oldV
alue); | 388 FilterNotifier.triggerListeners("subscription.homepage", this, value, oldV
alue); |
377 } | 389 } |
378 return this._homepage; | 390 return this._homepage; |
379 }, | 391 }, |
380 | 392 |
381 /** | 393 /** |
382 * Time of the last subscription download (in seconds since the beginning of t
he epoch) | 394 * Time of the last subscription download (in seconds since the beginning of t
he epoch) |
383 * @type Number | 395 * @type Number |
384 */ | 396 */ |
385 get lastDownload() this._lastDownload, | 397 get lastDownload() |
| 398 { |
| 399 return this._lastDownload; |
| 400 }, |
386 set lastDownload(value) | 401 set lastDownload(value) |
387 { | 402 { |
388 if (value != this._lastDownload) | 403 if (value != this._lastDownload) |
389 { | 404 { |
390 let oldValue = this._lastDownload; | 405 let oldValue = this._lastDownload; |
391 this._lastDownload = value; | 406 this._lastDownload = value; |
392 FilterNotifier.triggerListeners("subscription.lastDownload", this, value,
oldValue); | 407 FilterNotifier.triggerListeners("subscription.lastDownload", this, value,
oldValue); |
393 } | 408 } |
394 return this._lastDownload; | 409 return this._lastDownload; |
395 }, | 410 }, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 __proto__: RegularSubscription.prototype, | 466 __proto__: RegularSubscription.prototype, |
452 | 467 |
453 _downloadStatus: null, | 468 _downloadStatus: null, |
454 _lastCheck: 0, | 469 _lastCheck: 0, |
455 _errors: 0, | 470 _errors: 0, |
456 | 471 |
457 /** | 472 /** |
458 * Status of the last download (ID of a string) | 473 * Status of the last download (ID of a string) |
459 * @type String | 474 * @type String |
460 */ | 475 */ |
461 get downloadStatus() this._downloadStatus, | 476 get downloadStatus() |
| 477 { |
| 478 return this._downloadStatus; |
| 479 }, |
462 set downloadStatus(value) | 480 set downloadStatus(value) |
463 { | 481 { |
464 let oldValue = this._downloadStatus; | 482 let oldValue = this._downloadStatus; |
465 this._downloadStatus = value; | 483 this._downloadStatus = value; |
466 FilterNotifier.triggerListeners("subscription.downloadStatus", this, value,
oldValue); | 484 FilterNotifier.triggerListeners("subscription.downloadStatus", this, value,
oldValue); |
467 return this._downloadStatus; | 485 return this._downloadStatus; |
468 }, | 486 }, |
469 | 487 |
470 /** | 488 /** |
471 * Time of the last successful download (in seconds since the beginning of the | 489 * Time of the last successful download (in seconds since the beginning of the |
472 * epoch). | 490 * epoch). |
473 */ | 491 */ |
474 lastSuccess: 0, | 492 lastSuccess: 0, |
475 | 493 |
476 /** | 494 /** |
477 * Time when the subscription was considered for an update last time (in secon
ds | 495 * Time when the subscription was considered for an update last time (in secon
ds |
478 * since the beginning of the epoch). This will be used to increase softExpira
tion | 496 * since the beginning of the epoch). This will be used to increase softExpira
tion |
479 * if the user doesn't use Adblock Plus for some time. | 497 * if the user doesn't use Adblock Plus for some time. |
480 * @type Number | 498 * @type Number |
481 */ | 499 */ |
482 get lastCheck() this._lastCheck, | 500 get lastCheck() |
| 501 { |
| 502 return this._lastCheck; |
| 503 }, |
483 set lastCheck(value) | 504 set lastCheck(value) |
484 { | 505 { |
485 if (value != this._lastCheck) | 506 if (value != this._lastCheck) |
486 { | 507 { |
487 let oldValue = this._lastCheck; | 508 let oldValue = this._lastCheck; |
488 this._lastCheck = value; | 509 this._lastCheck = value; |
489 FilterNotifier.triggerListeners("subscription.lastCheck", this, value, old
Value); | 510 FilterNotifier.triggerListeners("subscription.lastCheck", this, value, old
Value); |
490 } | 511 } |
491 return this._lastCheck; | 512 return this._lastCheck; |
492 }, | 513 }, |
493 | 514 |
494 /** | 515 /** |
495 * Hard expiration time of the filter subscription (in seconds since the begin
ning of the epoch) | 516 * Hard expiration time of the filter subscription (in seconds since the begin
ning of the epoch) |
496 * @type Number | 517 * @type Number |
497 */ | 518 */ |
498 expires: 0, | 519 expires: 0, |
499 | 520 |
500 /** | 521 /** |
501 * Soft expiration time of the filter subscription (in seconds since the begin
ning of the epoch) | 522 * Soft expiration time of the filter subscription (in seconds since the begin
ning of the epoch) |
502 * @type Number | 523 * @type Number |
503 */ | 524 */ |
504 softExpiration: 0, | 525 softExpiration: 0, |
505 | 526 |
506 /** | 527 /** |
507 * Number of download failures since last success | 528 * Number of download failures since last success |
508 * @type Number | 529 * @type Number |
509 */ | 530 */ |
510 get errors() this._errors, | 531 get errors() |
| 532 { |
| 533 return this._errors; |
| 534 }, |
511 set errors(value) | 535 set errors(value) |
512 { | 536 { |
513 if (value != this._errors) | 537 if (value != this._errors) |
514 { | 538 { |
515 let oldValue = this._errors; | 539 let oldValue = this._errors; |
516 this._errors = value; | 540 this._errors = value; |
517 FilterNotifier.triggerListeners("subscription.errors", this, value, oldVal
ue); | 541 FilterNotifier.triggerListeners("subscription.errors", this, value, oldVal
ue); |
518 } | 542 } |
519 return this._errors; | 543 return this._errors; |
520 }, | 544 }, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 if (this.softExpiration) | 578 if (this.softExpiration) |
555 buffer.push("softExpiration=" + this.softExpiration); | 579 buffer.push("softExpiration=" + this.softExpiration); |
556 if (this.errors) | 580 if (this.errors) |
557 buffer.push("errors=" + this.errors); | 581 buffer.push("errors=" + this.errors); |
558 if (this.version) | 582 if (this.version) |
559 buffer.push("version=" + this.version); | 583 buffer.push("version=" + this.version); |
560 if (this.requiredVersion) | 584 if (this.requiredVersion) |
561 buffer.push("requiredVersion=" + this.requiredVersion); | 585 buffer.push("requiredVersion=" + this.requiredVersion); |
562 } | 586 } |
563 }; | 587 }; |
OLD | NEW |