 Issue 29865583:
  Issue 6886 - Return snippet filters instead of just scripts  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluscore/
    
  
    Issue 29865583:
  Issue 6886 - Return snippet filters instead of just scripts  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluscore/| Left: | ||
| Right: | 
| 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-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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 54 /** | 54 /** | 
| 55 * Removes a snippet filter | 55 * Removes a snippet filter | 
| 56 * @param {SnippetFilter} filter | 56 * @param {SnippetFilter} filter | 
| 57 */ | 57 */ | 
| 58 remove(filter) | 58 remove(filter) | 
| 59 { | 59 { | 
| 60 filters.delete(filter.text); | 60 filters.delete(filter.text); | 
| 61 }, | 61 }, | 
| 62 | 62 | 
| 63 /** | 63 /** | 
| 64 * Returns a list of all scripts active on a particular domain | 64 * Returns a list of all snippet filters active on a particular domain | 
| 65 * @param {string} domain | 65 * @param {string} domain | 
| 66 * @return {string[]} | 66 * @return {Filter[]} | 
| 
Manish Jethani
2018/08/27 05:59:13
As in the rest of the file we can be more specific
 
hub
2018/08/27 12:14:35
Done.
 | |
| 67 */ | 67 */ | 
| 68 getScriptsForDomain(domain) | 68 getSnippetsForDomain(domain) | 
| 
Manish Jethani
2018/08/27 05:40:10
Let's just call this `getFiltersForDomain`. Curren
 
hub
2018/08/27 12:14:35
Done.
 | |
| 69 { | 69 { | 
| 70 let result = []; | 70 let result = []; | 
| 71 for (let text of filters) | 71 for (let text of filters) | 
| 72 { | 72 { | 
| 73 let filter = Filter.fromText(text); | 73 let filter = Filter.fromText(text); | 
| 74 if (filter.isActiveOnDomain(domain)) | 74 if (filter.isActiveOnDomain(domain)) | 
| 75 result.push(filter.script); | 75 result.push(filter); | 
| 76 } | 76 } | 
| 77 return result; | 77 return result; | 
| 78 } | 78 } | 
| 79 }; | 79 }; | 
| 80 | 80 | 
| 81 exports.Snippets = Snippets; | 81 exports.Snippets = Snippets; | 
| 82 | 82 | 
| 83 /** | 83 /** | 
| 84 * Parses a script and returns a list of all its commands and their arguments | 84 * Parses a script and returns a list of all its commands and their arguments | 
| 85 * @param {string} script | 85 * @param {string} script | 
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 let value = imports[name]; | 188 let value = imports[name]; | 
| 189 if (typeof value == "function") | 189 if (typeof value == "function") | 
| 190 value(...args); | 190 value(...args); | 
| 191 } | 191 } | 
| 192 } | 192 } | 
| 193 } | 193 } | 
| 194 `; | 194 `; | 
| 195 } | 195 } | 
| 196 | 196 | 
| 197 exports.compileScript = compileScript; | 197 exports.compileScript = compileScript; | 
| OLD | NEW |