| LEFT | RIGHT |
| 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 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 /** | 34 /** |
| 35 * Abstract base class for filters | 35 * Abstract base class for filters |
| 36 * | 36 * |
| 37 * @param {string} text string representation of the filter | 37 * @param {string} text string representation of the filter |
| 38 * @constructor | 38 * @constructor |
| 39 */ | 39 */ |
| 40 function Filter(text) | 40 function Filter(text) |
| 41 { | 41 { |
| 42 this.text = text; | 42 this.text = text; |
| 43 | 43 |
| 44 /** |
| 45 * Subscriptions to which this filter belongs. |
| 46 * @type {Set.<Subscription>} |
| 47 * @private |
| 48 */ |
| 44 this._subscriptions = new Set(); | 49 this._subscriptions = new Set(); |
| 45 } | 50 } |
| 46 exports.Filter = Filter; | 51 exports.Filter = Filter; |
| 47 | 52 |
| 48 Filter.prototype = | 53 Filter.prototype = |
| 49 { | 54 { |
| 50 /** | 55 /** |
| 51 * String representation of the filter | 56 * String representation of the filter |
| 52 * @type {string} | 57 * @type {string} |
| 53 */ | 58 */ |
| 54 text: null, | 59 text: null, |
| 55 | 60 |
| 56 /** | 61 /** |
| 57 * Filter type as a string, e.g. "blocking". | 62 * Filter type as a string, e.g. "blocking". |
| 58 * @type {string} | 63 * @type {string} |
| 59 */ | 64 */ |
| 60 get type() | 65 get type() |
| 61 { | 66 { |
| 62 throw new Error("Please define filter type in the subclass"); | 67 throw new Error("Please define filter type in the subclass"); |
| 63 }, | 68 }, |
| 64 | 69 |
| 65 /** | 70 /** |
| 66 * Yields filter subscriptions the filter belongs to | 71 * Yields subscriptions to which the filter belongs. |
| 67 * @yields {Subscription} | 72 * @yields {Subscription} |
| 68 */ | 73 */ |
| 69 *subscriptions() | 74 *subscriptions() |
| 70 { | 75 { |
| 71 yield* this._subscriptions; | 76 yield* this._subscriptions; |
| 72 }, | 77 }, |
| 73 | 78 |
| 79 /** |
| 80 * The number of subscriptions to which the filter belongs. |
| 81 * @type {number} |
| 82 */ |
| 83 get subscriptionCount() |
| 84 { |
| 85 return this._subscriptions.size; |
| 86 }, |
| 87 |
| 88 /** |
| 89 * Adds a subscription to the set of subscriptions to which the filter |
| 90 * belongs. |
| 91 * @param {Subscription} subscription |
| 92 */ |
| 74 addSubscription(subscription) | 93 addSubscription(subscription) |
| 75 { | 94 { |
| 76 this._subscriptions.add(subscription); | 95 this._subscriptions.add(subscription); |
| 77 }, | 96 }, |
| 78 | 97 |
| 98 /** |
| 99 * Removes a subscription from the set of subscriptions to which the filter |
| 100 * belongs. |
| 101 * @param {Subscription} subscription |
| 102 */ |
| 79 removeSubscription(subscription) | 103 removeSubscription(subscription) |
| 80 { | 104 { |
| 81 this._subscriptions.delete(subscription); | 105 this._subscriptions.delete(subscription); |
| 82 }, | 106 }, |
| 83 | 107 |
| 84 /** | 108 /** |
| 85 * Serializes the filter to an array of strings for writing out on the disk. | 109 * Serializes the filter to an array of strings for writing out on the disk. |
| 86 * @param {string[]} buffer buffer to push the serialization results into | 110 * @param {string[]} buffer buffer to push the serialization results into |
| 87 */ | 111 */ |
| 88 serialize(buffer) | 112 serialize(buffer) |
| (...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 | 1215 |
| 1192 /** | 1216 /** |
| 1193 * Script that should be executed | 1217 * Script that should be executed |
| 1194 * @type {string} | 1218 * @type {string} |
| 1195 */ | 1219 */ |
| 1196 get script() | 1220 get script() |
| 1197 { | 1221 { |
| 1198 return this.body; | 1222 return this.body; |
| 1199 } | 1223 } |
| 1200 }); | 1224 }); |
| LEFT | RIGHT |