| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 }); | 42 }); |
| 43 | 43 |
| 44 port.on("getUnconditionalSelectors", () => | 44 port.on("getUnconditionalSelectors", () => |
| 45 { | 45 { |
| 46 return [ | 46 return [ |
| 47 ElemHide.getUnconditionalSelectors(), | 47 ElemHide.getUnconditionalSelectors(), |
| 48 ElemHide.getUnconditionalFilterKeys() | 48 ElemHide.getUnconditionalFilterKeys() |
| 49 ]; | 49 ]; |
| 50 }); | 50 }); |
| 51 | 51 |
| 52 port.on("getSelectorsForDomain", domain => | 52 port.on("getSelectorsForDomain", ([domain, specificOnly]) => |
| 53 { | 53 { |
| 54 return ElemHide.getSelectorsForDomain(domain, ElemHide.NO_UNCONDITIONAL, | 54 let type = specificOnly ? ElemHide.SPECIFIC_ONLY : ElemHide.NO_UNCONDITIONAL; |
| 55 true); | 55 return ElemHide.getSelectorsForDomain(domain, type, true); |
| 56 }); | 56 }); |
| 57 | 57 |
| 58 port.on("elemhideEnabled", ({frames, isPrivate}) => | 58 port.on("elemhideEnabled", ({frames, isPrivate}) => |
| 59 { | 59 { |
| 60 if (!Prefs.enabled) | 60 if (!Prefs.enabled) |
| 61 return {enabled: false}; | 61 return {enabled: false}; |
| 62 | 62 |
| 63 let hit = Policy.isFrameWhitelisted(frames, true); | 63 let hit = Policy.isFrameWhitelisted(frames, true); |
| 64 if (hit) | 64 if (hit) |
| 65 { | 65 { |
| 66 let [frameIndex, contentType, docDomain, thirdParty, location, filter] = hit
; | 66 let [frameIndex, contentType, docDomain, thirdParty, location, filter] = hit
; |
| 67 if (contentType != "GENERICHIDE") | 67 if (!isPrivate) |
| 68 { | 68 FilterStorage.increaseHitCount(filter); |
| 69 if (!isPrivate) | 69 return { |
| 70 FilterStorage.increaseHitCount(filter); | 70 enabled: contentType == "GENERICHIDE", |
| 71 return { | 71 contentType, docDomain, thirdParty, location, |
| 72 enabled: false, | 72 filter: filter.text, filterType: filter.type |
| 73 contentType, docDomain, thirdParty, location, | 73 }; |
| 74 filter: filter.text, filterType: filter.type | |
| 75 }; | |
| 76 } | |
| 77 } | 74 } |
| 78 | 75 |
| 79 return {enabled: true}; | 76 return {enabled: true}; |
| 80 }); | 77 }); |
| 81 | 78 |
| 82 port.on("registerElemHideHit", ({key, frames, isPrivate}) => | 79 port.on("registerElemHideHit", ({key, frames, isPrivate}) => |
| 83 { | 80 { |
| 84 let filter = ElemHide.getFilterByKey(key); | 81 let filter = ElemHide.getFilterByKey(key); |
| 85 if (!filter) | 82 if (!filter) |
| 86 return null; | 83 return null; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 100 | 97 |
| 101 return { | 98 return { |
| 102 contentType: "ELEMHIDE", | 99 contentType: "ELEMHIDE", |
| 103 docDomain, | 100 docDomain, |
| 104 thirdParty: false, | 101 thirdParty: false, |
| 105 location: filter.text.replace(/^.*?#/, '#'), | 102 location: filter.text.replace(/^.*?#/, '#'), |
| 106 filter: filter.text, | 103 filter: filter.text, |
| 107 filterType: filter.type | 104 filterType: filter.type |
| 108 }; | 105 }; |
| 109 }); | 106 }); |
| OLD | NEW |