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 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // setting the style="..." attribute. | 151 // setting the style="..." attribute. |
152 if (element.localName == "video" || element.localName == "audio") | 152 if (element.localName == "video" || element.localName == "audio") |
153 { | 153 { |
154 for (let child of element.children) | 154 for (let child of element.children) |
155 { | 155 { |
156 if (child.localName == "source" || child.localName == "track") | 156 if (child.localName == "source" || child.localName == "track") |
157 return null; | 157 return null; |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 let selector = element.localName; | 161 let selector = ""; |
162 let hasSrc = false; | |
163 for (let attr of ["src", "srcset"]) | 162 for (let attr of ["src", "srcset"]) |
164 { | 163 { |
165 let value = element.getAttribute(attr); | 164 let value = element.getAttribute(attr); |
166 if (value && attr in element) | 165 if (value && attr in element) |
167 { | |
168 selector += "[" + attr + "=" + CSS.escape(value) + "]"; | 166 selector += "[" + attr + "=" + CSS.escape(value) + "]"; |
169 hasSrc = true; | 167 } |
170 } | 168 |
171 } | 169 return selector ? element.localName + selector : null; |
172 | |
173 return hasSrc ? selector : null; | |
174 } | 170 } |
175 | 171 |
176 function hideElement(element) | 172 function hideElement(element) |
177 { | 173 { |
178 function doHide() | 174 function doHide() |
179 { | 175 { |
180 let propertyName = "display"; | 176 let propertyName = "display"; |
181 let propertyValue = "none"; | 177 let propertyValue = "none"; |
182 if (element.localName == "frame") | 178 if (element.localName == "frame") |
183 { | 179 { |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 let element = event.target; | 605 let element = event.target; |
610 if (/^i?frame$/.test(element.localName)) | 606 if (/^i?frame$/.test(element.localName)) |
611 checkCollapse(element); | 607 checkCollapse(element); |
612 }, true); | 608 }, true); |
613 } | 609 } |
614 | 610 |
615 window.checkCollapse = checkCollapse; | 611 window.checkCollapse = checkCollapse; |
616 window.elemhide = elemhide; | 612 window.elemhide = elemhide; |
617 window.typeMap = typeMap; | 613 window.typeMap = typeMap; |
618 window.getURLsFromElement = getURLsFromElement; | 614 window.getURLsFromElement = getURLsFromElement; |
LEFT | RIGHT |