| 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 | 
| 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 12  * GNU General Public License for more details. | 12  * GNU General Public License for more details. | 
| 13  * | 13  * | 
| 14  * You should have received a copy of the GNU General Public License | 14  * You should have received a copy of the GNU General Public License | 
| 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 15  * along with Adblock Plus.  If not, see <http://www.gnu.org/licenses/>. | 
| 16  */ | 16  */ | 
| 17 | 17 | 
| 18 "use strict"; | 18 "use strict"; | 
| 19 | 19 | 
| 20 /** | 20 /** | 
| 21  * @fileOverview Snippets implementation. | 21  * @fileOverview Snippets implementation. | 
| 22  */ | 22  */ | 
| 23 | 23 | 
| 24 const {ElemHide} = require("./elemHide"); |  | 
| 25 const {Filter} = require("./filterClasses"); | 24 const {Filter} = require("./filterClasses"); | 
| 26 | 25 | 
| 27 let filters = new Set(); | 26 let filters = new Set(); | 
| 28 | 27 | 
| 29 /** | 28 /** | 
| 30  * Container for snippet filters | 29  * Container for snippet filters | 
| 31  * @class | 30  * @class | 
| 32  */ | 31  */ | 
| 33 let Snippets = { | 32 let Snippets = { | 
| 34   /** | 33   /** | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 61    * Returns a list of all scripts active on a particular domain | 60    * Returns a list of all scripts active on a particular domain | 
| 62    * @param {string} domain | 61    * @param {string} domain | 
| 63    * @return {string[]} | 62    * @return {string[]} | 
| 64    */ | 63    */ | 
| 65   getScriptsForDomain(domain) | 64   getScriptsForDomain(domain) | 
| 66   { | 65   { | 
| 67     let result = []; | 66     let result = []; | 
| 68     for (let text of filters) | 67     for (let text of filters) | 
| 69     { | 68     { | 
| 70       let filter = Filter.fromText(text); | 69       let filter = Filter.fromText(text); | 
| 71       if (filter.isActiveOnDomain(domain) && | 70       if (filter.isActiveOnDomain(domain)) | 
| 72           !ElemHide.getException(filter, domain)) | 71         result.push(filter.script); | 
| 73       { |  | 
| 74         result.push(filter.code); |  | 
| 75       } |  | 
| 76     } | 72     } | 
| 77     return result; | 73     return result; | 
| 78   } | 74   } | 
| 79 }; | 75 }; | 
| 80 | 76 | 
| 81 exports.Snippets = Snippets; | 77 exports.Snippets = Snippets; | 
| LEFT | RIGHT | 
|---|