| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 type: "filters.collapse", | 143 type: "filters.collapse", |
| 144 urls: urls, | 144 urls: urls, |
| 145 mediatype: mediatype, | 145 mediatype: mediatype, |
| 146 baseURL: document.location.href | 146 baseURL: document.location.href |
| 147 }, | 147 }, |
| 148 | 148 |
| 149 function(collapse) | 149 function(collapse) |
| 150 { | 150 { |
| 151 function collapseElement() | 151 function collapseElement() |
| 152 { | 152 { |
| 153 var propertyName = "display"; |
| 154 var propertyValue = "none"; |
| 153 if (element.localName == "frame") | 155 if (element.localName == "frame") |
| 154 element.style.setProperty("visibility", "hidden", "important"); | 156 { |
| 155 else | 157 propertyName = "visibility"; |
| 156 element.style.setProperty("display", "none", "important"); | 158 propertyValue = "hidden"; |
| 159 } |
| 160 if (element.style.getPropertyValue(propertyName) != propertyValue || |
| 161 element.style.getPropertyPriority(propertyName) != "important") |
| 162 element.style.setProperty(propertyName, propertyValue, "important");
|
| 157 } | 163 } |
| 158 | 164 |
| 159 if (collapse && !element._collapsed) | 165 if (collapse) |
| 160 { | 166 { |
| 161 collapseElement(); | 167 collapseElement(); |
| 162 element._collapsed = true; | |
| 163 | 168 |
| 164 if (MutationObserver) | 169 if (MutationObserver) |
| 165 new MutationObserver(collapseElement).observe( | 170 new MutationObserver(collapseElement).observe( |
| 166 element, { | 171 element, { |
| 167 attributes: true, | 172 attributes: true, |
| 168 attributeFilter: ["style"] | 173 attributeFilter: ["style"] |
| 169 } | 174 } |
| 170 ); | 175 ); |
| 171 } | 176 } |
| 172 } | 177 } |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 }, true); | 569 }, true); |
| 565 | 570 |
| 566 return updateStylesheet; | 571 return updateStylesheet; |
| 567 } | 572 } |
| 568 | 573 |
| 569 if (document instanceof HTMLDocument) | 574 if (document instanceof HTMLDocument) |
| 570 { | 575 { |
| 571 checkSitekey(); | 576 checkSitekey(); |
| 572 window.updateStylesheet = init(document); | 577 window.updateStylesheet = init(document); |
| 573 } | 578 } |
| OLD | NEW |