| 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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 { | 122 { |
| 123 if (/^(?!https?:)[\w-]+:/i.test(urls[i])) | 123 if (/^(?!https?:)[\w-]+:/i.test(urls[i])) |
| 124 urls.splice(i--, 1); | 124 urls.splice(i--, 1); |
| 125 } | 125 } |
| 126 | 126 |
| 127 return urls; | 127 return urls; |
| 128 } | 128 } |
| 129 | 129 |
| 130 function hideElement(element) | 130 function hideElement(element) |
| 131 { | 131 { |
| 132 function doHide(el) | 132 function doHide() |
| 133 { | 133 { |
| 134 let propertyName = "display"; | 134 let propertyName = "display"; |
| 135 let propertyValue = "none"; | 135 let propertyValue = "none"; |
| 136 if (el.localName == "frame") | 136 if (element.localName == "frame") |
| 137 { | 137 { |
| 138 propertyName = "visibility"; | 138 propertyName = "visibility"; |
| 139 propertyValue = "hidden"; | 139 propertyValue = "hidden"; |
| 140 } | 140 } |
| 141 | 141 |
| 142 if (el.style.getPropertyValue(propertyName) != propertyValue || | 142 if (element.style.getPropertyValue(propertyName) != propertyValue || |
| 143 el.style.getPropertyPriority(propertyName) != "important") | 143 element.style.getPropertyPriority(propertyName) != "important") |
| 144 el.style.setProperty(propertyName, propertyValue, "important"); | 144 element.style.setProperty(propertyName, propertyValue, "important"); |
| 145 } | 145 } |
| 146 | 146 |
| 147 doHide(element); | 147 doHide(); |
| 148 | 148 |
| 149 new MutationObserver(doHide).observe( | 149 new MutationObserver(doHide).observe( |
| 150 element, { | 150 element, { |
| 151 attributes: true, | 151 attributes: true, |
| 152 attributeFilter: ["style"] | 152 attributeFilter: ["style"] |
| 153 } | 153 } |
| 154 ); | 154 ); |
| 155 } | 155 } |
| 156 | 156 |
| 157 function checkCollapse(element) | 157 function checkCollapse(element) |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 checkCollapse(event.target); | 491 checkCollapse(event.target); |
| 492 }, true); | 492 }, true); |
| 493 | 493 |
| 494 document.addEventListener("load", event => | 494 document.addEventListener("load", event => |
| 495 { | 495 { |
| 496 let element = event.target; | 496 let element = event.target; |
| 497 if (/^i?frame$/.test(element.localName)) | 497 if (/^i?frame$/.test(element.localName)) |
| 498 checkCollapse(element); | 498 checkCollapse(element); |
| 499 }, true); | 499 }, true); |
| 500 } | 500 } |
| OLD | NEW |